core: clean saltine CPP overloads

One year late hah. Thanks Anton!
This commit is contained in:
Richard Marko 2023-11-19 18:51:28 +01:00
parent 541abd1e20
commit 631b26e436

View File

@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-|
Description : Nix-relevant interfaces to NaCl signatures.
-}
@ -16,12 +15,7 @@ import GHC.Generics (Generic)
import qualified Data.ByteString
import qualified Data.Coerce
-- 2021-05-30: NOTE: Please, clean-up these overloads in ~2022
#if MIN_VERSION_saltine(0,2,0)
import qualified Crypto.Saltine.Internal.Sign as NaClSizes
#else
import qualified Crypto.Saltine.Internal.ByteSizes as NaClSizes
#endif
-- | A NaCl signature.
newtype Signature = Signature ByteString
@ -29,11 +23,7 @@ newtype Signature = Signature ByteString
instance IsEncoding Signature where
decode s
#if MIN_VERSION_saltine(0,2,0)
| Data.ByteString.length s == NaClSizes.sign_bytes = Just $ Signature s
#else
| Data.ByteString.length s == NaClSizes.sign = Just $ Signature s
#endif
| otherwise = Nothing
encode = Data.Coerce.coerce