From 085c16fb21b9f856a435a3faab980e7e0b319341 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Sat, 21 May 2022 14:16:17 -0400 Subject: [PATCH] patch from #3 --- src/Data/HexString.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/HexString.hs b/src/Data/HexString.hs index 8b1c276..3caebcf 100644 --- a/src/Data/HexString.hs +++ b/src/Data/HexString.hs @@ -12,7 +12,7 @@ import Data.Aeson import Data.Word (Word8) import qualified Data.ByteString as BS -import qualified Data.ByteString.Base16 as BS16 (decode, encode) +import qualified Data.ByteString.Base16 as BS16 (decodeLenient, encode) import qualified Data.ByteString.Lazy as BSL import qualified Data.Text as T @@ -52,7 +52,7 @@ fromBinary = hexString . BS16.encode . BSL.toStrict . B.encode -- | Converts a 'HexString' to a 'B.Binary' value toBinary :: B.Binary a => HexString -> a -toBinary (HexString bs) = B.decode . BSL.fromStrict . fst . BS16.decode $ bs +toBinary (HexString bs) = B.decode . BSL.fromStrict . BS16.decodeLenient $ bs -- | Reads a 'BS.ByteString' as raw bytes and converts to hex representation. We -- cannot use the instance Binary of 'BS.ByteString' because it provides @@ -62,7 +62,7 @@ fromBytes = hexString . BS16.encode -- | Access to the raw bytes in a 'BS.ByteString' format. toBytes :: HexString -> BS.ByteString -toBytes (HexString bs) = (fst . BS16.decode) bs +toBytes (HexString bs) = BS16.decodeLenient bs -- | Access to a 'T.Text' representation of the 'HexString' toText :: HexString -> T.Text