@@ -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