Transducers for foldl folds.

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed by Daniel Diaz

What's in this library?

Stateful transducers and streaming-preserving group operations for the folds in Gabriel Gonzalez's foldl package.

When to use this library?

  • When you want to wrap a stateful decoder over a Fold. An example is decoding UTF-8: the decoder must be stateful because a multi-byte character may have been split across two blocks of bytes.

  • When you want to tweak the stream of data that arrives into a Fold, but only at certain positions. Stripping whitespace at the beginning of a text stream, for example.

  • When you want to perform group operations without breaking "streaminess", similar to what pipes-group does.

Why use this library for grouping instead of pipes-group?

Grouping fold-side instead of producer-side has the advantage that, since the results are still Folds, you can combine them using Applicative.

Also, Folds can work with sources other than Producers from pipes.

Grouping fold-side has limitations as well:

  • You can't perform bracketing operations like "withFile" that span the folding of an entire group. pipes-group allows them.

  • You have more flexibility in pipes-group to decide how to delimit and fold the next group based on previous results.

Where can I find working examples for this library?

In the examples folder of the repo.



- Removed upper bounds in dependencies.


- Before, splitters always found at least one group, even for empty streams.
Now, no groups are found for empty streams.
- Made some type signatures a bit more strict.
- Eliminated previously deprecated functions and modules.


- Added "sections" splitter.
- Deprecated Control.Foldl.Transduce.Textual


- Deprecated Control.Foldl.Transduce.ByteString.IO
- Added Control.Foldl.Transduce.ByteString
- Added "paragraphs" splitter.


- added split


- deprecated quiesceWith
- added Fallible.


- deprecated splitWhen in favor of break
- deprecated textualSplitWhen in favor of textualBreak


- Added "trip" fold.
- Added Control.Foldl.Transduce.Textual.


- Added module Control.Foldl.Transduce.ByteString.IO, to
avoid having to depend on other packages for simple I/O tasks.
- Added "unit" fold.


- Changed order of parameters for groups' and groupsM'. Hopefully the new one
is clearer.
- It was annoying to use "evenly (transduce ...)" every time. Added new
ToTransductions' typeclass for types that can be converted to an infinite
list of transductions.
- Added ToFold typeclass as well.


- Transducers can now delimit segments in the done function, too.
This was required for transducers like surround to work as splitters.
- Strengthened the constraints on the surround function to Traversable.
- Added dependency on free and monoid-subclasses.
- group functions can now treat each group differently.
- Added ignore, splitAt, splitWhen, splitLast
- removed drop, take... use splitAt, splitWhen + bisect.
- Added bisect, evenly convenience functions.


- Comonad and Extend instances for Transducer
- Added words splitter
- Added take, drop, takeWhile, dropWhile transducers


- Removed the Spliiter type. Now it's transducers for everything!
- generalizeTransducer -> _generalize
- simplifyTransducer -> _simplify
- removed chokepoint and chokepointM


- Added explicit bifunctors dependency.
- Added Transduce', TransduceM' type synonyms.
- Added groups', groupsM'.


- Changed signatures of transduce' and transduceM'.
- generalize' -> generalizeTransducer
- simplify' -> simplifyTransducer
- dropped direct profunctors dependency.
comments powered byDisqus