on master help sign in
Move series to a new home
4f211eeBryan O'Sullivan
Data/Aeson/Encode/Functions.hs+6
@@ -5,6 +5,7 @@ module Data.Aeson.Encode.Functions
5 , char7
5 , char7
6 , foldable
6 , foldable
7 , list
7 , list
8+ , series
8 ) where
9 ) where
9
10
10import Data.Aeson.Encode.Builder
11import Data.Aeson.Encode.Builder
@@ -35,3 +36,8 @@ brackets :: Char -> Char -> Series -> Encoding
35brackets begin end (Value v) = Encoding $
36brackets begin end (Value v) = Encoding $
36 char7 begin <> fromEncoding v <> char7 end
37 char7 begin <> fromEncoding v <> char7 end
37brackets begin end Empty = Encoding (primBounded (ascii2 (begin,end)) ())
38brackets 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
66 , defaultTaggedObject
66 , defaultTaggedObject
67 ) where
67 ) where
68
68
69−import Data.Aeson.Encode.Functions (foldable)
69+import Data.Aeson.Encode.Functions (foldable, series)
70import Data.Aeson.Types.Generic ()
70import Data.Aeson.Types.Generic ()
71import Data.Aeson.Types.Instances
71import Data.Aeson.Types.Instances
72import Data.Aeson.Types.Internal
72import Data.Aeson.Types.Internal
Data/Aeson/Types/Instances.hs−6
@@ -49,7 +49,6 @@ module Data.Aeson.Types.Instances
49 , (.:)
49 , (.:)
50 , (.:?)
50 , (.:?)
51 , (.!=)
51 , (.!=)
52− , series
53 , tuple
52 , tuple
54 , (>*<)
53 , (>*<)
55 , typeMismatch
54 , typeMismatch
@@ -1450,11 +1449,6 @@ instance KeyValue Series where
1450 E.text name <> B.char7 ':' <> builder value
1449 E.text name <> B.char7 ':' <> builder value
1451 {-# INLINE (.=) #-}
1450 {-# INLINE (.=) #-}
1452
1451
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−
1458-- | Convert a value from JSON, failing if the types do not match.
1452-- | Convert a value from JSON, failing if the types do not match.
1459fromJSON :: (FromJSON a) => Value -> Result a
1453fromJSON :: (FromJSON a) => Value -> Result a
1460fromJSON = parse parseJSON
1454fromJSON = parse parseJSON