on master help sign in
Fix up haddocks
commit4319945b17e7f625e1d855ddd2f4898110a24c5e authorBryan O'Sullivan <bos@serpentine.com> dateSun 5 Jul 2015, 16:11 (11 years ago) parent9cf5ae3
3 files changed+11−2
Data/Aeson/Encode.hs+6 Data/Aeson/Encode/Builder.hs+4−2 Data/Aeson/Types/Instances.hs+1
Data/Aeson/Encode.hs+6
@@ -41,11 +41,17 @@ import qualified Data.Text as T
4141import qualified Data.Vector as V
4242
4343-- | Efficiently serialize a JSON value as a lazy 'L.ByteString'.
44+--
45+-- This is implemented in terms of the 'ToJSON' class's 'toEncoding' method.
4446encode :: ToJSON a => a -> L.ByteString
4547encode = B.toLazyByteString . fromEncoding . toEncoding
4648
4749-- | Encode a JSON 'Value' to a "Data.Text" 'Builder', which can be
4850-- embedded efficiently in a text-based protocol.
51+--
52+-- If you are going to immediately encode straight to a
53+-- 'L.ByteString', it is more efficient to use 'encodeToBuilder'
54+-- instead.
4955encodeToTextBuilder :: Value -> Builder
5056encodeToTextBuilder =
5157 go
Data/Aeson/Encode/Builder.hs+4−2
@@ -41,8 +41,10 @@ import qualified Data.Text as T
4141import qualified Data.Text.Encoding as TE
4242import qualified Data.Vector as V
4343
44−-- | Encode a JSON value to a ByteString 'B.Builder'. Use this function if you
45−-- must prepend or append further bytes to the encoded JSON value.
44+-- | Encode a JSON value to a "Data.ByteString" 'B.Builder'.
45+--
46+-- Use this function if you are encoding over the wire, or need to
47+-- prepend or append further bytes to the encoded JSON value.
4648encodeToBuilder :: Value -> Builder
4749encodeToBuilder Null = null_
4850encodeToBuilder (Bool b) = bool b
Data/Aeson/Types/Instances.hs+1
@@ -1450,6 +1450,7 @@ instance KeyValue Series where
14501450 E.text name <> B.char7 ':' <> builder value
14511451 {-# INLINE (.=) #-}
14521452
1453+-- | Encode a series of key/value pairs, separated by commas.
14531454series :: Series -> Encoding
14541455series Empty = mempty
14551456series (Value v) = v