euphoria

Dynamic network FRP with events and continuous values http://github.com/tsurucapital/euphoria

LTS Haskell 8.12:0.8.0.0
Stackage Nightly 2017-04-28:0.8.0.0
Latest on Hackage:0.8.0.0
PublicDomain licensed by Takano Akio, Andrew Richards, Liyang HU

Euphoria is FRP with practicality.

FRP is a good way to model computations which need run for an extended period of time, react to incoming events, and continually produce output. Simulations, games, and GUIs are all good candidates for FRP.

In Euphoria, networks (dataflow graphs) are dynamic. Networks are first-class values which can be passed around inside of other networks, and they can be connected together at any time. This flexibility allows complicated, real-world problems to be modeled with FRP.

Though Euphoria is flexible and high-level, it makes some concessions for performance and the underlying implementation.

Euphoria works in discrete steps. You will construct the body of your program as an FRP network. To get results, you must perform an IO action to step the network. After stepping, your network will have produced some result, such as a string, which you can print to the screen. A network can also produce IO actions as an output. Step the network as many times as necessary to continue running your program.

A simulation, game, or GUI will probably loop while stepping until the user terminates the program.

Euphoria is mostly concerned with three types: Signal, Event, and Discrete.

Signal represents a continuous value that changes with each step of the network. Discrete is like Signal, but it is possible to determine if its value has not changed, and avoid unnecessary computation. As long as a Signal or Discrete exists, it will contain a value. Event represents something that exists for only one moment in time, such as a packet received over a socket, or a mouse click.

Signals and Discretes are instances of Monad and Applicative. Events are instances of Monoid.

SignalGen is the outer monad, where networks are constructed. SignalGen is an instance of Monad and Applicative. SignalGens inside of Signals, Discretes, or Events can be used to attach new networks to the existing network on the fly.

Signals, Discretes and Events may contain other Signals, Discretes or Events. Euphoria encourages the use of dynamic network construction using these higher-order FRP types, and they can be attached or detached from the network with ease. Euphoria relies on garbage collection and weak pointers to prune the network when parts of it are no longer needed.

Euphoria is built on top of the Elerea library by Patai Gergely.

comments powered byDisqus