bodil/purescript-signal


Elm style FRP library for PureScript

License: Apache-2.0

Language: PureScript


purescript-signal

Signal is a lightweight FRP-like library heavily inspired by the Elm Signal implementation. Where possible and sensible, it tries to maintain API equivalence with Elm.

See the Elm documentation for details on usage and principles.

PureScript Usage Patterns

PureScript depends on effects (specifically, the Eff monad) to manage side effects, where Elm's runtime generally manages them for you. purescript-signal provides the Signal.runSignal function for running effectful signals.

module Main where

import Control.Monad.Eff.Console
import Control.Monad.Eff
import Prelude
import Signal

hello :: Signal String
hello = constant "Hello Joe!"

helloEffect :: forall eff. Signal (Eff (console :: CONSOLE | eff) Unit)
helloEffect = hello ~> log

main = runSignal helloEffect

This simple example takes a constant signal which contains the string "Hello Joe!" and maps it over the Control.Monad.Eff.Console.log function, which has the type forall eff. String -> Eff (console :: CONSOLE | eff) Unit, thus taking the String content of the signal and turning it into an effect which logs the provided string to the user's console.

This gives us a Signal (Eff (console :: CONSOLE | eff) Unit). We use runSignal to take the signal of effects and run each effect in turn—in our case, just the one effect which prints "Hello Joe!" to the console.

API Documentation

Usage Examples

Project Statistics

Sourcerank 8
Repository Size 111 KB
Stars 204
Forks 39
Watchers 15
Open issues 7
Dependencies 10
Contributors 19
Tags 27
Created
Last updated
Last pushed

Top Contributors See all

Bodil Stokke Bodil Stokke Michael Ficarra menelaos Michael Xavier Phil Freeman Brenton Alker Anthony Quizon Maxim Zimaliev Robert Klotzner Devinsuit Brandon Martin Kaspar Emanuel Madeline Trotter Richard Feldman matthieubulte Honza Pokorny Lars Brünjes David Peter

Packages Referencing this Repo

purescript-signal
Elm style FRP library for PureScript
Latest release v8.1.0 - Published - 204 stars
signal
Elm style FRP library for PureScript
Latest release v8.1.0 - Published - 204 stars

Recent Tags See all

v8.1.0 March 03, 2017
v8.0.1 January 05, 2017
v8.0.0 October 21, 2016
v7.0.0 August 07, 2016
v6.1.0 July 28, 2016
v6.0.0 June 12, 2016
v5.2.0 April 18, 2016
v5.1.0 April 09, 2016
v5.0.1 March 31, 2016
v5.0.0 February 05, 2016
v4.2.0 November 20, 2015
v4.1.1 October 25, 2015
v4.1.0 July 15, 2015
v4.0.0 July 14, 2015
v3.0.0 July 13, 2015

Interesting Forks See all

NickSeagull/ramus
📶 - Elm style FRP library for Haskell
Haskell - Other - Last pushed - 6 stars

Something wrong with this page? Make a suggestion

Last synced: 2016-11-24 13:43:26 UTC

Login to resync this repository