mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2024-11-28 05:36:24 +03:00
core: derive classics for BaseEncoding enum
This commit is contained in:
parent
e950c84408
commit
1702fa0abf
@ -6,6 +6,7 @@ module System.Nix.Base
|
|||||||
|
|
||||||
import Data.ByteString (ByteString)
|
import Data.ByteString (ByteString)
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
|
import GHC.Generics (Generic)
|
||||||
|
|
||||||
import qualified Data.Text.Encoding
|
import qualified Data.Text.Encoding
|
||||||
import qualified Data.ByteString.Base16
|
import qualified Data.ByteString.Base16
|
||||||
@ -21,6 +22,7 @@ data BaseEncoding
|
|||||||
-- & NixBase seems be the most widely used in Nix.
|
-- & NixBase seems be the most widely used in Nix.
|
||||||
| Base16
|
| Base16
|
||||||
| Base64
|
| Base64
|
||||||
|
deriving (Bounded, Eq, Enum, Generic, Ord, Show)
|
||||||
|
|
||||||
-- | Encode @ByteString@ with @Base@ encoding, produce @Text@.
|
-- | Encode @ByteString@ with @Base@ encoding, produce @Text@.
|
||||||
encodeWith :: BaseEncoding -> ByteString -> Text
|
encodeWith :: BaseEncoding -> ByteString -> Text
|
||||||
|
Loading…
Reference in New Issue
Block a user