haskell / text

Haskell library for space- and time-efficient operations over Unicode text.

Home Page:http://hackage.haskell.org/package/text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't use streams and fusion

oberblastmeister opened this issue · comments

The documentation states

Starting from @text-1.3@ fusion is no longer implicit

However, many functions still use Stream internally, even thought they would probably run a lot faster without it. It is much more efficient to work on the underlying bytes instead of decoding and encoding to and from UTF-32 through Stream. Some functions that use Stream include cons, snoc, and isPrefix.

I'm in favor. See also #510 (comment) for non-streaming folds.

I think folds should still use Stream, the issue there is that foldl should be defined as

foldl = S.foldr (flip f) z . reverseStream