diff options
author | Kierán Meinhardt <kieran.meinhardt@gmail.com> | 2020-09-23 17:44:40 +0200 |
---|---|---|
committer | Kierán Meinhardt <kieran.meinhardt@gmail.com> | 2020-09-23 17:44:40 +0200 |
commit | 8e92e6e11d2b3b0bfb5ac9d68f347219493e6380 (patch) | |
tree | 6484ca42d85ca89475e922f7b45039c116ebbf97 /src/Data/Aeson | |
parent | 6a6ad3aecd53ffd89101a0dee2b4ea576d4964d4 (diff) |
split into library + executables
Diffstat (limited to 'src/Data/Aeson')
-rw-r--r-- | src/Data/Aeson/Extends.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Data/Aeson/Extends.hs b/src/Data/Aeson/Extends.hs new file mode 100644 index 0000000..d78f81d --- /dev/null +++ b/src/Data/Aeson/Extends.hs @@ -0,0 +1,15 @@ +module Data.Aeson.Extends (module Data.Aeson.Extends) where + +import Data.Aeson as Data.Aeson.Extends + +import qualified Data.ByteString.Lazy as LBS +import qualified Data.Text.Encoding.Error as TE +import qualified Data.Text.Lazy.Encoding as LT + + +eitherDecodeLenient' :: FromJSON a => LBS.ByteString -> Either String a +eitherDecodeLenient' s = + either (const $ eitherDecode' $ lenientReencode s) id (eitherDecode' s) + where + lenientReencode = LT.encodeUtf8 . LT.decodeUtf8With TE.lenientDecode + |