Skip to content

Commit 3470625

Browse files
committed
core: add lower bound to base16-bytestring, remove CPP
Related to #175
1 parent ee40d47 commit 3470625

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ library
7979
base >=4.12 && <5
8080
, attoparsec
8181
, algebraic-graphs >= 0.5 && < 0.8
82-
, base16-bytestring
82+
, base16-bytestring >= 1.0
8383
, base64-bytestring
8484
, bytestring
8585
, case-insensitive

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
{-# LANGUAGE CPP #-}
2-
31
module System.Nix.Base
42
( BaseEncoding(Base16,NixBase32,Base64)
53
, encodeWith
@@ -36,18 +34,9 @@ encodeWith Base64 =
3634

3735
-- | Take the input & @Base@ encoding witness -> decode into @Text@.
3836
decodeWith :: BaseEncoding -> Text -> Either String ByteString
39-
#if MIN_VERSION_base16_bytestring(1,0,0)
4037
decodeWith Base16 =
4138
Data.ByteString.Base16.decode
4239
. Data.Text.Encoding.encodeUtf8
43-
#else
44-
decodeWith Base16 = lDecode -- this tacit sugar simply makes GHC pleased with number of args
45-
where
46-
lDecode t =
47-
case Data.ByteString.Base16.decode (Data.Text.Encoding.encodeUtf8 t) of
48-
(x, "") -> pure $ x
49-
_ -> Left $ "Unable to decode base16 string" <> toString t
50-
#endif
5140
decodeWith NixBase32 = System.Nix.Base32.decode
5241
decodeWith Base64 =
5342
Data.ByteString.Base64.decode

0 commit comments

Comments
 (0)