From 1752d03fe7b1a0f62fb26105b341c6bf89d2f787 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Mon, 14 Jul 2025 12:19:10 +0200 Subject: [PATCH] fix ambiguous occurrences --- src/Data/CryptoID/ByteString.hs | 4 ++-- src/Data/CryptoID/Poly.hs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Data/CryptoID/ByteString.hs b/src/Data/CryptoID/ByteString.hs index 4252353..014d0a1 100644 --- a/src/Data/CryptoID/ByteString.hs +++ b/src/Data/CryptoID/ByteString.hs @@ -106,7 +106,7 @@ instance Binary CryptoIDKey where -- that parses) getKey (KeySizeFixed n) = getByteString n getKey (KeySizeEnum ns) = asum [ getKey $ KeySizeFixed n | n <- sortOn Down ns ] - getKey (KeySizeRange min max) = getKey $ KeySizeEnum [min .. max] + getKey (KeySizeRange min' max') = getKey $ KeySizeEnum [min' .. max'] -- | Error cases that can be encountered during 'encrypt' and 'decrypt' @@ -169,7 +169,7 @@ genKey = CryptoIDKey <$> liftIO (getEntropy keySize) keySize | KeySizeFixed n <- keySize' = n | KeySizeEnum ns <- keySize' = maximum ns - | KeySizeRange _ max <- keySize' = max + | KeySizeRange _ max' <- keySize' = max' -- | Try to read a 'CryptoIDKey' from a file. -- If the file does not exist, securely generate a key (using 'genKey') and diff --git a/src/Data/CryptoID/Poly.hs b/src/Data/CryptoID/Poly.hs index f9799f1..67a7805 100644 --- a/src/Data/CryptoID/Poly.hs +++ b/src/Data/CryptoID/Poly.hs @@ -76,14 +76,14 @@ decrypt :: forall a m c namespace. , MonadThrow m , Binary a ) => (c -> m ByteString) -> CryptoIDKey -> CryptoID namespace c -> m a -decrypt decode key cID = do - cID' <- _ciphertext decode cID +decrypt dcode key cID = do + cID' <- _ciphertext dcode cID plaintext <- Lazy.ByteString.fromStrict <$> ByteString.decrypt key cID' case decodeOrFail plaintext of Left _ -> throwM DeserializationError - Right (rem, _, res) - | Lazy.ByteString.all (== 0) rem -> return res + Right (rem', _, res) + | Lazy.ByteString.all (== 0) rem' -> return res | otherwise -> throwM InvalidNamespaceDetected instance ( MonadCrypto m