git.iko.soy/purescript-stream
on master help sign in
28 lines 732 B history raw
1# Purescript Stream
3> An ultra-fast reactive stream library for purescript
5## Let me have it
6```sh
7bower install --save purescript-stream
8```
10## Basic usage
11```purescript
12module Main where
14import Prelude
15import Control.Monad.Eff (Eff)
16import Control.Monad.Eff.Console (CONSOLE, logShow, log)
17import Control.Stream (STREAM, periodic, constant, scan, tapEvent, tapEnd, drain)
18import Data.Unit (Unit)
20main :: Eff (stream :: STREAM, console :: CONSOLE) Unit
21main = do
22 periodic 1000.0 -- Stream Unit
23 # constant 1 -- Stream Int
24 # scan (+) 0 -- Stream Int
25 # tapEvent logShow -- Perform side-effects on events
26 # tapEnd (log "done") -- Perform a side-effect on stream completion
27 # drain -- activate your stream
28```