MyNixOS website logo
Description

Yet another streaming library.

This is a streaming library focused on simplicity at the cost of some expressivity.

Basic operations like drop and take are supported.

The Functor, Applicative and Monad instances of the stream type resemble those of pure lists. There are also Monoid, Alternative and MonadPlus instances for stream concatenation.

Provides resource-managing operations like withFile that are easily integrated into streams.

For expressive and composable terminal operations, streams can be consumed with folds from the "foldl" library.

jet-stream

This is yet another streaming library for Haskell, created to scratch the following itches:

  • The main type is as simple as possible: the only type parameter is the type of the yielded elements.

  • The Monoid / Alternative / MonadPlus methods perform concatenation, just like with regular lists. The Functor Applicative and Monad instances also resemble those of lists.

  • There are direct analogues of functions like withFile, bracket, finally and onError that easy to integrate in a streaming pipeline, and behave smartly when combined with functions like take.

  • Compatible with the foldl library for collector-like terminal operations. (All self-respecting streaming libraries must have this.)

In order to achieve those objectives, the following sacrifices have been made:

  • No flexibility in the underlying monad for the stream effects: it's always IO.

  • No separate "channels" that return extra information at the end of the stream. This means exceptions are the only way of signalling errors or unexpected conditions.

  • Elements in a stream can't be "extracted" one by one in a pull-based way, like you can do for example in streaming.

  • There's take and drop, but not at proper splitAt. Also, grouping operations are cumbersome and underpowered, especially compared to libraries like streaming or streaming-bytestring.

What about performance?

I haven't run any benchmarks, but you can safely assume that this library will move like a snail compared to streamly's Ferrari.

Some close cousins

  • turtle. The Shell type resembles Jet. One possible difference is that Shell doesn't seem to provide a way for the Shell consumer to signal that no further values are needed, at least judging from the docs for limit.

    "turtle" also inspired the idea of having a separate type for lines.

  • streamly. I might have reinvented a subset of streamly (but worse).

  • Z.IO.BIO from Z-IO. Like Jet, uses a callback-transformation approach.

  • The Stream type from Java is somewhat similar to this library's Jet. (And the foldl library would be the analogue of Collectors.)

Metadata

Version

1.1.0.0

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • 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