Module Note.S

module S: sig .. end

A signal is a value that varies continuously over time. It has a value at every point in time.


type 'a t = 'a Note.signal 
The type for signals of type 'a.
type 'a set = ?step:Note.Step.t -> 'a -> unit 
The type for functions setting signal values of type 'a. See Note.S.create.
val obs : 'a t -> 'a Note.Logr.obs
obs s is an observation for s.
val log : ?now:bool -> 'a Note.signal -> ('a -> unit) -> Note.Logr.t
log ?now s f is Logr.(create ~now (const f $ obs s)).
val create : ?eq:('a -> 'a -> bool) -> 'a -> 'a Note.signal * 'a set
create v is a primitive signal set to the value v and a set function. The function set is such that:

Warning. set must not be used in the definition of signals or events.

val eq : 'a Note.signal -> 'a -> 'a -> bool
eq s is s's equality function.
val with_eq : ('a -> 'a -> bool) -> 'a Note.signal -> 'a Note.signal
with_eq eq s is s with equality function eq.
val value : 'a Note.signal -> 'a
value s is the current value of s, [s]t
val rough_value : 'a Note.signal -> 'a
rough_value s is the current value of s, but in contrast to Note.S.value it might not be exactly [s]t.
val const : ?eq:('a -> 'a -> bool) -> 'a -> 'a Note.signal
const v is always v, [const v]t = v.
val hold : ?eq:('a -> 'a -> bool) -> 'a -> 'a Note.event -> 'a Note.signal
hold i e has the value of e's last occurrence or the value of i provides the signal value at creation time if there's no event at that time.
val bind : 'a Note.signal -> ('a -> 'b Note.signal) -> 'b Note.signal
bind s f is the signal that results from applying f to s, [bind s f]t = [f[s]t]t.
val join : 'a Note.signal Note.signal -> 'a Note.signal
join ss is bind ss (fun s -> s).
val swap : 'a Note.signal -> 'a Note.signal Note.event -> 'a Note.signal
swap s se is join (hold ~eq:( == ) s se) that is the values of s followed by values of the last signal that occured on se.
val changes : 'a Note.signal -> 'a Note.event
changes s occurs with the value of s whenever it changes.

Warning. By definition no event occurs if s changes at creation time (0 - dt is undefined).

val map : ?eq:('b -> 'b -> bool) -> 'a Note.signal -> ('a -> 'b) -> 'b Note.signal
map s f is s transformed by f, [map s f]t = f [s]t.
val app : ?eq:('b -> 'b -> bool) ->
('a -> 'b) Note.signal -> 'a Note.signal -> 'b Note.signal
app sf s holds the value of sf applied to the value of s, [app sf s]t = [sf]t [s]t.
val sample : 'b Note.signal -> on:'a Note.event -> ('b -> 'a -> 'c) -> 'c Note.event
sample s ~on f samples s at e's occurrences.
val sample_filter : 'b Note.signal ->
on:'a Note.event -> ('b -> 'a -> 'c option) -> 'c Note.event
sample_filter s on f is E.Option.on_some (sample s ~on f).
val snapshot : 'b Note.signal -> on:'a Note.event -> 'b Note.event
snapshot ~on s is sample (fun v _ -> v) ~on s.
val accum : ?eq:('a -> 'a -> bool) -> 'a -> ('a -> 'a) Note.event -> 'a Note.signal
accum i e is hold i (E.accum i e).
val until : ?limit:bool ->
?init:'b -> next:'a Note.event -> 'b Note.signal -> 'b Note.signal
until ~limit ~init ~next s is s until next occurs, after which the value s had just before (limit is false, default) or whenever next occurs (limit is true) is kept forever. init defaults to value s.
val delay : 'a -> 'a Note.signal Lazy.t -> 'a Note.signal
delay i (lazy s) is the value s had an infinitesimal amount of time before:
val fix : 'a -> ('a Note.signal -> 'a Note.signal * 'b) -> 'b
In fix sf, sf is called with a signal s that represents

the signal returned by sf delayed by an infinitesimal amount time. If s', r = sf s then r is returned by fix and s is such that :


Lifting combinators. For a given n the semantics is : [ln f a1 ... an]t = f [a1]t ... [an]t
val l1 : ?eq:('b -> 'b -> bool) -> ('a -> 'b) -> 'a Note.signal -> 'b Note.signal
val l2 : ?eq:('c -> 'c -> bool) ->
('a -> 'b -> 'c) -> 'a Note.signal -> 'b Note.signal -> 'c Note.signal
val l3 : ?eq:('d -> 'd -> bool) ->
('a -> 'b -> 'c -> 'd) ->
'a Note.signal -> 'b Note.signal -> 'c Note.signal -> 'd Note.signal

Stdlib types support

module Bool: sig .. end
Boolean signals
module Option: sig .. end
Option signals
module Pair: sig .. end
Pair signals.