Popularity
4.6
Declining
Activity
0.0
Stable
13
1
0

Monthly Downloads: 29
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Control    
Latest version: v0.1.5

observable alternatives and similar packages

Based on the "Control" category.
Alternatively, view observable alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of observable or a related project?

Add another 'Control' Package

README

Make your actions to be observable and listen events from them, algebraically.

Let's imagine simple example: we want to listen to STDIN. We have getLine function that can capture a list of ASCII-symbols - all we need is to make this action to be observable.

obs :: Monad f => f a -> Observable f a r

Good, now we want to subscribe on events and set up callback, if we want to listen events forever, we need subscribe function:

subscribe :: Applicative f => Observable f a r -> (a -> f r) -> f r

First, we make action to be observable, then set up callback and at the end, subscribe on events:

subscribe (obs getLine) handler

Our handler will count amount of characters in strings and send this into STDOUT:

handler = print . (<>) "Length of string was: " . show . length

Let's try it out:

> hello, my dear friend!
> "Length of string was: 22"