on master help sign in
More comment fixes.
5128fb6Bryan O'Sullivan
Data/Text.hs+5−1
@@ -366,7 +366,7 @@ length t = S.length (stream t)
366
366
367-- -----------------------------------------------------------------------------
367-- -----------------------------------------------------------------------------
368-- * Transformations
368-- * Transformations
369−-- | /O(n)/ 'map' @f @t@ is the 'Text' obtained by applying @f@ to
369+-- | /O(n)/ 'map' @f@ @t@ is the 'Text' obtained by applying @f@ to
370-- each element of @t@. Subject to array fusion.
370-- each element of @t@. Subject to array fusion.
371map :: (Char -> Char) -> Text -> Text
371map :: (Char -> Char) -> Text -> Text
372map f t = unstream (S.map f (stream t))
372map f t = unstream (S.map f (stream t))
@@ -712,6 +712,10 @@ dropWhile p t@(Text arr off len) = loop 0 0
712-- | /O(n)/ 'dropAfter' @p@ @t@ returns the prefix remaining after
712-- | /O(n)/ 'dropAfter' @p@ @t@ returns the prefix remaining after
713-- dropping characters that fail the predicate @p@ from the end of
713-- dropping characters that fail the predicate @p@ from the end of
714-- @t@. This function is subject to array fusion.
714-- @t@. This function is subject to array fusion.
715+--
716+-- For example, to drop trailing white space:
717+--
718+-- > dropAfter isSpace
715dropAfter :: (Char -> Bool) -> Text -> Text
719dropAfter :: (Char -> Bool) -> Text -> Text
716dropAfter p t@(Text arr off len) = loop (len-1) len
720dropAfter p t@(Text arr off len) = loop (len-1) len
717 where loop !i !l | l <= 0 = empty
721 where loop !i !l | l <= 0 = empty
Data/Text/Lazy.hs+1−1
@@ -339,7 +339,7 @@ length = foldlChunks go 0
339 S.length (stream t) = length t
339 S.length (stream t) = length t
340 #-}
340 #-}
341
341
342−-- | /O(n)/ 'map' @f @t@ is the 'Text' obtained by applying @f@ to
342+-- | /O(n)/ 'map' @f@ @t@ is the 'Text' obtained by applying @f@ to
343-- each element of @t@. Subject to array fusion.
343-- each element of @t@. Subject to array fusion.
344map :: (Char -> Char) -> Text -> Text
344map :: (Char -> Char) -> Text -> Text
345map f t = unstream (S.map f (stream t))
345map f t = unstream (S.map f (stream t))