MyNixOS website logo
Description

Translate pull-based stream folds into push-based iteratees.

Translate pull-based folds from the "streaming" package into push-based folds from the "foldl" package.

What's in this library?

Functions that turn pull-based stream operations from the pipes/streaming ecosystem into push-based, iteratee-like stream operations.

Inspired by the blog post Programmatic translation to iteratees from pull-based code.

Could you go into more detail?

There are three streaming libraries that often go together: pipes, streaming, and foldl.

Of these, the first two are pull-based: you take some (possibly effectful) source of values and keep extracting stuff until the source is exhausted and/or you have obtained all the info you need.

Meanwhile, foldl is push-based: foldl folds are not directly aware of any source, they are like little state machines that keep running as long as someone feeds them input.

Usually, defining stream transformations in pull-based mode is easier and feels more natural. The pipes ecosystem already provides a lot of them: parsers, decoders, splitters.

However, push-based mode also has advantages. Push-based abstractions are not tied to a particular type of source because data is fed externally. And foldl folds have very useful Applicative and Comonad instances.

Also, sometimes a library will only offer a push-based interface.

Wouldn't it be nice if you could adapt already existing pull-based operations to work on push-based consumers? For example, using a decoding function from Pipes.Text.Encoding to preprocess the inputs of a Fold.

This library provides that.

Metadata

Version

0.4.0.0

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows