on master help sign in
Move series to a new home
commit4f211eef5cfe1b4e938040a5324da89c8f23c6cc authorBryan O'Sullivan <bos@serpentine.com> dateSun 5 Jul 2015, 16:20 (11 years ago) parent4319945
3 files changed+7−7
Data/Aeson/Encode/Functions.hs+6 Data/Aeson/Types.hs+1−1 Data/Aeson/Types/Instances.hs−6
Data/Aeson/Encode/Functions.hs+6
@@ -5,6 +5,7 @@ module Data.Aeson.Encode.Functions
55 , char7
66 , foldable
77 , list
8+ , series
89 ) where
910
1011import Data.Aeson.Encode.Builder
@@ -35,3 +36,8 @@ brackets :: Char -> Char -> Series -> Encoding
3536brackets begin end (Value v) = Encoding $
3637 char7 begin <> fromEncoding v <> char7 end
3738brackets begin end Empty = Encoding (primBounded (ascii2 (begin,end)) ())
39+
40+-- | Encode a series of key/value pairs, separated by commas.
41+series :: Series -> Encoding
42+series Empty = mempty
43+series (Value v) = v
Data/Aeson/Types.hs+1−1
@@ -66,7 +66,7 @@ module Data.Aeson.Types
6666 , defaultTaggedObject
6767 ) where
6868
69−import Data.Aeson.Encode.Functions (foldable)
69+import Data.Aeson.Encode.Functions (foldable, series)
7070import Data.Aeson.Types.Generic ()
7171import Data.Aeson.Types.Instances
7272import Data.Aeson.Types.Internal
Data/Aeson/Types/Instances.hs−6
@@ -49,7 +49,6 @@ module Data.Aeson.Types.Instances
4949 , (.:)
5050 , (.:?)
5151 , (.!=)
52− , series
5352 , tuple
5453 , (>*<)
5554 , typeMismatch
@@ -1450,11 +1449,6 @@ instance KeyValue Series where
14501449 E.text name <> B.char7 ':' <> builder value
14511450 {-# INLINE (.=) #-}
14521451
1453−-- | Encode a series of key/value pairs, separated by commas.
1454−series :: Series -> Encoding
1455−series Empty = mempty
1456−series (Value v) = v
1457−
14581452-- | Convert a value from JSON, failing if the types do not match.
14591453fromJSON :: (FromJSON a) => Value -> Result a
14601454fromJSON = parse parseJSON