A minimalistic FRP library

Version on this page:2.9.0
LTS Haskell 13.21:2.9.0
Stackage Nightly 2019-05-18:2.9.0
Latest on Hackage:2.9.0

See all snapshots elerea appears in

BSD-3-Clause licensed by Patai Gergely
Maintained by Patai Gergely (patai.gergely@gmail.com)

Module documentation for 2.9.0

Elerea (Eventless reactivity) is a tiny discrete time FRP implementation without the notion of event-based switching and sampling, with first-class signals (time-varying values). Reactivity is provided through various higher-order constructs that also allow the user to work with arbitrary time-varying structures containing live signals. Signals have precise and simple denotational semantics.

Stateful signals can be safely generated at any time through a monadic interface, while stateless combinators can be used in a purely applicative style. Elerea signals can be defined recursively, and external input is trivial to attach. The library comes in two major variants:

  • Simple: signals are plain discrete streams isomorphic to functions over natural numbers;

  • Param: adds a globally accessible input signal for convenience;

This is a minimal library that defines only some basic primitives, and you are advised to install elerea-examples as well to get an idea how to build non-trivial systems with it. The examples are separated in order to minimise the dependencies of the core library. The dow package contains a full game built on top of the simple variant.

The basic idea of the implementation is described in the WFLP 2010 paper Efficient and Compositional Higher-Order Streams (http://sgate.emt.bme.hu/documents/patai/publications/PataiWFLP2010.pdf).

Additional contributions: Takano Akio, Mitsutoshi Aoe


2.9.0 - 160618
* removed clocked variant, as it proved to be impractical
* renamed external to unsafeExternal
* introduced safe (managed) external signals
* renamed until to till to avoid name clash with the prelude

2.8.0 - 140122
* added MonadIO and MonadBase instances for SignalGen (Mitsutoshi Aoe) - 120401
* added some inlining annotations (courtesy of Takano Akio) - 120131
* made externalMulti thread-safe (courtesy of Takano Akio)

2.7.0 - 111223
* fixed an issue with nested signal creations not updating properly
(courtesy of Takano Akio)
* added reference implementation for the simple variant

2.6.0 - 111211
* added snapshot to all variants, which allows sampling signals within
signal generators

2.5.0 - 111122
* added SignalGen liftIO equivalent to assist library writers
* simplified the signatures of effectful* combinators
* updated Param to use the more modern codebase (like Simple and
Clocked); this was necessary to support effectful signals
* temporarily removed the static optimisation from Param
* removed dependency on mersenne-random
* removed legacy branch

2.4.0 - 111111
* added effectful signals to assist library writers

2.3.0 - 110627
* reimplemented clocked variant in a correct and more efficient way

2.2.0 - 110402
* added n-ary transfer functions
* temporarily removed transfer from the clocked variant
* revised documentation

2.1.0 - 100805
* reimplemented the parametric variant in a way that doesn't require
signals to carry the type of the parameter any more
* added the ability to extract the global input in the parametric
variant, and also to override it (input and embed, resp.)
* added until to be able to define switchers that can truly drop
references to old signals
* added debug printing capability to the simple and clocked variants
* made a note about possibly deprecating the delayed variant

2.0.0 - 100718
* moved experimental branch to the top (version 1 went into legacy
* added the clocked variant

1.2.3 - 100131
* added externalMulti to handle events that can fire several times
within a superstep
* added a cache to the noise signal for safety reasons, so it lives in
SignalGen now

1.2.2 - 100115
* added noise signals and the getRandom primitive (using mersenne-random)

1.2.1 - 091204
* modified the &&@ and ||@ operators to short-circuit

1.2.0 - 091202
* added the delayed variant to the experimental branch
* renamed storeJust to (-->) in the experimental branch

1.1.0 - 091126
* added experimental branch with a cleaner semantics

1.0.0 - 090726
* completely renewed interface by introducing the SignalMonad

0.6.0 - 090507
* renamed Void to StartToken
* replaced restarter with the simpler and more versatile startTokens

0.5.0 - 090502
* changed names of internal constructors to match primitives better
* added restarter and (==>)
* removed the unused type synonym Time

0.4.0 - 090501
* added keepAlive
* made delay a primitive
* completely separated sampling and aging

0.3.0 - 090419
* documentation bug fixed: the latcher is not delayed
* added dot (Graphviz) converter

0.2.0 - 090412
* removed primitives time and stateless
* removed default delay on stateful combinators and added experimental
cycle detection
* added some non-primitive combinators: delay, edge, comparisons,
logic relations
* added signal instances for various numeric classes

0.1.0 - 090410
* first public version
comments powered byDisqus