summaryrefslogtreecommitdiffstats
path: root/src/Data/ByteString/Char8
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-21 19:14:55 +0100
committertv <tv@krebsco.de>2019-01-21 19:19:05 +0100
commit2842e05c232505c670daee0fffb9a34d5c866217 (patch)
tree90ffcdea7130b5811b6e02f931c5b1cc27a3191f /src/Data/ByteString/Char8
parentce276eee82ec0b8c4106beb4c51d6f9eb77335c4 (diff)
src: add Data.ByteString.Char8.Extended
Diffstat (limited to 'src/Data/ByteString/Char8')
-rw-r--r--src/Data/ByteString/Char8/Extended.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Data/ByteString/Char8/Extended.hs b/src/Data/ByteString/Char8/Extended.hs
new file mode 100644
index 0000000..4d46cd2
--- /dev/null
+++ b/src/Data/ByteString/Char8/Extended.hs
@@ -0,0 +1,15 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+module Data.ByteString.Char8.Extended
+ ( module Data.ByteString.Char8
+ ) where
+
+import Data.Aeson
+import Data.ByteString.Char8
+import Data.Text.Encoding (encodeUtf8)
+
+instance FromJSON ByteString where
+ parseJSON (String t) = pure (encodeUtf8 t)
+ parseJSON _ = pure undefined
+
+instance FromJSONKey ByteString where
+ fromJSONKey = FromJSONKeyText encodeUtf8