refactor(saltine): fix hlint and ghc warnings
This commit is contained in:
parent
cd84d0a932
commit
1d68ed9c5e
@ -1,5 +1,4 @@
|
|||||||
-- {-# LANGUAGE BangPatterns #-}
|
{-# OPTIONS_GHC -Wwarn -fno-warn-orphans #-}
|
||||||
{-# OPTIONS_GHC -Wwarn #-}
|
|
||||||
|
|
||||||
-- SPDX-FileCopyrightText: 2024-2025 Sarah Vaupel <sarah.vaupel@uniworx.de>
|
-- SPDX-FileCopyrightText: 2024-2025 Sarah Vaupel <sarah.vaupel@uniworx.de>
|
||||||
--
|
--
|
||||||
@ -64,8 +63,9 @@ foreign import ccall unsafe "sodium_bin2hex"
|
|||||||
bin2hex :: ByteString -> String
|
bin2hex :: ByteString -> String
|
||||||
bin2hex bs = let tlen = S.length bs * 2 + 1 in
|
bin2hex bs = let tlen = S.length bs * 2 + 1 in
|
||||||
S8.unpack . S8.init . snd . buildUnsafeByteString tlen $ \t ->
|
S8.unpack . S8.init . snd . buildUnsafeByteString tlen $ \t ->
|
||||||
constByteStrings [bs] $ \[(pbs, _)] ->
|
let aux [(pbs, _)] = c_sodium_bin2hex t (fromIntegral tlen) pbs (fromIntegral $ S.length bs)
|
||||||
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
|
instance Show Key where
|
||||||
show k = "SecretBox.Key {hashesTo = \"" <> (bin2hex . shorthash nullShKey $ encode k) <> "}\""
|
show k = "SecretBox.Key {hashesTo = \"" <> (bin2hex . shorthash nullShKey $ encode k) <> "}\""
|
||||||
|
|||||||
Reference in New Issue
Block a user