Hareactive is a practical, powerful, and simple FRP library.
- Implements classic FRP with behaviors and streams.
- Supports continuous time and integration.
- Higher-order monadic behaviors.
- Efficient push and pull implementation.
- Simple precise semantics.
- Supports circular dependencies i.e. recursively defined behaviors.
- Easy integration with both
- Suitable for building UI (see also purescript-turbine).
A simple example which show how to create a counter with FRP and demonstrates how to integrate Hareactive with the DOM. Source code.
Hareactive implements classic FRP. This means that it makes a distinction between behaviors and streams (what Hareactive calls streams is often called event). As for why that distinction is useful see the blogpost Behaviors and streams, why both?.
Behaviors in Hareactive are monads. Monadic behaviors are essential for many practical purposes. Behaviors in Hareactive can be continuous, i.e. change infinetly often. Among other things this means that Hareactive support continous time and integration.
Hareactive supports stateful behaviors (i.e. behaviors that depends on the past). It does so while avoiding the problems with space and time leaks that FRP are notorius for.
A key focus is to implement a simple precise semantic model following in the spirit of Conal Elliott. The semantics serve as a specification for determining the correctness of the implementation. Additionally, it is a mental model which can be used to reason about the library.
Hareactive is implemented in carefully optimized TypeScript.
npm i @funkia/hareactive bower install --save purescript-hareactive
Module documentation is published on Pursuit.