diff --git a/src/Crypto/Saltine/Instances.hs b/src/Crypto/Saltine/Instances.hs index 8bbc259e0..380ec8985 100644 --- a/src/Crypto/Saltine/Instances.hs +++ b/src/Crypto/Saltine/Instances.hs @@ -1,5 +1,4 @@ --- {-# LANGUAGE BangPatterns #-} -{-# OPTIONS_GHC -Wwarn #-} +{-# OPTIONS_GHC -Wwarn -fno-warn-orphans #-} -- SPDX-FileCopyrightText: 2024-2025 Sarah Vaupel -- @@ -64,8 +63,9 @@ foreign import ccall unsafe "sodium_bin2hex" bin2hex :: ByteString -> String bin2hex bs = let tlen = S.length bs * 2 + 1 in S8.unpack . S8.init . snd . buildUnsafeByteString tlen $ \t -> - constByteStrings [bs] $ \[(pbs, _)] -> - c_sodium_bin2hex t (fromIntegral tlen) pbs (fromIntegral $ S.length bs) + let aux [(pbs, _)] = c_sodium_bin2hex t (fromIntegral tlen) pbs (fromIntegral $ S.length bs) + aux _ = error "Crypto.Saltine.Instances.bin2hex reached an impossible computation path" + in constByteStrings [bs] aux instance Show Key where show k = "SecretBox.Key {hashesTo = \"" <> (bin2hex . shorthash nullShKey $ encode k) <> "}\""