jet-stream: Yet another streaming library.

[ bsd3, library, streaming ] [ Propose Tags ]

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.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0.0
Change log CHANGELOG.md
Dependencies async (>=2.2.3 && <2.3), base (>=4.11.0.0 && <5), bytestring (>=0.10), conceit (>=0.5.0.0 && <0.6), process (>=1.4.3.0), stm (>=2.4), stm-chans (>=3.0.0.0 && <3.1), text (>=1.2) [details]
License BSD-3-Clause
Author Daniel Diaz Carrete
Maintainer diaz_carrete@yahoo.com
Category Streaming
Source repo head: git clone https://github.com/danidiaz/jet-stream.git
Uploaded by DanielDiazCarrete at 2021-08-10T10:58:45Z
Distributions
Downloads 140 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user [build log]
All reported builds failed as of 2021-08-10 [all 2 reports]

Readme for jet-stream-1.0.0.0

[back to package description]

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