The machinecell package

[Tags:bsd3, library, test]

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]


Versions 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
Change log
Dependencies base (>= && <5.0), free (>=4.12 && <5.0), mtl (>=2.2 && <3.0), profunctors (>=4.0.4 && <6.0), semigroups (>= && <1.0), transformers (>=0.4 && <0.6) [details]
License BSD3
Copyright Copyright (c) 2014 Hidenori Azuma
Author Hidenori Azuma
Maintainer Hidenori Azuma <>
Category Control, FRP, Reactivity
Home page
Bug tracker
Source repository head: git clone -b master
this: git clone release-3.3.2)
Uploaded Wed Mar 8 13:58:49 UTC 2017 by HidenoriAzuma
Distributions NixOS:3.3.2
Downloads 1989 total (41 in the last 30 days)
0 []
Status Docs available [build log]
Last success reported on 2017-03-08 [all 1 reports]
Hackage Matrix CI





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

For package maintainers and hackage trustees

Readme for machinecell

Readme for machinecell-3.3.2


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.