Skip to content

Commit 34ec9e2

Browse files
committed
Lazy unfoldr and unfoldrN are subject to fusion
1 parent 3db5817 commit 34ec9e2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Data/Text/Lazy.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,8 +1041,9 @@ replicateChar n c = unstream (S.replicateCharI n (safe c))
10411041
-- 'Text' from a seed value. The function takes the element and
10421042
-- returns 'Nothing' if it is done producing the 'Text', otherwise
10431043
-- 'Just' @(a,b)@. In this case, @a@ is the next 'Char' in the
1044-
-- string, and @b@ is the seed value for further production. Performs
1045-
-- replacement on invalid scalar values.
1044+
-- string, and @b@ is the seed value for further production.
1045+
-- Subject to fusion.
1046+
-- Performs replacement on invalid scalar values.
10461047
unfoldr :: (a -> Maybe (Char,a)) -> a -> Text
10471048
unfoldr f s = unstream (S.unfoldr (firstf safe . f) s)
10481049
{-# INLINE unfoldr #-}
@@ -1052,6 +1053,7 @@ unfoldr f s = unstream (S.unfoldr (firstf safe . f) s)
10521053
-- first argument to 'unfoldrN'. This function is more efficient than
10531054
-- 'unfoldr' when the maximum length of the result is known and
10541055
-- correct, otherwise its performance is similar to 'unfoldr'.
1056+
-- Subject to fusion.
10551057
-- Performs replacement on invalid scalar values.
10561058
unfoldrN :: Int64 -> (a -> Maybe (Char,a)) -> a -> Text
10571059
unfoldrN n f s = unstream (S.unfoldrN n (firstf safe . f) s)

0 commit comments

Comments
 (0)