diff --git a/hnix-store-core/src/System/Nix/Internal/Base.hs b/hnix-store-core/src/System/Nix/Internal/Base.hs index 7fc5343..5ed6a0e 100644 --- a/hnix-store-core/src/System/Nix/Internal/Base.hs +++ b/hnix-store-core/src/System/Nix/Internal/Base.hs @@ -39,7 +39,7 @@ decodeWith Base16 = lDecode -- this tacit sugar simply makes GHC pleased with n lDecode t = case Base16.decode (T.encodeUtf8 t) of (x, "") -> pure $ x - _ -> Left $ "Unable to decode base16 string" <> T.unpack t + _ -> Left $ "Unable to decode base16 string" <> toString t #endif decodeWith NixBase32 = Base32.decode decodeWith Base64 = Base64.decode . T.encodeUtf8 diff --git a/hnix-store-core/src/System/Nix/Internal/Base32.hs b/hnix-store-core/src/System/Nix/Internal/Base32.hs index 60a30b5..bc35f22 100644 --- a/hnix-store-core/src/System/Nix/Internal/Base32.hs +++ b/hnix-store-core/src/System/Nix/Internal/Base32.hs @@ -68,7 +68,7 @@ unsafeDecode what = (\c -> fromMaybe (error "character not in digits32") $ Vector.findIndex (== c) digits32 ) - (Data.Text.unpack what) + (toString what) of [(i, _)] -> pure $ padded $ integerToBS i x -> Left $ "Can't decode: readInt returned " <> show x diff --git a/hnix-store-core/src/System/Nix/Internal/Hash.hs b/hnix-store-core/src/System/Nix/Internal/Hash.hs index 28a60de..7ac3c49 100644 --- a/hnix-store-core/src/System/Nix/Internal/Hash.hs +++ b/hnix-store-core/src/System/Nix/Internal/Hash.hs @@ -49,27 +49,27 @@ data SomeNamedDigest = forall a . NamedAlgo a => SomeDigest (C.Digest a) instance Show SomeNamedDigest where show sd = case sd of - SomeDigest (digest :: C.Digest hashType) -> T.unpack $ "SomeDigest " <> algoName @hashType <> ":" <> encodeDigestWith NixBase32 digest + SomeDigest (digest :: C.Digest hashType) -> toString $ "SomeDigest " <> algoName @hashType <> ":" <> encodeDigestWith NixBase32 digest mkNamedDigest :: Text -> Text -> Either String SomeNamedDigest mkNamedDigest name sriHash = let (sriName, h) = T.breakOnEnd "-" sriHash in if sriName == "" || sriName == name <> "-" then mkDigest h - else Left $ T.unpack $ "Sri hash method " <> sriName <> " does not match the required hash type " <> name + else Left $ toString $ "Sri hash method " <> sriName <> " does not match the required hash type " <> name where mkDigest h = case name of "md5" -> SomeDigest <$> decodeGo C.MD5 h "sha1" -> SomeDigest <$> decodeGo C.SHA1 h "sha256" -> SomeDigest <$> decodeGo C.SHA256 h "sha512" -> SomeDigest <$> decodeGo C.SHA512 h - _ -> Left $ "Unknown hash name: " <> T.unpack name + _ -> Left $ "Unknown hash name: " <> toString name decodeGo :: forall a . NamedAlgo a => a -> Text -> Either String (C.Digest a) decodeGo a h | size == base16Len = decodeDigestWith Base16 h | size == base32Len = decodeDigestWith NixBase32 h | size == base64Len = decodeDigestWith Base64 h - | otherwise = Left $ T.unpack sriHash <> " is not a valid " <> T.unpack name <> " hash. Its length (" <> show size <> ") does not match any of " <> show [base16Len, base32Len, base64Len] + | otherwise = Left $ toString sriHash <> " is not a valid " <> toString name <> " hash. Its length (" <> show size <> ") does not match any of " <> show [base16Len, base32Len, base64Len] where size = T.length h hsize = C.hashDigestSize a diff --git a/hnix-store-core/src/System/Nix/Internal/Nar/Parser.hs b/hnix-store-core/src/System/Nix/Internal/Nar/Parser.hs index 2fb6577..f92e3cf 100644 --- a/hnix-store-core/src/System/Nix/Internal/Nar/Parser.hs +++ b/hnix-store-core/src/System/Nix/Internal/Nar/Parser.hs @@ -166,7 +166,7 @@ parseSymlink = do (dir, file) <- currentDirectoryAndFile pushLink $ LinkInfo - { linkTarget = Text.unpack target + { linkTarget = toString target , linkFile = file , linkPWD = dir } @@ -271,7 +271,7 @@ parseDirectory = do parens $ do expectStr "name" fName <- parseStr - pushFileName (Text.unpack fName) + pushFileName (toString fName) expectStr "node" parens parseFSO popFileName