···
3
+
/* -- source factories */
5
+
/* Accepts a list and creates a pullable source for that list.
6
+
The source will emit events when being pulled until the list
7
+
is exhausted and it completes */
let fromList: (list('a), signalT('a) => unit) => unit;
10
+
/* Accepts an array and creates a pullable source for that array.
11
+
The source will emit events when being pulled until the array
12
+
is exhausted and it completes */
let fromArray: (array('a), signalT('a) => unit) => unit;
6
-
let map: ('a => 'b, (signalT('a) => unit) => unit, signalT('b) => unit) => unit;
7
-
let filter: ('a => bool, (signalT('a) => unit) => unit, signalT('a) => unit) => unit;
8
-
let scan: (('b, 'a) => 'b, 'b, (signalT('a) => unit) => unit, signalT('b) => unit) => unit;
17
+
/* Takes a mapping function from one type to another, and a source,
18
+
and creates a sink & source.
19
+
All values that it receives will be transformed using the mapping
20
+
function and emitted on the new source */
22
+
('a => 'b, (signalT('a) => unit) => unit, signalT('b) => unit) => unit;
24
+
/* Takes a predicate function returning a boolean, and a source,
25
+
and creates a sink & source.
26
+
All values that it receives will be filtered using the predicate,
27
+
and only truthy values will be passed on to the new source.
28
+
The sink will attempt to pull a new value when one was filtered. */
30
+
('a => bool, (signalT('a) => unit) => unit, signalT('a) => unit) => unit;
32
+
/* Takes a reducer function, a seed value, and a source, and creates
34
+
The last returned value from the reducer function (or the seed value
35
+
initially) will be passed to the reducer together with the value
36
+
that the sink receives. All return values of the reducer function
37
+
are emitted on the new source. */
39
+
(('b, 'a) => 'b, 'b, (signalT('a) => unit) => unit, signalT('b) => unit) =>
42
+
/* Takes an array of sources and creates a sink & source.
43
+
All values that the sink receives from all sources will be passed through
44
+
to the new source */
let merge: (array((signalT('a) => unit) => unit), signalT('a) => unit) => unit;
47
+
/* Takes a listenable or a pullable source and creates a new source that
48
+
will ensure that the source is shared between all sinks that follow.
49
+
Essentially the original source will only be created once. */
let share: ((signalT('a) => unit) => unit, signalT('a) => unit) => unit;
11
-
let combine: ((signalT('a) => unit) => unit, (signalT('b) => unit) => unit, signalT(('a, 'b)) => unit) => unit;
52
+
/* Takes two sources and creates a new source & sink.
53
+
All latest values from both sources will be passed through as a
54
+
tuple of the last values that have been observed */
57
+
(signalT('a) => unit) => unit,
58
+
(signalT('b) => unit) => unit,
59
+
signalT(('a, 'b)) => unit
63
+
/* -- sink factories */
65
+
/* Takes a function and a source, and creates a sink.
66
+
The function will be called for each value that the sink receives.
67
+
The sink will attempt to pull new values as values come in, until
let forEach: ('a => unit, (signalT('a) => unit) => unit) => unit;
14
-
let subscribe: ('a => unit, (signalT('a) => unit) => unit) => (unit => unit);
71
+
/* Similar to the `forEach` sink factory, but returns an anonymous function
72
+
that when called will end the stream immediately.
73
+
Ending the stream will propagate an End signal upwards to the root source. */
74
+
let subscribe: ('a => unit, (signalT('a) => unit) => unit, unit) => unit;