Skip to content

Commit 57137ad

Browse files
committed
Core: Internal: form Base
It is tiny, but it is a start of separation of the Base encodings from hashing subsystem.
1 parent 08eaf1c commit 57137ad

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

hnix-store-core/hnix-store-core.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ library
3535
, System.Nix.Hash
3636
, System.Nix.Internal.Base32
3737
, System.Nix.Internal.Hash
38+
, System.Nix.Internal.Base
3839
, System.Nix.Internal.Nar.Parser
3940
, System.Nix.Internal.Nar.Streamer
4041
, System.Nix.Internal.Nar.Effects

hnix-store-core/src/System/Nix/Hash.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ module System.Nix.Hash
1313
, Hash.hashLazy
1414
, Hash.mkNamedDigest
1515

16-
, Hash.BaseEncoding(..)
16+
, Base.BaseEncoding(..)
1717
, Hash.encodeInBase
1818
, Hash.decodeBase
1919
)
2020
where
2121

2222
import qualified System.Nix.Internal.Hash as Hash
23+
import qualified System.Nix.Internal.Base as Base
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module System.Nix.Internal.Base
2+
( module System.Nix.Internal.Base
3+
, encode
4+
, decode
5+
)
6+
where
7+
8+
import System.Nix.Internal.Base32
9+
10+
-- | Constructors to indicate the base encodings
11+
data BaseEncoding
12+
= Base16
13+
| Base32
14+
-- | ^ Nix has a special map of Base32 encoding
15+
| Base64

hnix-store-core/src/System/Nix/Internal/Hash.hs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,8 @@ import Data.Word (Word8)
3434
import qualified GHC.TypeLits as Kind
3535
(Nat, KnownNat, natVal)
3636
import Data.Coerce (coerce)
37-
38-
-- | Constructors to indicate the base encodings
39-
data BaseEncoding
40-
= Base16
41-
| Base32
42-
-- | ^ Nix has a special map of Base32 encoding
43-
| Base64
37+
import System.Nix.Internal.Base
38+
(BaseEncoding(Base16,Base32,Base64))
4439

4540
-- | The universe of supported hash algorithms.
4641
--

0 commit comments

Comments
 (0)