machinecell: Arrow based stream transducers

[ bsd3, control, frp, library, reactivity ] [ Propose Tags ]

Stream processing library similar to pipes, couduit, or machines.

Arrow combinatins are supported and can be used with the arrow notation. AFRP-like utilities are also available.

A quick introduction is available in the Control.Arrow.Machine documentation.

[Skip to Readme]


Manual Flags


Arrow transformer support.

A few environments(stackage, haste, etc) don't support this package.


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS] 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.3.0, 1.3.1, 2.0.0, 2.0.1, 2.1.0, 3.0.0, 3.0.1, 3.1.0, 3.2.0, 3.3.0, 3.3.1, 3.3.2, 4.0.0, 4.0.1
Change log
Dependencies base (>=4.8 && <5.0), free (>=4.12.3 && <5.1), mtl (>=2.2.1 && <3), profunctors (>=5.2 && <6), semigroups (>=0.18.1 && <1), transformers (>= && <1) [details]
License BSD-3-Clause
Copyright Copyright (c) 2014 Hidenori Azuma
Author Hidenori Azuma
Maintainer Hidenori Azuma <>
Category Control, FRP, Reactivity
Home page
Bug tracker
Source repo head: git clone -b master
this: git clone release-4.0.1)
Uploaded by HidenoriAzuma at 2018-04-17T16:35:11Z
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 12963 total (41 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-04-17 [all 1 reports]

Readme for machinecell-4.0.1

[back to package description]


Arrow based stream transducer.


As other iteratee or pipe libraries, machinecell abstracts general iteration processes.

Here is an example that is a simple iteration over a list.

>>> run (evMap (+1)) [1, 2, 3]
[2, 3, 4]

In above statement, "evMap (+1)" has a type "ProcessA (->) (Event Int) (Event Int)", which denotes "A stream transducer that takes a series of Int as input, gives a series of Int as output, run on base arrow (->)."

In addition to this simple iteration, machinecell has following features.

  • Side effects
  • Composite pipelines
  • Arrow compositions
  • Behaviours and switches

See Control.Arrow.Machine documentation.

Comparison to other libraries.

Some part of machinecell is similar to other stream transducer libraries, namely pipes, conduit, or machines. machinecell can be seen as a restricted variation of them to one-directional. But additionally, machinecell supports arrow compositions. Bidirectional communications can be taken place by ArrowLoop feature.

Rather, there are several other arrowised stream transducer libraries. streamproc shares the most concept to machinecell. But actually it has a problem described later in this post. Machinecell can be said as "Streamproc done right."

auto is a brand-new arrowised stream transducer library. Compared to it, machinecell's advantage is await/yield coroutines, while auto's one is serialization.

Motivation and background

"Generalizing monads to arrows," The original paper of arrow calculation mentions a kind of stream transducer, which later implemented as streamproc.

And other people propose instance declarations of Arrow class for several existing stream processors.

But actually, there is a problem argued in this post.

The core problem is, while arrow uses tuples as parallel data stream, they cannot represent a composite streams if they carry different numbers of data in parallel.

To solve this problem, some arrow libraries restrict transducers to one-to-one data transformation. Yampa and netwire does so, as mentioned in above post. And auto also takes this approach.

Machinecell's approach is different, but simple too. The key idea is wrapping all types of data stream into a maybe-like type. Then even tuples can represent different numbers of data, by inserting appropreate number of 'Nothing's.

Furthermore, I identified the maybe-like type as the 'Event' type, which appears in Yampa and netwire. Then I successively implemented several arrows of Yampa and netwire.

API names come from stream libraries are named after machines', while ones from FRPs are after Yampa's. Now, machinecell may be seen as a hybrid of machines and Yampa.