on master help sign in
Document how to use Series with toEncoding. Fixes #383
88dd775Adam Bergmark
Data/Aeson/Types/Internal.hs+7−1
@@ -353,7 +353,13 @@ instance Ord Encoding where
353 compare (Encoding a) (Encoding b) =
353 compare (Encoding a) (Encoding b) =
354 compare (toLazyByteString a) (toLazyByteString b)
354 compare (toLazyByteString a) (toLazyByteString b)
355
355
356−-- | A series of values that, when encoded, should be separated by commas.
356+-- | A series of values that, when encoded, should be separated by
357+-- commas. Since 0.11.0.0, the '.=' operator is overloaded to create
358+-- either @(Text, Value)@ or 'Series'. You can use Series when
359+-- encoding directly to a bytestring builder as in the following
360+-- example:
361+--
362+-- > toEncoding (Person name age) = pairs ("name" .= name <> "age" .= age)
357data Series = Empty
363data Series = Empty
358 | Value Encoding
364 | Value Encoding
359 deriving (Typeable)
365 deriving (Typeable)