on master help sign in
Note more functions subject to fusion.
ef61b49Bryan O'Sullivan
Data/Text.hs+7−5
@@ -537,7 +537,7 @@ mapAccumR f s t = case uncons t of
537-- ** Generating and unfolding 'Text's
537-- ** Generating and unfolding 'Text's
538
538
539-- | /O(n)/ 'replicate' @n@ @c@ is a 'Text' of length @n@ with @c@ the
539-- | /O(n)/ 'replicate' @n@ @c@ is a 'Text' of length @n@ with @c@ the
540−-- value of every element.
540+-- value of every element. Subject to fusion.
541replicate :: Int -> Char -> Text
541replicate :: Int -> Char -> Text
542replicate n c = unstream (S.replicate n c)
542replicate n c = unstream (S.replicate n c)
543{-# INLINE replicate #-}
543{-# INLINE replicate #-}
@@ -547,7 +547,8 @@ replicate n c = unstream (S.replicate n c)
547-- 'Text' from a seed value. The function takes the element and
547-- 'Text' from a seed value. The function takes the element and
548-- returns 'Nothing' if it is done producing the 'Text', otherwise
548-- returns 'Nothing' if it is done producing the 'Text', otherwise
549-- 'Just' @(a,b)@. In this case, @a@ is the next 'Char' in the
549-- 'Just' @(a,b)@. In this case, @a@ is the next 'Char' in the
550−-- string, and @b@ is the seed value for further production.
550+-- string, and @b@ is the seed value for further production. Subject
551+-- to fusion.
551unfoldr :: (a -> Maybe (Char,a)) -> a -> Text
552unfoldr :: (a -> Maybe (Char,a)) -> a -> Text
552unfoldr f s = unstream (S.unfoldr f s)
553unfoldr f s = unstream (S.unfoldr f s)
553{-# INLINE unfoldr #-}
554{-# INLINE unfoldr #-}
@@ -556,7 +557,8 @@ unfoldr f s = unstream (S.unfoldr f s)
556-- value. However, the length of the result should be limited by the
557-- value. However, the length of the result should be limited by the
557-- first argument to 'unfoldrN'. This function is more efficient than
558-- first argument to 'unfoldrN'. This function is more efficient than
558-- 'unfoldr' when the maximum length of the result is known and
559-- 'unfoldr' when the maximum length of the result is known and
559−-- correct, otherwise its performance is similar to 'unfoldr'.
560+-- correct, otherwise its performance is similar to 'unfoldr'. Subject
561+-- to fusion.
560unfoldrN :: Int -> (a -> Maybe (Char,a)) -> a -> Text
562unfoldrN :: Int -> (a -> Maybe (Char,a)) -> a -> Text
561unfoldrN n f s = unstream (S.unfoldrN n f s)
563unfoldrN n f s = unstream (S.unfoldrN n f s)
562{-# INLINE unfoldrN #-}
564{-# INLINE unfoldrN #-}
@@ -566,7 +568,7 @@ unfoldrN n f s = unstream (S.unfoldrN n f s)
566
568
567-- | /O(n)/ 'take' @n@, applied to a 'Text', returns the prefix of the
569-- | /O(n)/ 'take' @n@, applied to a 'Text', returns the prefix of the
568-- 'Text' of length @n@, or the 'Text' itself if @n@ is greater than
570-- 'Text' of length @n@, or the 'Text' itself if @n@ is greater than
569−-- the length of the Text.
571+-- the length of the Text. Subject to fusion.
570take :: Int -> Text -> Text
572take :: Int -> Text -> Text
571take n t@(Text arr off len)
573take n t@(Text arr off len)
572 | n <= 0 = empty
574 | n <= 0 = empty
@@ -588,7 +590,7 @@ take n t@(Text arr off len)
588
590
589-- | /O(n)/ 'drop' @n@, applied to a 'Text', returns the suffix of the
591-- | /O(n)/ 'drop' @n@, applied to a 'Text', returns the suffix of the
590-- 'Text' of length @n@, or the empty 'Text' if @n@ is greater than the
592-- 'Text' of length @n@, or the empty 'Text' if @n@ is greater than the
591−-- length of the 'Text'.
593+-- length of the 'Text'. Subject to fusion.
592drop :: Int -> Text -> Text
594drop :: Int -> Text -> Text
593drop n t@(Text arr off len)
595drop n t@(Text arr off len)
594 | n <= 0 = t
596 | n <= 0 = t