react

Declarative events and signals for OCaml
Library react
Module React . S . Bool
val zero : bool signal
val one : bool signal
val not : bool signal -> bool signal
val (&&) : bool signal -> bool signal -> bool signal
val (||) : bool signal -> bool signal -> bool signal
val edge : bool signal -> bool event

edge s is changes s.

val rise : bool signal -> unit event

rise s is E.fmap (fun b -> if b then Some () else None) (edge s).

val fall : bool signal -> unit event

fall s is E.fmap (fun b -> if b then None else Some ()) (edge s).

val flip : bool -> 'a event -> bool signal

flip b e is a signal whose boolean value flips each time e occurs. b is the initial signal value.

  • [flip b e]0 = not b if [e]0 = Some _
  • [flip b e]t = b if [e]<=t = None
  • [flip b e]t = not [flip b e]t-dt if [e]t = Some _