on master help sign in
Add `@since 1.1.0.0` annotations

...and also add a few missing haddock strings while at it.

commit8f9b765b7dc2c956afe005396cf3f00f406121d9 authorHerbert Valerio Riedel <hvr@gnu.org> dateSat 23 Dec 2017, 18:33 (9 years ago) parent3ca519b
2 files changed+15
Data/Text/Encoding.hs+4 Data/Text/Lazy/Encoding.hs+11
Data/Text/Encoding.hs+4
@@ -318,6 +318,8 @@ decodeUtf8' = unsafeDupablePerformIO . try . evaluate . decodeUtf8With strictDec
318318{-# INLINE decodeUtf8' #-}
319319
320320-- | Encode text to a ByteString 'B.Builder' using UTF-8 encoding.
321+--
322+-- @since 1.1.0.0
321323encodeUtf8Builder :: Text -> B.Builder
322324encodeUtf8Builder = encodeUtf8BuilderEscaped (BP.liftFixedToBounded BP.word8)
323325
@@ -326,6 +328,8 @@ encodeUtf8Builder = encodeUtf8BuilderEscaped (BP.liftFixedToBounded BP.word8)
326328--
327329-- Use this function is to implement efficient encoders for text-based formats
328330-- like JSON or HTML.
331+--
332+-- @since 1.1.0.0
329333{-# INLINE encodeUtf8BuilderEscaped #-}
330334-- TODO: Extend documentation with references to source code in @blaze-html@
331335-- or @aeson@ that uses this function.
Data/Text/Lazy/Encoding.hs+11
@@ -141,6 +141,7 @@ decodeUtf8' bs = unsafeDupablePerformIO $ do
141141 rnf (Chunk _ ts) = rnf ts
142142{-# INLINE decodeUtf8' #-}
143143
144+-- | Encode text using UTF-8 encoding.
144145encodeUtf8 :: Text -> B.ByteString
145146encodeUtf8 Empty = B.empty
146147encodeUtf8 lt@(Chunk t _) =
@@ -154,10 +155,20 @@ encodeUtf8 lt@(Chunk t _) =
154155 firstChunkSize = min B.smallChunkSize (4 * (T.length t + 1))
155156 strategy = B.safeStrategy firstChunkSize B.defaultChunkSize
156157
158+-- | Encode text to a ByteString 'B.Builder' using UTF-8 encoding.
159+--
160+-- @since 1.1.0.0
157161encodeUtf8Builder :: Text -> B.Builder
158162encodeUtf8Builder =
159163 foldrChunks (\c b -> TE.encodeUtf8Builder c `mappend` b) Data.Monoid.mempty
160164
165+-- | Encode text using UTF-8 encoding and escape the ASCII characters using
166+-- a 'BP.BoundedPrim'.
167+--
168+-- Use this function is to implement efficient encoders for text-based formats
169+-- like JSON or HTML.
170+--
171+-- @since 1.1.0.0
161172{-# INLINE encodeUtf8BuilderEscaped #-}
162173encodeUtf8BuilderEscaped :: BP.BoundedPrim Word8 -> Text -> B.Builder
163174encodeUtf8BuilderEscaped prim =