foldl-transduce

Transducers for foldl folds.

Latest on Hackage:0.5.2.0

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 stackage.org 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.

Changes

# 0.5.1.0

- Removed upper bounds in dependencies.

# 0.5.0.0

- 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.

# 0.4.7.0

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

# 0.4.6.0

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

# 0.4.5.0

- added split

# 0.4.4.0

- deprecated quiesceWith
- added Fallible.

# 0.4.3.0

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

# 0.4.2.0

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

# 0.4.1.0

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

# 0.4.0.0

- 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.

# 0.3.0.0

- 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.

# 0.2.1.0

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

# 0.2.0.0

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


# 0.1.2.0

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


# 0.1.1.0

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