on master help sign in
ByteString should not be an instance of the JSON type classes.

We can't know what its encoding is, so it's not safe.

commit7689c0ebf384af52d88c24ac18a6a8566043be89 authorBryan O'Sullivan <bos@mailrank.com> dateFri 21 Jan 2011, 19:05 (16 years ago) parent2bb1111
1 file changed−9
Data/Aeson/Types.hs−9
Data/Aeson/Types.hs−9
@@ -11,10 +11,8 @@ module Data.Aeson.Types
1111 ) where
1212
1313import Control.Applicative
14−import Data.ByteString (ByteString)
1514import Data.Map (Map)
1615import Data.Text (Text, pack, unpack)
17−import Data.Text.Encoding (decodeUtf8, encodeUtf8)
1816import Data.Time.Clock (UTCTime)
1917import Data.Time.Format (formatTime, parseTime)
2018import Data.Vector (Vector)
@@ -99,13 +97,6 @@ instance FromJSON Text where
9997 fromJSON _ = empty
10098 {-# INLINE fromJSON #-}
10199
102−instance ToJSON ByteString where
103− toJSON = String . decodeUtf8
104−
105−instance FromJSON ByteString where
106− fromJSON (String t) = pure (encodeUtf8 t)
107− fromJSON _ = empty
108−
109100mapA :: (Applicative f) => (t -> f a) -> [t] -> f [a]
110101mapA f = go
111102 where