on master help sign in
Tidy up haddocks nicely
d36ec83Bryan O'Sullivan
Data/Text.hs+21−19
@@ -139,7 +139,7 @@ module Data.Text
139 -- * Zipping and unzipping
139 -- * Zipping and unzipping
140 , zipWith
140 , zipWith
141
141
142− -- * Ordered text
142+ -- -* Ordered text
143 , -- sort
143 , -- sort
144 ) where
144 ) where
145
145
@@ -399,7 +399,7 @@ reverse t = S.reverse (stream t)
399
399
400-- | /O(n)/ The 'transpose' function transposes the rows and columns
400-- | /O(n)/ The 'transpose' function transposes the rows and columns
401-- of its 'Text' argument. Note that this function uses 'pack',
401-- of its 'Text' argument. Note that this function uses 'pack',
402−-- 'unpack', and the 'List' version of transpose and is thus not very
402+-- 'unpack', and the list version of transpose, and is thus not very
403-- efficient.
403-- efficient.
404transpose :: [Text] -> [Text]
404transpose :: [Text] -> [Text]
405transpose ts = P.map pack (L.transpose (P.map unpack ts))
405transpose ts = P.map pack (L.transpose (P.map unpack ts))
@@ -407,7 +407,7 @@ transpose ts = P.map pack (L.transpose (P.map unpack ts))
407-- -----------------------------------------------------------------------------
407-- -----------------------------------------------------------------------------
408-- * Reducing 'Text's (folds)
408-- * Reducing 'Text's (folds)
409
409
410−-- | 'foldl', applied to a binary operator, a starting value
410+-- | /O(n)/ 'foldl', applied to a binary operator, a starting value
411-- (typically the left-identity of the operator), and a 'Text',
411-- (typically the left-identity of the operator), and a 'Text',
412-- reduces the 'Text' using the binary operator, from left to right.
412-- reduces the 'Text' using the binary operator, from left to right.
413-- Subject to array fusion.
413-- Subject to array fusion.
@@ -415,26 +415,26 @@ foldl :: (b -> Char -> b) -> b -> Text -> b
415foldl f z t = S.foldl f z (stream t)
415foldl f z t = S.foldl f z (stream t)
416{-# INLINE foldl #-}
416{-# INLINE foldl #-}
417
417
418−-- | A strict version of 'foldl'.
418+-- | /O(n)/ A strict version of 'foldl'.
419-- Subject to array fusion.
419-- Subject to array fusion.
420foldl' :: (b -> Char -> b) -> b -> Text -> b
420foldl' :: (b -> Char -> b) -> b -> Text -> b
421foldl' f z t = S.foldl' f z (stream t)
421foldl' f z t = S.foldl' f z (stream t)
422{-# INLINE foldl' #-}
422{-# INLINE foldl' #-}
423
423
424−-- | A variant of 'foldl' that has no starting value argument, and
424+-- | /O(n)/ A variant of 'foldl' that has no starting value argument,
425−-- thus must be applied to a non-empty 'Text'. Subject to array
425+-- and thus must be applied to a non-empty 'Text'. Subject to array
426-- fusion.
426-- fusion.
427foldl1 :: (Char -> Char -> Char) -> Text -> Char
427foldl1 :: (Char -> Char -> Char) -> Text -> Char
428foldl1 f t = S.foldl1 f (stream t)
428foldl1 f t = S.foldl1 f (stream t)
429{-# INLINE foldl1 #-}
429{-# INLINE foldl1 #-}
430
430
431−-- | A strict version of 'foldl1'.
431+-- | /O(n)/ A strict version of 'foldl1'.
432-- Subject to array fusion.
432-- Subject to array fusion.
433foldl1' :: (Char -> Char -> Char) -> Text -> Char
433foldl1' :: (Char -> Char -> Char) -> Text -> Char
434foldl1' f t = S.foldl1' f (stream t)
434foldl1' f t = S.foldl1' f (stream t)
435{-# INLINE foldl1' #-}
435{-# INLINE foldl1' #-}
436
436
437−-- | 'foldr', applied to a binary operator, a starting value
437+-- | /O(n)/ 'foldr', applied to a binary operator, a starting value
438-- (typically the right-identity of the operator), and a 'Text',
438-- (typically the right-identity of the operator), and a 'Text',
439-- reduces the 'Text' using the binary operator, from right to left.
439-- reduces the 'Text' using the binary operator, from right to left.
440-- Subject to array fusion.
440-- Subject to array fusion.
@@ -442,7 +442,7 @@ foldr :: (Char -> b -> b) -> b -> Text -> b
442foldr f z t = S.foldr f z (stream t)
442foldr f z t = S.foldr f z (stream t)
443{-# INLINE foldr #-}
443{-# INLINE foldr #-}
444
444
445−-- | A variant of 'foldr' that has no starting value argument, and
445+-- | /O(n)/ A variant of 'foldr' that has no starting value argument, and
446-- thust must be applied to a non-empty 'Text'. Subject to array
446-- thust must be applied to a non-empty 'Text'. Subject to array
447-- fusion.
447-- fusion.
448foldr1 :: (Char -> Char -> Char) -> Text -> Char
448foldr1 :: (Char -> Char -> Char) -> Text -> Char
@@ -457,23 +457,23 @@ concat :: [Text] -> Text
457concat ts = unstream (S.concat (L.map stream ts))
457concat ts = unstream (S.concat (L.map stream ts))
458{-# INLINE concat #-}
458{-# INLINE concat #-}
459
459
460−-- | Map a function over a 'Text' that results in a 'Text', and concatenate the
460+-- | /O(n)/ Map a function over a 'Text' that results in a 'Text', and
461−-- results. This function is subject to array fusion.
461+-- concatenate the results. This function is subject to array fusion.
462--
462--
463−-- Note: if in 'concatMap' @f @xs, @f@ is defined in terms of fusible
463+-- Note: if in 'concatMap' @f@ @t@, @f@ is defined in terms of fusible
464-- functions, it will also be fusible.
464-- functions, it will also be fusible.
465concatMap :: (Char -> Text) -> Text -> Text
465concatMap :: (Char -> Text) -> Text -> Text
466concatMap f t = unstream (S.concatMap (stream . f) (stream t))
466concatMap f t = unstream (S.concatMap (stream . f) (stream t))
467{-# INLINE concatMap #-}
467{-# INLINE concatMap #-}
468
468
469−-- | 'any' @p @xs determines whether any character in the 'Text' @xs@
469+-- | /O(n)/ 'any' @p@ @t@ determines whether any character in the
470−-- satisifes the predicate @p@. Subject to array fusion.
470+-- 'Text' @t@ satisifes the predicate @p@. Subject to array fusion.
471any :: (Char -> Bool) -> Text -> Bool
471any :: (Char -> Bool) -> Text -> Bool
472any p t = S.any p (stream t)
472any p t = S.any p (stream t)
473{-# INLINE any #-}
473{-# INLINE any #-}
474
474
475−-- | 'all' @p @xs determines whether all characters in the 'Text' @xs@
475+-- | /O(n)/ 'all' @p@ @t@ determines whether all characters in the
476−-- satisify the predicate @p@. Subject to array fusion.
476+-- 'Text' @t@ satisify the predicate @p@. Subject to array fusion.
477all :: (Char -> Bool) -> Text -> Bool
477all :: (Char -> Bool) -> Text -> Bool
478all p t = S.all p (stream t)
478all p t = S.all p (stream t)
479{-# INLINE all #-}
479{-# INLINE all #-}
@@ -553,6 +553,8 @@ mapAccumR f s t = case uncons t of
553-- -----------------------------------------------------------------------------
553-- -----------------------------------------------------------------------------
554-- ** Generating and unfolding 'Text's
554-- ** Generating and unfolding 'Text's
555
555
556+-- | /O(n)/ 'replicate' @n@ @c@ is a 'Text' of length @n@ with @c@ the
557+-- value of every element.
556replicate :: Int -> Char -> Text
558replicate :: Int -> Char -> Text
557replicate n c = unstream (S.replicate n c)
559replicate n c = unstream (S.replicate n c)
558{-# INLINE replicate #-}
560{-# INLINE replicate #-}
@@ -579,7 +581,7 @@ unfoldrN n f s = unstream (S.unfoldrN n f s)
579-- -----------------------------------------------------------------------------
581-- -----------------------------------------------------------------------------
580-- * Substrings
582-- * Substrings
581
583
582−-- /O(n) 'take' @n@, applied to a 'Text', returns the prefix of the
584+-- | /O(n)/ 'take' @n@, applied to a 'Text', returns the prefix of the
583-- 'Text' of length @n@, or the 'Text' itself if @n@ is greater than
585-- 'Text' of length @n@, or the 'Text' itself if @n@ is greater than
584-- the length of the Text.
586-- the length of the Text.
585take :: Int -> Text -> Text
587take :: Int -> Text -> Text
@@ -792,8 +794,8 @@ partition :: (Char -> Bool) -> Text -> (Text, Text)
792partition p t = (filter p t, filter (not . p) t)
794partition p t = (filter p t, filter (not . p) t)
793{-# INLINE partition #-}
795{-# INLINE partition #-}
794
796
795−-- | Break a string on a substring, returning a pair of the part of the
797+-- | /O(n)/ Break a string on a substring, returning a pair of the
796−-- string prior to the match, and the rest of the string.
798+-- part of the string prior to the match, and the rest of the string.
797--
799--
798-- The following relationship holds:
800-- The following relationship holds:
799--
801--