Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wonka

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wonka - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

src/index.d.ts

495

lib/js/src/web/wonkaJs.js

@@ -6,20 +6,24 @@ 'use strict';

var Caml_option = require("bs-platform/lib/js/caml_option.js");
var Wonka_types = require("../wonka_types.js");
var Wonka_helpers = require("../wonka_helpers.js");
function fromListener(addListener, removeListener, sink) {
var handler = function ($$event) {
return sink(/* Push */Block.__(1, [$$event]));
};
sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
return Curry._1(removeListener, handler);
} else {
return /* () */0;
}
})]));
return Curry._1(addListener, handler);
function fromListener(addListener, removeListener) {
return Wonka_types.curry((function (sink) {
var handler = function ($$event) {
return sink(/* Push */Block.__(1, [$$event]));
};
sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
return Curry._1(removeListener, handler);
} else {
return /* () */0;
}
})]));
return Curry._1(addListener, handler);
}));
}
function fromDomEvent(element, $$event, sink) {
var addEventListener = (
function fromDomEvent(element, $$event) {
return Wonka_types.curry((function (sink) {
var addEventListener = (
function (element, event, handler) {

@@ -29,3 +33,3 @@ element.addEventListener(event, handler);

);
var removeEventListener = (
var removeEventListener = (
function (element, event, handler) {

@@ -35,236 +39,257 @@ element.removeEventListener(event, handler);

);
return fromListener((function (handler) {
return Curry._3(addEventListener, element, $$event, handler);
}), (function (handler) {
return Curry._3(removeEventListener, element, $$event, handler);
}), sink);
return Curry._1(fromListener((function (handler) {
return Curry._3(addEventListener, element, $$event, handler);
}), (function (handler) {
return Curry._3(removeEventListener, element, $$event, handler);
})), sink);
}));
}
function interval(p, sink) {
var i = /* record */[/* contents */0];
var id = setInterval((function (param) {
var num = i[0];
i[0] = i[0] + 1 | 0;
return sink(/* Push */Block.__(1, [num]));
}), p);
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
clearInterval(id);
return /* () */0;
} else {
return /* () */0;
}
})]));
function interval(p) {
return Wonka_types.curry((function (sink) {
var i = /* record */[/* contents */0];
var id = setInterval((function (param) {
var num = i[0];
i[0] = i[0] + 1 | 0;
return sink(/* Push */Block.__(1, [num]));
}), p);
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
clearInterval(id);
return /* () */0;
} else {
return /* () */0;
}
})]));
}));
}
function fromPromise(promise, sink) {
var ended = /* record */[/* contents */false];
promise.then((function (value) {
if (!ended[0]) {
sink(/* Push */Block.__(1, [value]));
sink(/* End */0);
}
return Promise.resolve(/* () */0);
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
ended[0] = true;
return /* () */0;
} else {
return /* () */0;
}
})]));
function fromPromise(promise) {
return Wonka_types.curry((function (sink) {
var ended = /* record */[/* contents */false];
promise.then((function (value) {
if (!ended[0]) {
sink(/* Push */Block.__(1, [value]));
sink(/* End */0);
}
return Promise.resolve(/* () */0);
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
ended[0] = true;
return /* () */0;
} else {
return /* () */0;
}
})]));
}));
}
function debounce(debounceF, source, sink) {
var gotEndSignal = /* record */[/* contents */false];
var id = /* record */[/* contents */undefined];
var $$clearTimeout$1 = function (param) {
var match = id[0];
if (match !== undefined) {
id[0] = undefined;
clearTimeout(Caml_option.valFromOption(match));
return /* () */0;
} else {
return /* () */0;
}
};
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
gotEndSignal[0] = true;
var match = id[0];
if (match !== undefined) {
return /* () */0;
} else {
return sink(/* End */0);
}
} else if (signal.tag) {
$$clearTimeout$1(/* () */0);
id[0] = Caml_option.some(setTimeout((function (param) {
id[0] = undefined;
sink(signal);
if (gotEndSignal[0]) {
return sink(/* End */0);
} else {
return 0;
}
}), Curry._1(debounceF, signal[0])));
return /* () */0;
} else {
var tb = signal[0];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
$$clearTimeout$1(/* () */0);
return tb(/* Close */1);
} else {
return tb(signal);
}
})]));
}
function debounce(debounceF) {
return Wonka_types.curry((function (source) {
return Wonka_types.curry((function (sink) {
var gotEndSignal = /* record */[/* contents */false];
var id = /* record */[/* contents */undefined];
var $$clearTimeout$1 = function (param) {
var match = id[0];
if (match !== undefined) {
id[0] = undefined;
clearTimeout(Caml_option.valFromOption(match));
return /* () */0;
} else {
return /* () */0;
}
};
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
gotEndSignal[0] = true;
var match = id[0];
if (match !== undefined) {
return /* () */0;
} else {
return sink(/* End */0);
}
} else if (signal.tag) {
$$clearTimeout$1(/* () */0);
id[0] = Caml_option.some(setTimeout((function (param) {
id[0] = undefined;
sink(signal);
if (gotEndSignal[0]) {
return sink(/* End */0);
} else {
return 0;
}
}), Curry._1(debounceF, signal[0])));
return /* () */0;
} else {
var tb = signal[0];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
$$clearTimeout$1(/* () */0);
return tb(/* Close */1);
} else {
return tb(signal);
}
})]));
}
}));
}));
}));
}
function throttle(throttleF, source, sink) {
var skip = /* record */[/* contents */false];
var id = /* record */[/* contents */undefined];
var $$clearTimeout$1 = function (param) {
var match = id[0];
if (match !== undefined) {
clearTimeout(Caml_option.valFromOption(match));
return /* () */0;
} else {
return /* () */0;
}
};
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
$$clearTimeout$1(/* () */0);
return sink(/* End */0);
} else if (signal.tag) {
if (skip[0]) {
return /* () */0;
} else {
skip[0] = true;
$$clearTimeout$1(/* () */0);
id[0] = Caml_option.some(setTimeout((function (param) {
id[0] = undefined;
skip[0] = false;
return /* () */0;
}), Curry._1(throttleF, signal[0])));
return sink(signal);
}
} else {
var tb = signal[0];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
$$clearTimeout$1(/* () */0);
return tb(/* Close */1);
} else {
return tb(signal);
}
})]));
}
function throttle(throttleF) {
return Wonka_types.curry((function (source) {
return Wonka_types.curry((function (sink) {
var skip = /* record */[/* contents */false];
var id = /* record */[/* contents */undefined];
var $$clearTimeout$1 = function (param) {
var match = id[0];
if (match !== undefined) {
clearTimeout(Caml_option.valFromOption(match));
return /* () */0;
} else {
return /* () */0;
}
};
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
$$clearTimeout$1(/* () */0);
return sink(/* End */0);
} else if (signal.tag) {
if (skip[0]) {
return /* () */0;
} else {
skip[0] = true;
$$clearTimeout$1(/* () */0);
id[0] = Caml_option.some(setTimeout((function (param) {
id[0] = undefined;
skip[0] = false;
return /* () */0;
}), Curry._1(throttleF, signal[0])));
return sink(signal);
}
} else {
var tb = signal[0];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
$$clearTimeout$1(/* () */0);
return tb(/* Close */1);
} else {
return tb(signal);
}
})]));
}
}));
}));
}));
}
function sample(notifier, source, sink) {
var state = /* record */[
/* ended */false,
/* value */undefined,
/* sourceTalkback */(function (param) {
return /* () */0;
}),
/* notifierTalkback */(function (param) {
return /* () */0;
})
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
state[/* ended */0] = true;
state[/* notifierTalkback */3](/* Close */1);
return sink(/* End */0);
} else if (signal.tag) {
state[/* value */1] = Caml_option.some(signal[0]);
return /* () */0;
} else {
state[/* sourceTalkback */2] = signal[0];
return /* () */0;
}
}));
Curry._1(notifier, (function (signal) {
var match = state[/* value */1];
if (typeof signal === "number") {
state[/* ended */0] = true;
state[/* sourceTalkback */2](/* Close */1);
return sink(/* End */0);
} else if (signal.tag) {
if (match !== undefined && !state[/* ended */0]) {
state[/* value */1] = undefined;
return sink(/* Push */Block.__(1, [Caml_option.valFromOption(match)]));
} else {
return /* () */0;
}
} else {
state[/* notifierTalkback */3] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* ended */0] = true;
state[/* sourceTalkback */2](/* Close */1);
return state[/* notifierTalkback */3](/* Close */1);
} else {
state[/* sourceTalkback */2](/* Pull */0);
return state[/* notifierTalkback */3](/* Pull */0);
}
})]));
function sample(notifier) {
return Wonka_types.curry((function (source) {
return Wonka_types.curry((function (sink) {
var state = /* record */[
/* ended */false,
/* value */undefined,
/* sourceTalkback */(function (param) {
return /* () */0;
}),
/* notifierTalkback */(function (param) {
return /* () */0;
})
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
state[/* ended */0] = true;
state[/* notifierTalkback */3](/* Close */1);
return sink(/* End */0);
} else if (signal.tag) {
state[/* value */1] = Caml_option.some(signal[0]);
return /* () */0;
} else {
state[/* sourceTalkback */2] = signal[0];
return /* () */0;
}
}));
Curry._1(notifier, (function (signal) {
var match = state[/* value */1];
if (typeof signal === "number") {
state[/* ended */0] = true;
state[/* sourceTalkback */2](/* Close */1);
return sink(/* End */0);
} else if (signal.tag) {
if (match !== undefined && !state[/* ended */0]) {
state[/* value */1] = undefined;
return sink(/* Push */Block.__(1, [Caml_option.valFromOption(match)]));
} else {
return /* () */0;
}
} else {
state[/* notifierTalkback */3] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* ended */0] = true;
state[/* sourceTalkback */2](/* Close */1);
return state[/* notifierTalkback */3](/* Close */1);
} else {
state[/* sourceTalkback */2](/* Pull */0);
return state[/* notifierTalkback */3](/* Pull */0);
}
})]));
}));
}));
}
function delay(wait, source, sink) {
var state = /* record */[
/* talkback */Wonka_helpers.talkbackPlaceholder,
/* active */0,
/* gotEndSignal */false
];
Curry._1(source, (function (signal) {
var exit = 0;
if (typeof signal === "number" || signal.tag) {
exit = 1;
} else {
state[/* talkback */0] = signal[0];
return /* () */0;
}
if (exit === 1) {
if (state[/* gotEndSignal */2]) {
return /* () */0;
} else {
state[/* active */1] = state[/* active */1] + 1 | 0;
setTimeout((function (param) {
if (state[/* gotEndSignal */2] && state[/* active */1] === 0) {
sink(/* End */0);
} else {
state[/* active */1] = state[/* active */1] - 1 | 0;
}
return sink(signal);
}), wait);
return /* () */0;
}
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* gotEndSignal */2] = true;
if (state[/* active */1] === 0) {
return sink(/* End */0);
} else {
return 0;
}
} else if (state[/* gotEndSignal */2]) {
return /* () */0;
} else {
return state[/* talkback */0](signal);
}
})]));
function delay(wait) {
return Wonka_types.curry((function (source) {
return Wonka_types.curry((function (sink) {
var state = /* record */[
/* talkback */Wonka_helpers.talkbackPlaceholder,
/* active */0,
/* gotEndSignal */false
];
Curry._1(source, (function (signal) {
var exit = 0;
if (typeof signal === "number" || signal.tag) {
exit = 1;
} else {
state[/* talkback */0] = signal[0];
return /* () */0;
}
if (exit === 1) {
if (state[/* gotEndSignal */2]) {
return /* () */0;
} else {
state[/* active */1] = state[/* active */1] + 1 | 0;
setTimeout((function (param) {
if (state[/* gotEndSignal */2] && state[/* active */1] === 0) {
sink(/* End */0);
} else {
state[/* active */1] = state[/* active */1] - 1 | 0;
}
return sink(signal);
}), wait);
return /* () */0;
}
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* gotEndSignal */2] = true;
if (state[/* active */1] === 0) {
return sink(/* End */0);
} else {
return 0;
}
} else if (state[/* gotEndSignal */2]) {
return /* () */0;
} else {
return state[/* talkback */0](signal);
}
})]));
}));
}));
}

@@ -271,0 +296,0 @@

@@ -1,1 +0,9 @@

/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
'use strict';
function curry(x) {
return x;
}
exports.curry = curry;
/* No side effect */

@@ -9,85 +9,91 @@ 'use strict';

function fromList(list_, sink) {
var state = /* record */[
/* value */list_,
/* ended */false,
/* looping */false,
/* pull */false
];
return sink(/* Start */Block.__(0, [(function (signal) {
var match = state[/* looping */2];
if (signal) {
state[/* ended */1] = true;
return /* () */0;
} else if (match) {
state[/* pull */3] = true;
return /* () */0;
} else {
state[/* pull */3] = true;
state[/* looping */2] = true;
while(state[/* pull */3] && !state[/* ended */1]) {
var match$1 = state[/* value */0];
if (match$1) {
state[/* value */0] = match$1[1];
state[/* pull */3] = false;
sink(/* Push */Block.__(1, [match$1[0]]));
function fromList(ls) {
return (function (sink) {
var state = /* record */[
/* value */ls,
/* ended */false,
/* looping */false,
/* pull */false
];
return sink(/* Start */Block.__(0, [(function (signal) {
var match = state[/* looping */2];
if (signal) {
state[/* ended */1] = true;
return /* () */0;
} else if (match) {
state[/* pull */3] = true;
return /* () */0;
} else {
state[/* ended */1] = true;
sink(/* End */0);
state[/* pull */3] = true;
state[/* looping */2] = true;
while(state[/* pull */3] && !state[/* ended */1]) {
var match$1 = state[/* value */0];
if (match$1) {
state[/* value */0] = match$1[1];
state[/* pull */3] = false;
sink(/* Push */Block.__(1, [match$1[0]]));
} else {
state[/* ended */1] = true;
sink(/* End */0);
}
};
state[/* looping */2] = false;
return /* () */0;
}
};
state[/* looping */2] = false;
return /* () */0;
}
})]));
})]));
});
}
function fromArray(arr, sink) {
var size = arr.length;
var state = /* record */[
/* index */0,
/* ended */false,
/* looping */false,
/* pull */false
];
return sink(/* Start */Block.__(0, [(function (signal) {
var match = state[/* looping */2];
if (signal) {
state[/* ended */1] = true;
return /* () */0;
} else if (match) {
state[/* pull */3] = true;
return /* () */0;
} else {
state[/* pull */3] = true;
state[/* looping */2] = true;
while(state[/* pull */3] && !state[/* ended */1]) {
var index = state[/* index */0];
if (index < size) {
var x = arr[index];
state[/* index */0] = index + 1 | 0;
state[/* pull */3] = false;
sink(/* Push */Block.__(1, [x]));
function fromArray(arr) {
return (function (sink) {
var size = arr.length;
var state = /* record */[
/* index */0,
/* ended */false,
/* looping */false,
/* pull */false
];
return sink(/* Start */Block.__(0, [(function (signal) {
var match = state[/* looping */2];
if (signal) {
state[/* ended */1] = true;
return /* () */0;
} else if (match) {
state[/* pull */3] = true;
return /* () */0;
} else {
state[/* ended */1] = true;
sink(/* End */0);
state[/* pull */3] = true;
state[/* looping */2] = true;
while(state[/* pull */3] && !state[/* ended */1]) {
var index = state[/* index */0];
if (index < size) {
var x = arr[index];
state[/* index */0] = index + 1 | 0;
state[/* pull */3] = false;
sink(/* Push */Block.__(1, [x]));
} else {
state[/* ended */1] = true;
sink(/* End */0);
}
};
state[/* looping */2] = false;
return /* () */0;
}
};
state[/* looping */2] = false;
return /* () */0;
}
})]));
})]));
});
}
function fromValue(x, sink) {
var ended = /* record */[/* contents */false];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal || ended[0]) {
return /* () */0;
} else {
ended[0] = true;
sink(/* Push */Block.__(1, [x]));
return sink(/* End */0);
}
})]));
function fromValue(x) {
return (function (sink) {
var ended = /* record */[/* contents */false];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal || ended[0]) {
return /* () */0;
} else {
ended[0] = true;
sink(/* Push */Block.__(1, [x]));
return sink(/* End */0);
}
})]));
});
}

@@ -104,120 +110,136 @@

function map(f, source, sink) {
return Curry._1(source, (function (signal) {
var tmp;
tmp = typeof signal === "number" ? /* End */0 : (
signal.tag ? /* Push */Block.__(1, [Curry._1(f, signal[0])]) : /* Start */Block.__(0, [signal[0]])
);
return sink(tmp);
}));
function map(f) {
return (function (source) {
return (function (sink) {
return Curry._1(source, (function (signal) {
var tmp;
tmp = typeof signal === "number" ? /* End */0 : (
signal.tag ? /* Push */Block.__(1, [Curry._1(f, signal[0])]) : /* Start */Block.__(0, [signal[0]])
);
return sink(tmp);
}));
});
});
}
function filter(f, source, sink) {
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && !Curry._1(f, signal[0]))) {
return sink(signal);
} else {
return talkback(/* Pull */0);
}
}));
function filter(f) {
return (function (source) {
return (function (sink) {
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && !Curry._1(f, signal[0]))) {
return sink(signal);
} else {
return talkback(/* Pull */0);
}
}));
});
});
}
function scan(f, seed, source, sink) {
var acc = /* record */[/* contents */seed];
return Curry._1(source, (function (signal) {
var tmp;
function scan(f, seed) {
return (function (source) {
return (function (sink) {
var acc = /* record */[/* contents */seed];
return Curry._1(source, (function (signal) {
var tmp;
if (typeof signal === "number") {
tmp = /* End */0;
} else if (signal.tag) {
acc[0] = Curry._2(f, acc[0], signal[0]);
tmp = /* Push */Block.__(1, [acc[0]]);
} else {
tmp = /* Start */Block.__(0, [signal[0]]);
}
return sink(tmp);
}));
});
});
}
function merge(sources) {
return (function (sink) {
var size = sources.length;
var talkbacks = Array_js.make(size, Wonka_helpers.talkbackPlaceholder);
var state = /* record */[
/* started */0,
/* ended */0
];
var talkback = function (signal) {
var _i = 0;
while(true) {
var i = _i;
if (i < size) {
talkbacks[i](signal);
_i = i + 1 | 0;
continue ;
} else {
return 0;
}
};
};
var _i = 0;
while(true) {
var i = _i;
if (i < size) {
var source = sources[i];
Curry._1(source, (function(i){
return function (signal) {
if (typeof signal === "number") {
tmp = /* End */0;
state[/* ended */1] = state[/* ended */1] + 1 | 0;
if (state[/* ended */1] === size) {
return sink(/* End */0);
} else {
return 0;
}
} else if (signal.tag) {
acc[0] = Curry._2(f, acc[0], signal[0]);
tmp = /* Push */Block.__(1, [acc[0]]);
return sink(signal);
} else {
tmp = /* Start */Block.__(0, [signal[0]]);
talkbacks[i] = signal[0];
state[/* started */0] = state[/* started */0] + 1 | 0;
if (state[/* started */0] === size) {
return sink(/* Start */Block.__(0, [talkback]));
} else {
return 0;
}
}
return sink(tmp);
}));
}
function merge(sources, sink) {
var size = sources.length;
var talkbacks = Array_js.make(size, Wonka_helpers.talkbackPlaceholder);
var state = /* record */[
/* started */0,
/* ended */0
];
var talkback = function (signal) {
var _i = 0;
while(true) {
var i = _i;
if (i < size) {
talkbacks[i](signal);
_i = i + 1 | 0;
continue ;
} else {
return 0;
}
};
};
var _i = 0;
while(true) {
var i = _i;
if (i < size) {
var source = sources[i];
Curry._1(source, (function(i){
return function (signal) {
if (typeof signal === "number") {
state[/* ended */1] = state[/* ended */1] + 1 | 0;
if (state[/* ended */1] === size) {
return sink(/* End */0);
} else {
return 0;
}
} else if (signal.tag) {
return sink(signal);
} else {
talkbacks[i] = signal[0];
state[/* started */0] = state[/* started */0] + 1 | 0;
if (state[/* started */0] === size) {
return sink(/* Start */Block.__(0, [talkback]));
} else {
return 0;
}
}
}
}(i)));
_i = i + 1 | 0;
continue ;
} else {
return 0;
}
};
}(i)));
_i = i + 1 | 0;
continue ;
} else {
return 0;
}
};
});
}
function concat(sources, sink) {
var size = sources.length;
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
var nextSource = function (i) {
if (i < size) {
var source = sources[i];
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
return nextSource(i + 1 | 0);
} else if (signal.tag) {
return sink(signal);
} else {
var tb = signal[0];
talkback[0] = tb;
if (i === 0) {
sink(/* Start */Block.__(0, [(function (signal) {
return talkback[0](signal);
})]));
}
return tb(/* Pull */0);
}
}));
} else {
return sink(/* End */0);
}
};
return nextSource(0);
function concat(sources) {
return (function (sink) {
var size = sources.length;
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
var nextSource = function (i) {
if (i < size) {
var source = sources[i];
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
return nextSource(i + 1 | 0);
} else if (signal.tag) {
return sink(signal);
} else {
var tb = signal[0];
talkback[0] = tb;
if (i === 0) {
sink(/* Start */Block.__(0, [(function (signal) {
return talkback[0](signal);
})]));
}
return tb(/* Pull */0);
}
}));
} else {
return sink(/* End */0);
}
};
return nextSource(0);
});
}

@@ -273,431 +295,467 @@

function combine(sourceA, sourceB, sink) {
var state = /* record */[
/* talkbackA */Wonka_helpers.talkbackPlaceholder,
/* talkbackB */Wonka_helpers.talkbackPlaceholder,
/* lastValA */undefined,
/* lastValB */undefined,
/* gotSignal */false,
/* endCounter */0,
/* ended */false
];
Curry._1(sourceA, (function (signal) {
var match = state[/* lastValB */3];
if (typeof signal === "number") {
if (state[/* endCounter */5] < 1) {
state[/* endCounter */5] = state[/* endCounter */5] + 1 | 0;
return /* () */0;
} else if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* ended */6] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
var a = signal[0];
if (match !== undefined) {
if (state[/* ended */6]) {
function combine(sourceA, sourceB) {
return (function (sink) {
var state = /* record */[
/* talkbackA */Wonka_helpers.talkbackPlaceholder,
/* talkbackB */Wonka_helpers.talkbackPlaceholder,
/* lastValA */undefined,
/* lastValB */undefined,
/* gotSignal */false,
/* endCounter */0,
/* ended */false
];
Curry._1(sourceA, (function (signal) {
var match = state[/* lastValB */3];
if (typeof signal === "number") {
if (state[/* endCounter */5] < 1) {
state[/* endCounter */5] = state[/* endCounter */5] + 1 | 0;
return /* () */0;
} else if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* ended */6] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
var a = signal[0];
if (match !== undefined) {
if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* lastValA */2] = Caml_option.some(a);
state[/* gotSignal */4] = false;
return sink(/* Push */Block.__(1, [/* tuple */[
a,
Caml_option.valFromOption(match)
]]));
}
} else {
state[/* lastValA */2] = Caml_option.some(a);
state[/* gotSignal */4] = false;
return /* () */0;
}
} else {
state[/* talkbackA */0] = signal[0];
return /* () */0;
}
}));
Curry._1(sourceB, (function (signal) {
var match = state[/* lastValA */2];
if (typeof signal === "number") {
if (state[/* endCounter */5] < 1) {
state[/* endCounter */5] = state[/* endCounter */5] + 1 | 0;
return /* () */0;
} else if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* ended */6] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
var b = signal[0];
if (match !== undefined) {
if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* lastValB */3] = Caml_option.some(b);
state[/* gotSignal */4] = false;
return sink(/* Push */Block.__(1, [/* tuple */[
Caml_option.valFromOption(match),
b
]]));
}
} else {
state[/* lastValB */3] = Caml_option.some(b);
state[/* gotSignal */4] = false;
return /* () */0;
}
} else {
state[/* lastValA */2] = Caml_option.some(a);
state[/* gotSignal */4] = false;
return sink(/* Push */Block.__(1, [/* tuple */[
a,
Caml_option.valFromOption(match)
]]));
}
} else {
state[/* lastValA */2] = Caml_option.some(a);
state[/* gotSignal */4] = false;
return /* () */0;
}
} else {
state[/* talkbackA */0] = signal[0];
return /* () */0;
}
}));
Curry._1(sourceB, (function (signal) {
var match = state[/* lastValA */2];
if (typeof signal === "number") {
if (state[/* endCounter */5] < 1) {
state[/* endCounter */5] = state[/* endCounter */5] + 1 | 0;
return /* () */0;
} else if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* ended */6] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
var b = signal[0];
if (match !== undefined) {
if (state[/* ended */6]) {
state[/* talkbackB */1] = signal[0];
return /* () */0;
} else {
state[/* lastValB */3] = Caml_option.some(b);
state[/* gotSignal */4] = false;
return sink(/* Push */Block.__(1, [/* tuple */[
Caml_option.valFromOption(match),
b
]]));
}
} else {
state[/* lastValB */3] = Caml_option.some(b);
state[/* gotSignal */4] = false;
return /* () */0;
}
} else {
state[/* talkbackB */1] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (state[/* ended */6]) {
return 0;
} else if (signal) {
state[/* ended */6] = true;
state[/* talkbackA */0](/* Close */1);
return state[/* talkbackB */1](/* Close */1);
} else if (state[/* gotSignal */4]) {
return /* () */0;
} else {
state[/* gotSignal */4] = true;
state[/* talkbackA */0](signal);
return state[/* talkbackB */1](signal);
}
})]));
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (state[/* ended */6]) {
return 0;
} else if (signal) {
state[/* ended */6] = true;
state[/* talkbackA */0](/* Close */1);
return state[/* talkbackB */1](/* Close */1);
} else if (state[/* gotSignal */4]) {
return /* () */0;
} else {
state[/* gotSignal */4] = true;
state[/* talkbackA */0](signal);
return state[/* talkbackB */1](signal);
}
})]));
});
}
function take(max, source, sink) {
var state = /* record */[
/* taken */0,
/* talkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* taken */0] < max) {
state[/* taken */0] = max;
return sink(/* End */0);
} else {
return /* () */0;
}
} else if (signal.tag) {
if (state[/* taken */0] < max) {
state[/* taken */0] = state[/* taken */0] + 1 | 0;
sink(signal);
if (state[/* taken */0] === max) {
sink(/* End */0);
return state[/* talkback */1](/* Close */1);
} else {
return 0;
}
} else {
return /* () */0;
}
} else {
state[/* talkback */1] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
function take(max) {
return (function (source) {
return (function (sink) {
var state = /* record */[
/* taken */0,
/* talkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* taken */0] < max) {
if (signal) {
state[/* taken */0] = max;
state[/* taken */0] = max;
return sink(/* End */0);
} else {
return /* () */0;
}
} else if (signal.tag) {
if (state[/* taken */0] < max) {
state[/* taken */0] = state[/* taken */0] + 1 | 0;
sink(signal);
if (state[/* taken */0] === max) {
sink(/* End */0);
return state[/* talkback */1](/* Close */1);
} else {
return state[/* talkback */1](/* Pull */0);
return 0;
}
} else {
return 0;
return /* () */0;
}
})]));
} else {
state[/* talkback */1] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (state[/* taken */0] < max) {
if (signal) {
state[/* taken */0] = max;
return state[/* talkback */1](/* Close */1);
} else {
return state[/* talkback */1](/* Pull */0);
}
} else {
return 0;
}
})]));
});
});
}
function takeLast(max, source, sink) {
var queue = new Array();
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number") {
return Wonka_helpers.makeTrampoline(sink, (function () {
return queue.shift();
}));
} else if (signal.tag) {
var size = queue.length;
if (size >= max && max > 0) {
queue.shift();
}
queue.push(signal[0]);
return talkback(/* Pull */0);
} else {
return talkback(/* Pull */0);
}
}));
function takeLast(max) {
return (function (source) {
return (function (sink) {
var queue = new Array();
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number") {
return Wonka_helpers.makeTrampoline(sink, (function () {
return queue.shift();
}));
} else if (signal.tag) {
var size = queue.length;
if (size >= max && max > 0) {
queue.shift();
}
queue.push(signal[0]);
return talkback(/* Pull */0);
} else {
return talkback(/* Pull */0);
}
}));
});
});
}
function takeWhile(predicate, source, sink) {
var ended = /* record */[/* contents */false];
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (ended[0]) {
return /* () */0;
} else {
ended[0] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
if (ended[0]) {
return /* () */0;
} else if (Curry._1(predicate, signal[0])) {
return sink(signal);
} else {
ended[0] = true;
sink(/* End */0);
return talkback[0](/* Close */1);
}
} else {
talkback[0] = signal[0];
return sink(signal);
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
function takeWhile(predicate) {
return (function (source) {
return (function (sink) {
var ended = /* record */[/* contents */false];
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (ended[0]) {
return 0;
} else if (signal) {
return /* () */0;
} else {
ended[0] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
if (ended[0]) {
return /* () */0;
} else if (Curry._1(predicate, signal[0])) {
return sink(signal);
} else {
ended[0] = true;
sink(/* End */0);
return talkback[0](/* Close */1);
} else {
return talkback[0](/* Pull */0);
}
})]));
} else {
talkback[0] = signal[0];
return sink(signal);
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (ended[0]) {
return 0;
} else if (signal) {
ended[0] = true;
return talkback[0](/* Close */1);
} else {
return talkback[0](/* Pull */0);
}
})]));
});
});
}
function takeUntil(notifier, source, sink) {
var state = /* record */[
/* ended */false,
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* notifierTalkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* ended */0]) {
return /* () */0;
} else {
state[/* notifierTalkback */2](/* Close */1);
state[/* ended */0] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
if (state[/* ended */0]) {
return /* () */0;
} else {
return sink(signal);
}
} else {
state[/* sourceTalkback */1] = signal[0];
return Curry._1(notifier, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
state[/* ended */0] = true;
state[/* notifierTalkback */2](/* Close */1);
state[/* sourceTalkback */1](/* Close */1);
return sink(/* End */0);
} else {
var innerTb = signal[0];
state[/* notifierTalkback */2] = innerTb;
return innerTb(/* Pull */0);
}
}));
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
function takeUntil(notifier) {
return (function (source) {
return (function (sink) {
var state = /* record */[
/* ended */false,
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* notifierTalkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* ended */0]) {
return 0;
} else if (signal) {
state[/* sourceTalkback */1](/* Close */1);
return state[/* notifierTalkback */2](/* Close */1);
return /* () */0;
} else {
return state[/* sourceTalkback */1](/* Pull */0);
state[/* notifierTalkback */2](/* Close */1);
state[/* ended */0] = true;
return sink(/* End */0);
}
})]));
} else if (signal.tag) {
if (state[/* ended */0]) {
return /* () */0;
} else {
return sink(signal);
}
} else {
state[/* sourceTalkback */1] = signal[0];
return Curry._1(notifier, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
state[/* ended */0] = true;
state[/* notifierTalkback */2](/* Close */1);
state[/* sourceTalkback */1](/* Close */1);
return sink(/* End */0);
} else {
var innerTb = signal[0];
state[/* notifierTalkback */2] = innerTb;
return innerTb(/* Pull */0);
}
}));
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (state[/* ended */0]) {
return 0;
} else if (signal) {
state[/* sourceTalkback */1](/* Close */1);
return state[/* notifierTalkback */2](/* Close */1);
} else {
return state[/* sourceTalkback */1](/* Pull */0);
}
})]));
});
});
}
function skip(wait, source, sink) {
var rest = /* record */[/* contents */wait];
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && rest[0] > 0)) {
return sink(signal);
} else {
rest[0] = rest[0] - 1 | 0;
return talkback(/* Pull */0);
}
}));
function skip(wait) {
return (function (source) {
return (function (sink) {
var rest = /* record */[/* contents */wait];
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && rest[0] > 0)) {
return sink(signal);
} else {
rest[0] = rest[0] - 1 | 0;
return talkback(/* Pull */0);
}
}));
});
});
}
function skipWhile(predicate, source, sink) {
var skip = /* record */[/* contents */true];
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && skip[0])) {
return sink(signal);
} else if (Curry._1(predicate, signal[0])) {
return talkback(/* Pull */0);
} else {
skip[0] = false;
return sink(signal);
}
}));
function skipWhile(predicate) {
return (function (source) {
return (function (sink) {
var skip = /* record */[/* contents */true];
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && skip[0])) {
return sink(signal);
} else if (Curry._1(predicate, signal[0])) {
return talkback(/* Pull */0);
} else {
skip[0] = false;
return sink(signal);
}
}));
});
});
}
function skipUntil(notifier, source, sink) {
var state = /* record */[
/* skip */true,
/* ended */false,
/* gotSignal */false,
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* notifierTalkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* skip */0]) {
state[/* notifierTalkback */4](/* Close */1);
}
state[/* ended */1] = true;
return sink(/* End */0);
} else if (signal.tag) {
if (state[/* skip */0] && !state[/* ended */1]) {
return state[/* sourceTalkback */3](/* Pull */0);
} else if (state[/* ended */1]) {
return /* () */0;
} else {
state[/* gotSignal */2] = false;
return sink(signal);
}
} else {
var tb = signal[0];
state[/* sourceTalkback */3] = tb;
return Curry._1(notifier, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
state[/* skip */0] = false;
return state[/* notifierTalkback */4](/* Close */1);
} else {
var innerTb = signal[0];
state[/* notifierTalkback */4] = innerTb;
innerTb(/* Pull */0);
return tb(/* Pull */0);
}
}));
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
if (state[/* skip */0]) {
state[/* notifierTalkback */4](/* Close */1);
}
state[/* ended */1] = true;
return state[/* sourceTalkback */3](/* Close */1);
} else if (!state[/* gotSignal */2] && !state[/* ended */1]) {
state[/* gotSignal */2] = true;
function skipUntil(notifier) {
return (function (source) {
return (function (sink) {
var state = /* record */[
/* skip */true,
/* ended */false,
/* gotSignal */false,
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* notifierTalkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* skip */0]) {
state[/* notifierTalkback */4](/* Close */1);
}
state[/* ended */1] = true;
return sink(/* End */0);
} else if (signal.tag) {
if (state[/* skip */0] && !state[/* ended */1]) {
return state[/* sourceTalkback */3](/* Pull */0);
} else if (state[/* ended */1]) {
return /* () */0;
} else {
return /* () */0;
state[/* gotSignal */2] = false;
return sink(signal);
}
})]));
} else {
var tb = signal[0];
state[/* sourceTalkback */3] = tb;
return Curry._1(notifier, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
state[/* skip */0] = false;
return state[/* notifierTalkback */4](/* Close */1);
} else {
var innerTb = signal[0];
state[/* notifierTalkback */4] = innerTb;
innerTb(/* Pull */0);
return tb(/* Pull */0);
}
}));
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
if (state[/* skip */0]) {
state[/* notifierTalkback */4](/* Close */1);
}
state[/* ended */1] = true;
return state[/* sourceTalkback */3](/* Close */1);
} else if (!state[/* gotSignal */2] && !state[/* ended */1]) {
state[/* gotSignal */2] = true;
return state[/* sourceTalkback */3](/* Pull */0);
} else {
return /* () */0;
}
})]));
});
});
}
function flatten(source, sink) {
var state = /* record */[
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* innerTalkback */Wonka_helpers.talkbackPlaceholder,
/* sourceEnded */false,
/* innerEnded */true
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* innerEnded */3]) {
return sink(/* End */0);
} else {
state[/* sourceEnded */2] = true;
return /* () */0;
}
} else if (signal.tag) {
var innerSource = signal[0];
return Curry._1(innerSource, (function (signal) {
if (typeof signal === "number") {
if (state[/* sourceEnded */2]) {
return state[/* sourceTalkback */0](/* Close */1);
} else {
state[/* innerEnded */3] = true;
return state[/* sourceTalkback */0](/* Pull */0);
}
} else if (signal.tag) {
return sink(signal);
} else {
var tb = signal[0];
if (!state[/* innerEnded */3]) {
state[/* innerTalkback */1](/* Close */1);
}
state[/* innerEnded */3] = false;
state[/* innerTalkback */1] = tb;
return tb(/* Pull */0);
}
}));
} else {
state[/* sourceTalkback */0] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* sourceTalkback */0](/* Close */1);
return state[/* innerTalkback */1](/* Close */1);
} else if (!state[/* innerEnded */3] && !state[/* sourceEnded */2]) {
return state[/* innerTalkback */1](/* Pull */0);
} else if (state[/* sourceEnded */2]) {
function flatten(source) {
return (function (sink) {
var state = /* record */[
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* innerTalkback */Wonka_helpers.talkbackPlaceholder,
/* sourceEnded */false,
/* innerEnded */true
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* innerEnded */3]) {
return sink(/* End */0);
} else {
state[/* sourceEnded */2] = true;
return /* () */0;
}
} else if (signal.tag) {
var innerSource = signal[0];
return Curry._1(innerSource, (function (signal) {
if (typeof signal === "number") {
if (state[/* sourceEnded */2]) {
return state[/* sourceTalkback */0](/* Close */1);
} else {
state[/* innerEnded */3] = true;
return state[/* sourceTalkback */0](/* Pull */0);
}
} else if (signal.tag) {
return sink(signal);
} else {
var tb = signal[0];
if (!state[/* innerEnded */3]) {
state[/* innerTalkback */1](/* Close */1);
}
state[/* innerEnded */3] = false;
state[/* innerTalkback */1] = tb;
return tb(/* Pull */0);
}
}));
} else {
state[/* sourceTalkback */0] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* sourceTalkback */0](/* Close */1);
return state[/* innerTalkback */1](/* Close */1);
} else if (!state[/* innerEnded */3] && !state[/* sourceEnded */2]) {
return state[/* innerTalkback */1](/* Pull */0);
} else if (state[/* sourceEnded */2]) {
return /* () */0;
} else {
return state[/* sourceTalkback */0](/* Pull */0);
}
})]));
});
}
function forEach(f) {
return (function (source) {
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
Curry._1(f, signal[0]);
return talkback(/* Pull */0);
} else {
return state[/* sourceTalkback */0](/* Pull */0);
return talkback(/* Pull */0);
}
})]));
}));
});
}
function forEach(f, source) {
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number") {
function subscribe(f) {
return (function (source) {
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
var ended = /* record */[/* contents */false];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
if (ended[0]) {
return /* () */0;
} else if (signal.tag) {
} else {
Curry._1(f, signal[0]);
return talkback(/* Pull */0);
} else {
return talkback(/* Pull */0);
return talkback[0](/* Pull */0);
}
}));
}
function subscribe(f, source) {
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
var ended = /* record */[/* contents */false];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
if (ended[0]) {
return /* () */0;
} else {
Curry._1(f, signal[0]);
return talkback[0](/* Pull */0);
}
} else {
talkback[0] = signal[0];
return talkback[0](/* Pull */0);
}
}));
return (function (param) {
if (ended[0]) {
return 0;
} else {
talkback[0] = signal[0];
return talkback[0](/* Pull */0);
ended[0] = true;
return talkback[0](/* Close */1);
}
}));
return (function (param) {
if (ended[0]) {
return 0;
} else {
ended[0] = true;
return talkback[0](/* Close */1);
}
});
});

@@ -704,0 +762,0 @@ }

{
"name": "wonka",
"version": "1.0.1",
"version": "1.1.0",
"author": "Phil Pluckthun <phil@kitten.sh>",
"main": "./lib/js/src/wonka.js",
"module": "./src/wonka.js",
"jsnext:main": "./src/wonka.js",
"types": "./src/wonka.d.ts",
"source": "./src/index.js",
"main": "./dist/wonka.js",
"module": "./dist/wonka.es.js",
"jsnext:main": "./dist/wonka.es.js",
"types": "./src/index.d.ts",
"files": [

@@ -20,6 +21,9 @@ "src",

"watch": "bsb -make-world -w",
"bundle": "microbundle --no-compress --format es,cjs",
"prebundlesize": "run-s bundle",
"bundlesize": "bundlesize",
"test": "jest",
"coverage": "jest -c ./.jest.coverage.json --coverage",
"test:watch": "jest --watch",
"prepublishOnly": "run-s clean build test"
"prepublishOnly": "run-s clean build bundle test"
},

@@ -40,12 +44,9 @@ "keywords": [

"license": "MIT",
"dependencies": {
"bs-rebel": "^0.2.2"
},
"peerDependencies": {
"bs-platform": ">=2.2.0"
},
"devDependencies": {
"@glennsl/bs-jest": "^0.4.6",
"bs-platform": "^4.0.17",
"bs-rebel": "^0.2.2",
"bundlesize": "^0.17.0",
"coveralls": "^3.0.0",
"microbundle": "^0.9.0",
"npm-run-all": "^4.1.2"

@@ -59,7 +60,10 @@ },

"**/lib/js/__tests__/*_test.js"
],
"modulePathIgnorePatterns": [
"/es6/"
]
}
},
"bundlesize": [
{
"path": "./dist/wonka.es.js",
"maxSize": "9 kB"
}
]
}

@@ -1,2 +0,2 @@

import { Sink, Source, Operator } from './wonka_types';
import { Sink, Source, Operator } from '../wonka_types';

@@ -6,11 +6,11 @@ export const fromListener: <E>(

removeListener: (cb: (event: E) => void) => void
) => Sink<E>;
) => Source<E>;
export const fromDomEvent: <E>(HTMLElement, string) => Sink<E>;
export const interval: (interval: number) => Sink<number>;
export const fromPromise: <A>(promise: Promise<A>) => Sink<A>;
export const fromDomEvent: <E>(HTMLElement, string) => Source<E>;
export const interval: (interval: number) => Source<number>;
export const fromPromise: <A>(promise: Promise<A>) => Source<A>;
export const debounce: <A>(withDuration: (value: A) => number) => Operator<A, A>;
export const throttle: <A>(withDuration: (value: A) => number) => Operator<A, A>;
export const debounce: <A>(f: (x: A) => number) => Operator<A, A>;
export const throttle: <A>(f: (x: A) => number) => Operator<A, A>;
export const sample: <A>(signal: Source<any>) => Operator<A, A>;
export const delay: <A>(duration: number) => Operator<A, A>;

@@ -6,20 +6,24 @@

import * as Caml_option from "bs-platform/lib/es6/caml_option.js";
import * as Wonka_types from "../wonka_types.js";
import * as Wonka_helpers from "../wonka_helpers.js";
function fromListener(addListener, removeListener, sink) {
var handler = function ($$event) {
return sink(/* Push */Block.__(1, [$$event]));
};
sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
return Curry._1(removeListener, handler);
} else {
return /* () */0;
}
})]));
return Curry._1(addListener, handler);
function fromListener(addListener, removeListener) {
return Wonka_types.curry((function (sink) {
var handler = function ($$event) {
return sink(/* Push */Block.__(1, [$$event]));
};
sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
return Curry._1(removeListener, handler);
} else {
return /* () */0;
}
})]));
return Curry._1(addListener, handler);
}));
}
function fromDomEvent(element, $$event, sink) {
var addEventListener = (
function fromDomEvent(element, $$event) {
return Wonka_types.curry((function (sink) {
var addEventListener = (
function (element, event, handler) {

@@ -29,3 +33,3 @@ element.addEventListener(event, handler);

);
var removeEventListener = (
var removeEventListener = (
function (element, event, handler) {

@@ -35,236 +39,257 @@ element.removeEventListener(event, handler);

);
return fromListener((function (handler) {
return Curry._3(addEventListener, element, $$event, handler);
}), (function (handler) {
return Curry._3(removeEventListener, element, $$event, handler);
}), sink);
return Curry._1(fromListener((function (handler) {
return Curry._3(addEventListener, element, $$event, handler);
}), (function (handler) {
return Curry._3(removeEventListener, element, $$event, handler);
})), sink);
}));
}
function interval(p, sink) {
var i = /* record */[/* contents */0];
var id = setInterval((function (param) {
var num = i[0];
i[0] = i[0] + 1 | 0;
return sink(/* Push */Block.__(1, [num]));
}), p);
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
clearInterval(id);
return /* () */0;
} else {
return /* () */0;
}
})]));
function interval(p) {
return Wonka_types.curry((function (sink) {
var i = /* record */[/* contents */0];
var id = setInterval((function (param) {
var num = i[0];
i[0] = i[0] + 1 | 0;
return sink(/* Push */Block.__(1, [num]));
}), p);
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
clearInterval(id);
return /* () */0;
} else {
return /* () */0;
}
})]));
}));
}
function fromPromise(promise, sink) {
var ended = /* record */[/* contents */false];
promise.then((function (value) {
if (!ended[0]) {
sink(/* Push */Block.__(1, [value]));
sink(/* End */0);
}
return Promise.resolve(/* () */0);
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
ended[0] = true;
return /* () */0;
} else {
return /* () */0;
}
})]));
function fromPromise(promise) {
return Wonka_types.curry((function (sink) {
var ended = /* record */[/* contents */false];
promise.then((function (value) {
if (!ended[0]) {
sink(/* Push */Block.__(1, [value]));
sink(/* End */0);
}
return Promise.resolve(/* () */0);
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
ended[0] = true;
return /* () */0;
} else {
return /* () */0;
}
})]));
}));
}
function debounce(debounceF, source, sink) {
var gotEndSignal = /* record */[/* contents */false];
var id = /* record */[/* contents */undefined];
var $$clearTimeout$1 = function (param) {
var match = id[0];
if (match !== undefined) {
id[0] = undefined;
clearTimeout(Caml_option.valFromOption(match));
return /* () */0;
} else {
return /* () */0;
}
};
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
gotEndSignal[0] = true;
var match = id[0];
if (match !== undefined) {
return /* () */0;
} else {
return sink(/* End */0);
}
} else if (signal.tag) {
$$clearTimeout$1(/* () */0);
id[0] = Caml_option.some(setTimeout((function (param) {
id[0] = undefined;
sink(signal);
if (gotEndSignal[0]) {
return sink(/* End */0);
} else {
return 0;
}
}), Curry._1(debounceF, signal[0])));
return /* () */0;
} else {
var tb = signal[0];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
$$clearTimeout$1(/* () */0);
return tb(/* Close */1);
} else {
return tb(signal);
}
})]));
}
function debounce(debounceF) {
return Wonka_types.curry((function (source) {
return Wonka_types.curry((function (sink) {
var gotEndSignal = /* record */[/* contents */false];
var id = /* record */[/* contents */undefined];
var $$clearTimeout$1 = function (param) {
var match = id[0];
if (match !== undefined) {
id[0] = undefined;
clearTimeout(Caml_option.valFromOption(match));
return /* () */0;
} else {
return /* () */0;
}
};
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
gotEndSignal[0] = true;
var match = id[0];
if (match !== undefined) {
return /* () */0;
} else {
return sink(/* End */0);
}
} else if (signal.tag) {
$$clearTimeout$1(/* () */0);
id[0] = Caml_option.some(setTimeout((function (param) {
id[0] = undefined;
sink(signal);
if (gotEndSignal[0]) {
return sink(/* End */0);
} else {
return 0;
}
}), Curry._1(debounceF, signal[0])));
return /* () */0;
} else {
var tb = signal[0];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
$$clearTimeout$1(/* () */0);
return tb(/* Close */1);
} else {
return tb(signal);
}
})]));
}
}));
}));
}));
}
function throttle(throttleF, source, sink) {
var skip = /* record */[/* contents */false];
var id = /* record */[/* contents */undefined];
var $$clearTimeout$1 = function (param) {
var match = id[0];
if (match !== undefined) {
clearTimeout(Caml_option.valFromOption(match));
return /* () */0;
} else {
return /* () */0;
}
};
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
$$clearTimeout$1(/* () */0);
return sink(/* End */0);
} else if (signal.tag) {
if (skip[0]) {
return /* () */0;
} else {
skip[0] = true;
$$clearTimeout$1(/* () */0);
id[0] = Caml_option.some(setTimeout((function (param) {
id[0] = undefined;
skip[0] = false;
return /* () */0;
}), Curry._1(throttleF, signal[0])));
return sink(signal);
}
} else {
var tb = signal[0];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
$$clearTimeout$1(/* () */0);
return tb(/* Close */1);
} else {
return tb(signal);
}
})]));
}
function throttle(throttleF) {
return Wonka_types.curry((function (source) {
return Wonka_types.curry((function (sink) {
var skip = /* record */[/* contents */false];
var id = /* record */[/* contents */undefined];
var $$clearTimeout$1 = function (param) {
var match = id[0];
if (match !== undefined) {
clearTimeout(Caml_option.valFromOption(match));
return /* () */0;
} else {
return /* () */0;
}
};
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
$$clearTimeout$1(/* () */0);
return sink(/* End */0);
} else if (signal.tag) {
if (skip[0]) {
return /* () */0;
} else {
skip[0] = true;
$$clearTimeout$1(/* () */0);
id[0] = Caml_option.some(setTimeout((function (param) {
id[0] = undefined;
skip[0] = false;
return /* () */0;
}), Curry._1(throttleF, signal[0])));
return sink(signal);
}
} else {
var tb = signal[0];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
$$clearTimeout$1(/* () */0);
return tb(/* Close */1);
} else {
return tb(signal);
}
})]));
}
}));
}));
}));
}
function sample(notifier, source, sink) {
var state = /* record */[
/* ended */false,
/* value */undefined,
/* sourceTalkback */(function (param) {
return /* () */0;
}),
/* notifierTalkback */(function (param) {
return /* () */0;
})
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
state[/* ended */0] = true;
state[/* notifierTalkback */3](/* Close */1);
return sink(/* End */0);
} else if (signal.tag) {
state[/* value */1] = Caml_option.some(signal[0]);
return /* () */0;
} else {
state[/* sourceTalkback */2] = signal[0];
return /* () */0;
}
}));
Curry._1(notifier, (function (signal) {
var match = state[/* value */1];
if (typeof signal === "number") {
state[/* ended */0] = true;
state[/* sourceTalkback */2](/* Close */1);
return sink(/* End */0);
} else if (signal.tag) {
if (match !== undefined && !state[/* ended */0]) {
state[/* value */1] = undefined;
return sink(/* Push */Block.__(1, [Caml_option.valFromOption(match)]));
} else {
return /* () */0;
}
} else {
state[/* notifierTalkback */3] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* ended */0] = true;
state[/* sourceTalkback */2](/* Close */1);
return state[/* notifierTalkback */3](/* Close */1);
} else {
state[/* sourceTalkback */2](/* Pull */0);
return state[/* notifierTalkback */3](/* Pull */0);
}
})]));
function sample(notifier) {
return Wonka_types.curry((function (source) {
return Wonka_types.curry((function (sink) {
var state = /* record */[
/* ended */false,
/* value */undefined,
/* sourceTalkback */(function (param) {
return /* () */0;
}),
/* notifierTalkback */(function (param) {
return /* () */0;
})
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
state[/* ended */0] = true;
state[/* notifierTalkback */3](/* Close */1);
return sink(/* End */0);
} else if (signal.tag) {
state[/* value */1] = Caml_option.some(signal[0]);
return /* () */0;
} else {
state[/* sourceTalkback */2] = signal[0];
return /* () */0;
}
}));
Curry._1(notifier, (function (signal) {
var match = state[/* value */1];
if (typeof signal === "number") {
state[/* ended */0] = true;
state[/* sourceTalkback */2](/* Close */1);
return sink(/* End */0);
} else if (signal.tag) {
if (match !== undefined && !state[/* ended */0]) {
state[/* value */1] = undefined;
return sink(/* Push */Block.__(1, [Caml_option.valFromOption(match)]));
} else {
return /* () */0;
}
} else {
state[/* notifierTalkback */3] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* ended */0] = true;
state[/* sourceTalkback */2](/* Close */1);
return state[/* notifierTalkback */3](/* Close */1);
} else {
state[/* sourceTalkback */2](/* Pull */0);
return state[/* notifierTalkback */3](/* Pull */0);
}
})]));
}));
}));
}
function delay(wait, source, sink) {
var state = /* record */[
/* talkback */Wonka_helpers.talkbackPlaceholder,
/* active */0,
/* gotEndSignal */false
];
Curry._1(source, (function (signal) {
var exit = 0;
if (typeof signal === "number" || signal.tag) {
exit = 1;
} else {
state[/* talkback */0] = signal[0];
return /* () */0;
}
if (exit === 1) {
if (state[/* gotEndSignal */2]) {
return /* () */0;
} else {
state[/* active */1] = state[/* active */1] + 1 | 0;
setTimeout((function (param) {
if (state[/* gotEndSignal */2] && state[/* active */1] === 0) {
sink(/* End */0);
} else {
state[/* active */1] = state[/* active */1] - 1 | 0;
}
return sink(signal);
}), wait);
return /* () */0;
}
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* gotEndSignal */2] = true;
if (state[/* active */1] === 0) {
return sink(/* End */0);
} else {
return 0;
}
} else if (state[/* gotEndSignal */2]) {
return /* () */0;
} else {
return state[/* talkback */0](signal);
}
})]));
function delay(wait) {
return Wonka_types.curry((function (source) {
return Wonka_types.curry((function (sink) {
var state = /* record */[
/* talkback */Wonka_helpers.talkbackPlaceholder,
/* active */0,
/* gotEndSignal */false
];
Curry._1(source, (function (signal) {
var exit = 0;
if (typeof signal === "number" || signal.tag) {
exit = 1;
} else {
state[/* talkback */0] = signal[0];
return /* () */0;
}
if (exit === 1) {
if (state[/* gotEndSignal */2]) {
return /* () */0;
} else {
state[/* active */1] = state[/* active */1] + 1 | 0;
setTimeout((function (param) {
if (state[/* gotEndSignal */2] && state[/* active */1] === 0) {
sink(/* End */0);
} else {
state[/* active */1] = state[/* active */1] - 1 | 0;
}
return sink(signal);
}), wait);
return /* () */0;
}
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* gotEndSignal */2] = true;
if (state[/* active */1] === 0) {
return sink(/* End */0);
} else {
return 0;
}
} else if (state[/* gotEndSignal */2]) {
return /* () */0;
} else {
return state[/* talkback */0](signal);
}
})]));
}));
}));
}

@@ -271,0 +296,0 @@

@@ -19,4 +19,4 @@ // Reason Helper Types:

export type Sink<A> = (signal: Signal<A>) => void;
export type Source<A> = (sink: Sink<A>) => void;
export type Operator<A, B> = (source: Source<A>) => (sink: Sink<B>) => void;
export interface Sink<A> { (signal: Signal<A>): void; }
export interface Source<A> { (sink: Sink<A>): void; }
export interface Operator<A, B> { (source: Source<A>): Source<B>; }

@@ -1,1 +0,12 @@

/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
function curry(x) {
return x;
}
export {
curry ,
}
/* No side effect */
import { List, Sink, Source, Operator } from './wonka_types';
export const fromList: <A>(list: List<A>) => (sink: Sink<A>) => void;
export const fromArray: <A>(array: A[]) => (sink: Sink<A>) => void;
export const fromValue: <A>(value: A) => (sink: Sink<A>) => void;
export const empty: (sink: Sink<{}>) => void;
export const never: (sink: Sink<{}>) => void;
export const fromList: <A>(list: List<A>) => Source<A>;
export const fromArray: <A>(array: A[]) => Source<A>;
export const fromValue: <A>(value: A) => Source<A>;
export const empty: Source<{}>;
export const never: Source<{}>;
export const map: <A, B>(transform: (value: A) => B) => Operator<A, B>;
export const filter: <A>(predicate: (value: A) => boolean) => Operator<A, A>;
export const scan: <A, B>(accumulator: (acc: B, value: A) => B, initial: B) => Operator<A, B>;
export const map: <A, B>(f: (value: A) => B) => Operator<A, B>;
export const filter: <A>(f: (value: A) => boolean) => Operator<A, A>;
export const scan: <A, B>(f: (acc: B, value: A) => B, acc: B) => Operator<A, B>;
export const merge: <A>(sources: Array<Source<A>>) => (sink: Sink<A>) => void;
export const concat: <A>(sources: Array<Source<A>>) => (sink: Sink<A>) => void;
export const share: <A>(source: Source<A>) => (sink: Sink<A>) => void;
export const combine: <A, B>(a: Source<A>, b: Source<B>) => (sink: Sink<[A, B]>) => void;
export const merge: <A>(sources: Array<Source<A>>) => Source<A>;
export const concat: <A>(sources: Array<Source<A>>) => Source<A>;
export const share: <A>(source: Source<A>) => Source<A>;
export const combine: <A, B>(a: Source<A>, b: Source<B>) => Source<[A, B]>;
export const take: <A>(limit: number) => Operator<A, A>;
export const takeLast: <A>(limit: number) => Operator<A, A>;
export const takeWhile: <A>(predicate: (value: A) => boolean) => Operator<A, A>;
export const take: <A>(max: number) => Operator<A, A>;
export const takeLast: <A>(max: number) => Operator<A, A>;
export const takeWhile: <A>(f: (x: A) => boolean) => Operator<A, A>;
export const takeUntil: <A>(signal: Source<any>) => Operator<A, A>;
export const skip: <A>(limit: number) => Operator<A, A>;
export const skipWhile: <A>(predicate: (value: A) => boolean) => Operator<A, A>;
export const skip: <A>(max: number) => Operator<A, A>;
export const skipWhile: <A>(f: (value: A) => boolean) => Operator<A, A>;
export const skipUntil: <A>(signal: Source<any>) => Operator<A, A>;
export const flatten: <A>(source: Source<Source<A>[]>) => (sink: Sink<A>) => void;
export const flatten: <A>(source: Source<Source<A>>) => Source<A>;
export const forEach: <A>(fn: (value: A) => void, source: Source<A>) => void;
export const subscribe: <A>(fn: (value: A) => void, source: Source<A>) => (() => void);
export const forEach: <A>(f: (x: A) => void) => (source: Source<A>) => void;
export const subscribe: <A>(f: (x: A) => void) => (source: Source<A>) => (() => void);

@@ -9,85 +9,91 @@

function fromList(list_, sink) {
var state = /* record */[
/* value */list_,
/* ended */false,
/* looping */false,
/* pull */false
];
return sink(/* Start */Block.__(0, [(function (signal) {
var match = state[/* looping */2];
if (signal) {
state[/* ended */1] = true;
return /* () */0;
} else if (match) {
state[/* pull */3] = true;
return /* () */0;
} else {
state[/* pull */3] = true;
state[/* looping */2] = true;
while(state[/* pull */3] && !state[/* ended */1]) {
var match$1 = state[/* value */0];
if (match$1) {
state[/* value */0] = match$1[1];
state[/* pull */3] = false;
sink(/* Push */Block.__(1, [match$1[0]]));
function fromList(ls) {
return (function (sink) {
var state = /* record */[
/* value */ls,
/* ended */false,
/* looping */false,
/* pull */false
];
return sink(/* Start */Block.__(0, [(function (signal) {
var match = state[/* looping */2];
if (signal) {
state[/* ended */1] = true;
return /* () */0;
} else if (match) {
state[/* pull */3] = true;
return /* () */0;
} else {
state[/* ended */1] = true;
sink(/* End */0);
state[/* pull */3] = true;
state[/* looping */2] = true;
while(state[/* pull */3] && !state[/* ended */1]) {
var match$1 = state[/* value */0];
if (match$1) {
state[/* value */0] = match$1[1];
state[/* pull */3] = false;
sink(/* Push */Block.__(1, [match$1[0]]));
} else {
state[/* ended */1] = true;
sink(/* End */0);
}
};
state[/* looping */2] = false;
return /* () */0;
}
};
state[/* looping */2] = false;
return /* () */0;
}
})]));
})]));
});
}
function fromArray(arr, sink) {
var size = arr.length;
var state = /* record */[
/* index */0,
/* ended */false,
/* looping */false,
/* pull */false
];
return sink(/* Start */Block.__(0, [(function (signal) {
var match = state[/* looping */2];
if (signal) {
state[/* ended */1] = true;
return /* () */0;
} else if (match) {
state[/* pull */3] = true;
return /* () */0;
} else {
state[/* pull */3] = true;
state[/* looping */2] = true;
while(state[/* pull */3] && !state[/* ended */1]) {
var index = state[/* index */0];
if (index < size) {
var x = arr[index];
state[/* index */0] = index + 1 | 0;
state[/* pull */3] = false;
sink(/* Push */Block.__(1, [x]));
function fromArray(arr) {
return (function (sink) {
var size = arr.length;
var state = /* record */[
/* index */0,
/* ended */false,
/* looping */false,
/* pull */false
];
return sink(/* Start */Block.__(0, [(function (signal) {
var match = state[/* looping */2];
if (signal) {
state[/* ended */1] = true;
return /* () */0;
} else if (match) {
state[/* pull */3] = true;
return /* () */0;
} else {
state[/* ended */1] = true;
sink(/* End */0);
state[/* pull */3] = true;
state[/* looping */2] = true;
while(state[/* pull */3] && !state[/* ended */1]) {
var index = state[/* index */0];
if (index < size) {
var x = arr[index];
state[/* index */0] = index + 1 | 0;
state[/* pull */3] = false;
sink(/* Push */Block.__(1, [x]));
} else {
state[/* ended */1] = true;
sink(/* End */0);
}
};
state[/* looping */2] = false;
return /* () */0;
}
};
state[/* looping */2] = false;
return /* () */0;
}
})]));
})]));
});
}
function fromValue(x, sink) {
var ended = /* record */[/* contents */false];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal || ended[0]) {
return /* () */0;
} else {
ended[0] = true;
sink(/* Push */Block.__(1, [x]));
return sink(/* End */0);
}
})]));
function fromValue(x) {
return (function (sink) {
var ended = /* record */[/* contents */false];
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal || ended[0]) {
return /* () */0;
} else {
ended[0] = true;
sink(/* Push */Block.__(1, [x]));
return sink(/* End */0);
}
})]));
});
}

@@ -104,120 +110,136 @@

function map(f, source, sink) {
return Curry._1(source, (function (signal) {
var tmp;
tmp = typeof signal === "number" ? /* End */0 : (
signal.tag ? /* Push */Block.__(1, [Curry._1(f, signal[0])]) : /* Start */Block.__(0, [signal[0]])
);
return sink(tmp);
}));
function map(f) {
return (function (source) {
return (function (sink) {
return Curry._1(source, (function (signal) {
var tmp;
tmp = typeof signal === "number" ? /* End */0 : (
signal.tag ? /* Push */Block.__(1, [Curry._1(f, signal[0])]) : /* Start */Block.__(0, [signal[0]])
);
return sink(tmp);
}));
});
});
}
function filter(f, source, sink) {
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && !Curry._1(f, signal[0]))) {
return sink(signal);
} else {
return talkback(/* Pull */0);
}
}));
function filter(f) {
return (function (source) {
return (function (sink) {
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && !Curry._1(f, signal[0]))) {
return sink(signal);
} else {
return talkback(/* Pull */0);
}
}));
});
});
}
function scan(f, seed, source, sink) {
var acc = /* record */[/* contents */seed];
return Curry._1(source, (function (signal) {
var tmp;
function scan(f, seed) {
return (function (source) {
return (function (sink) {
var acc = /* record */[/* contents */seed];
return Curry._1(source, (function (signal) {
var tmp;
if (typeof signal === "number") {
tmp = /* End */0;
} else if (signal.tag) {
acc[0] = Curry._2(f, acc[0], signal[0]);
tmp = /* Push */Block.__(1, [acc[0]]);
} else {
tmp = /* Start */Block.__(0, [signal[0]]);
}
return sink(tmp);
}));
});
});
}
function merge(sources) {
return (function (sink) {
var size = sources.length;
var talkbacks = Array_js.make(size, Wonka_helpers.talkbackPlaceholder);
var state = /* record */[
/* started */0,
/* ended */0
];
var talkback = function (signal) {
var _i = 0;
while(true) {
var i = _i;
if (i < size) {
talkbacks[i](signal);
_i = i + 1 | 0;
continue ;
} else {
return 0;
}
};
};
var _i = 0;
while(true) {
var i = _i;
if (i < size) {
var source = sources[i];
Curry._1(source, (function(i){
return function (signal) {
if (typeof signal === "number") {
tmp = /* End */0;
state[/* ended */1] = state[/* ended */1] + 1 | 0;
if (state[/* ended */1] === size) {
return sink(/* End */0);
} else {
return 0;
}
} else if (signal.tag) {
acc[0] = Curry._2(f, acc[0], signal[0]);
tmp = /* Push */Block.__(1, [acc[0]]);
return sink(signal);
} else {
tmp = /* Start */Block.__(0, [signal[0]]);
talkbacks[i] = signal[0];
state[/* started */0] = state[/* started */0] + 1 | 0;
if (state[/* started */0] === size) {
return sink(/* Start */Block.__(0, [talkback]));
} else {
return 0;
}
}
return sink(tmp);
}));
}
function merge(sources, sink) {
var size = sources.length;
var talkbacks = Array_js.make(size, Wonka_helpers.talkbackPlaceholder);
var state = /* record */[
/* started */0,
/* ended */0
];
var talkback = function (signal) {
var _i = 0;
while(true) {
var i = _i;
if (i < size) {
talkbacks[i](signal);
_i = i + 1 | 0;
continue ;
} else {
return 0;
}
};
};
var _i = 0;
while(true) {
var i = _i;
if (i < size) {
var source = sources[i];
Curry._1(source, (function(i){
return function (signal) {
if (typeof signal === "number") {
state[/* ended */1] = state[/* ended */1] + 1 | 0;
if (state[/* ended */1] === size) {
return sink(/* End */0);
} else {
return 0;
}
} else if (signal.tag) {
return sink(signal);
} else {
talkbacks[i] = signal[0];
state[/* started */0] = state[/* started */0] + 1 | 0;
if (state[/* started */0] === size) {
return sink(/* Start */Block.__(0, [talkback]));
} else {
return 0;
}
}
}
}(i)));
_i = i + 1 | 0;
continue ;
} else {
return 0;
}
};
}(i)));
_i = i + 1 | 0;
continue ;
} else {
return 0;
}
};
});
}
function concat(sources, sink) {
var size = sources.length;
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
var nextSource = function (i) {
if (i < size) {
var source = sources[i];
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
return nextSource(i + 1 | 0);
} else if (signal.tag) {
return sink(signal);
} else {
var tb = signal[0];
talkback[0] = tb;
if (i === 0) {
sink(/* Start */Block.__(0, [(function (signal) {
return talkback[0](signal);
})]));
}
return tb(/* Pull */0);
}
}));
} else {
return sink(/* End */0);
}
};
return nextSource(0);
function concat(sources) {
return (function (sink) {
var size = sources.length;
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
var nextSource = function (i) {
if (i < size) {
var source = sources[i];
return Curry._1(source, (function (signal) {
if (typeof signal === "number") {
return nextSource(i + 1 | 0);
} else if (signal.tag) {
return sink(signal);
} else {
var tb = signal[0];
talkback[0] = tb;
if (i === 0) {
sink(/* Start */Block.__(0, [(function (signal) {
return talkback[0](signal);
})]));
}
return tb(/* Pull */0);
}
}));
} else {
return sink(/* End */0);
}
};
return nextSource(0);
});
}

@@ -273,431 +295,467 @@

function combine(sourceA, sourceB, sink) {
var state = /* record */[
/* talkbackA */Wonka_helpers.talkbackPlaceholder,
/* talkbackB */Wonka_helpers.talkbackPlaceholder,
/* lastValA */undefined,
/* lastValB */undefined,
/* gotSignal */false,
/* endCounter */0,
/* ended */false
];
Curry._1(sourceA, (function (signal) {
var match = state[/* lastValB */3];
if (typeof signal === "number") {
if (state[/* endCounter */5] < 1) {
state[/* endCounter */5] = state[/* endCounter */5] + 1 | 0;
return /* () */0;
} else if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* ended */6] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
var a = signal[0];
if (match !== undefined) {
if (state[/* ended */6]) {
function combine(sourceA, sourceB) {
return (function (sink) {
var state = /* record */[
/* talkbackA */Wonka_helpers.talkbackPlaceholder,
/* talkbackB */Wonka_helpers.talkbackPlaceholder,
/* lastValA */undefined,
/* lastValB */undefined,
/* gotSignal */false,
/* endCounter */0,
/* ended */false
];
Curry._1(sourceA, (function (signal) {
var match = state[/* lastValB */3];
if (typeof signal === "number") {
if (state[/* endCounter */5] < 1) {
state[/* endCounter */5] = state[/* endCounter */5] + 1 | 0;
return /* () */0;
} else if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* ended */6] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
var a = signal[0];
if (match !== undefined) {
if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* lastValA */2] = Caml_option.some(a);
state[/* gotSignal */4] = false;
return sink(/* Push */Block.__(1, [/* tuple */[
a,
Caml_option.valFromOption(match)
]]));
}
} else {
state[/* lastValA */2] = Caml_option.some(a);
state[/* gotSignal */4] = false;
return /* () */0;
}
} else {
state[/* talkbackA */0] = signal[0];
return /* () */0;
}
}));
Curry._1(sourceB, (function (signal) {
var match = state[/* lastValA */2];
if (typeof signal === "number") {
if (state[/* endCounter */5] < 1) {
state[/* endCounter */5] = state[/* endCounter */5] + 1 | 0;
return /* () */0;
} else if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* ended */6] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
var b = signal[0];
if (match !== undefined) {
if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* lastValB */3] = Caml_option.some(b);
state[/* gotSignal */4] = false;
return sink(/* Push */Block.__(1, [/* tuple */[
Caml_option.valFromOption(match),
b
]]));
}
} else {
state[/* lastValB */3] = Caml_option.some(b);
state[/* gotSignal */4] = false;
return /* () */0;
}
} else {
state[/* lastValA */2] = Caml_option.some(a);
state[/* gotSignal */4] = false;
return sink(/* Push */Block.__(1, [/* tuple */[
a,
Caml_option.valFromOption(match)
]]));
}
} else {
state[/* lastValA */2] = Caml_option.some(a);
state[/* gotSignal */4] = false;
return /* () */0;
}
} else {
state[/* talkbackA */0] = signal[0];
return /* () */0;
}
}));
Curry._1(sourceB, (function (signal) {
var match = state[/* lastValA */2];
if (typeof signal === "number") {
if (state[/* endCounter */5] < 1) {
state[/* endCounter */5] = state[/* endCounter */5] + 1 | 0;
return /* () */0;
} else if (state[/* ended */6]) {
return /* () */0;
} else {
state[/* ended */6] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
var b = signal[0];
if (match !== undefined) {
if (state[/* ended */6]) {
state[/* talkbackB */1] = signal[0];
return /* () */0;
} else {
state[/* lastValB */3] = Caml_option.some(b);
state[/* gotSignal */4] = false;
return sink(/* Push */Block.__(1, [/* tuple */[
Caml_option.valFromOption(match),
b
]]));
}
} else {
state[/* lastValB */3] = Caml_option.some(b);
state[/* gotSignal */4] = false;
return /* () */0;
}
} else {
state[/* talkbackB */1] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (state[/* ended */6]) {
return 0;
} else if (signal) {
state[/* ended */6] = true;
state[/* talkbackA */0](/* Close */1);
return state[/* talkbackB */1](/* Close */1);
} else if (state[/* gotSignal */4]) {
return /* () */0;
} else {
state[/* gotSignal */4] = true;
state[/* talkbackA */0](signal);
return state[/* talkbackB */1](signal);
}
})]));
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (state[/* ended */6]) {
return 0;
} else if (signal) {
state[/* ended */6] = true;
state[/* talkbackA */0](/* Close */1);
return state[/* talkbackB */1](/* Close */1);
} else if (state[/* gotSignal */4]) {
return /* () */0;
} else {
state[/* gotSignal */4] = true;
state[/* talkbackA */0](signal);
return state[/* talkbackB */1](signal);
}
})]));
});
}
function take(max, source, sink) {
var state = /* record */[
/* taken */0,
/* talkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* taken */0] < max) {
state[/* taken */0] = max;
return sink(/* End */0);
} else {
return /* () */0;
}
} else if (signal.tag) {
if (state[/* taken */0] < max) {
state[/* taken */0] = state[/* taken */0] + 1 | 0;
sink(signal);
if (state[/* taken */0] === max) {
sink(/* End */0);
return state[/* talkback */1](/* Close */1);
} else {
return 0;
}
} else {
return /* () */0;
}
} else {
state[/* talkback */1] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
function take(max) {
return (function (source) {
return (function (sink) {
var state = /* record */[
/* taken */0,
/* talkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* taken */0] < max) {
if (signal) {
state[/* taken */0] = max;
state[/* taken */0] = max;
return sink(/* End */0);
} else {
return /* () */0;
}
} else if (signal.tag) {
if (state[/* taken */0] < max) {
state[/* taken */0] = state[/* taken */0] + 1 | 0;
sink(signal);
if (state[/* taken */0] === max) {
sink(/* End */0);
return state[/* talkback */1](/* Close */1);
} else {
return state[/* talkback */1](/* Pull */0);
return 0;
}
} else {
return 0;
return /* () */0;
}
})]));
} else {
state[/* talkback */1] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (state[/* taken */0] < max) {
if (signal) {
state[/* taken */0] = max;
return state[/* talkback */1](/* Close */1);
} else {
return state[/* talkback */1](/* Pull */0);
}
} else {
return 0;
}
})]));
});
});
}
function takeLast(max, source, sink) {
var queue = new Array();
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number") {
return Wonka_helpers.makeTrampoline(sink, (function () {
return queue.shift();
}));
} else if (signal.tag) {
var size = queue.length;
if (size >= max && max > 0) {
queue.shift();
}
queue.push(signal[0]);
return talkback(/* Pull */0);
} else {
return talkback(/* Pull */0);
}
}));
function takeLast(max) {
return (function (source) {
return (function (sink) {
var queue = new Array();
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number") {
return Wonka_helpers.makeTrampoline(sink, (function () {
return queue.shift();
}));
} else if (signal.tag) {
var size = queue.length;
if (size >= max && max > 0) {
queue.shift();
}
queue.push(signal[0]);
return talkback(/* Pull */0);
} else {
return talkback(/* Pull */0);
}
}));
});
});
}
function takeWhile(predicate, source, sink) {
var ended = /* record */[/* contents */false];
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (ended[0]) {
return /* () */0;
} else {
ended[0] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
if (ended[0]) {
return /* () */0;
} else if (Curry._1(predicate, signal[0])) {
return sink(signal);
} else {
ended[0] = true;
sink(/* End */0);
return talkback[0](/* Close */1);
}
} else {
talkback[0] = signal[0];
return sink(signal);
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
function takeWhile(predicate) {
return (function (source) {
return (function (sink) {
var ended = /* record */[/* contents */false];
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (ended[0]) {
return 0;
} else if (signal) {
return /* () */0;
} else {
ended[0] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
if (ended[0]) {
return /* () */0;
} else if (Curry._1(predicate, signal[0])) {
return sink(signal);
} else {
ended[0] = true;
sink(/* End */0);
return talkback[0](/* Close */1);
} else {
return talkback[0](/* Pull */0);
}
})]));
} else {
talkback[0] = signal[0];
return sink(signal);
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (ended[0]) {
return 0;
} else if (signal) {
ended[0] = true;
return talkback[0](/* Close */1);
} else {
return talkback[0](/* Pull */0);
}
})]));
});
});
}
function takeUntil(notifier, source, sink) {
var state = /* record */[
/* ended */false,
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* notifierTalkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* ended */0]) {
return /* () */0;
} else {
state[/* notifierTalkback */2](/* Close */1);
state[/* ended */0] = true;
return sink(/* End */0);
}
} else if (signal.tag) {
if (state[/* ended */0]) {
return /* () */0;
} else {
return sink(signal);
}
} else {
state[/* sourceTalkback */1] = signal[0];
return Curry._1(notifier, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
state[/* ended */0] = true;
state[/* notifierTalkback */2](/* Close */1);
state[/* sourceTalkback */1](/* Close */1);
return sink(/* End */0);
} else {
var innerTb = signal[0];
state[/* notifierTalkback */2] = innerTb;
return innerTb(/* Pull */0);
}
}));
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
function takeUntil(notifier) {
return (function (source) {
return (function (sink) {
var state = /* record */[
/* ended */false,
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* notifierTalkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* ended */0]) {
return 0;
} else if (signal) {
state[/* sourceTalkback */1](/* Close */1);
return state[/* notifierTalkback */2](/* Close */1);
return /* () */0;
} else {
return state[/* sourceTalkback */1](/* Pull */0);
state[/* notifierTalkback */2](/* Close */1);
state[/* ended */0] = true;
return sink(/* End */0);
}
})]));
} else if (signal.tag) {
if (state[/* ended */0]) {
return /* () */0;
} else {
return sink(signal);
}
} else {
state[/* sourceTalkback */1] = signal[0];
return Curry._1(notifier, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
state[/* ended */0] = true;
state[/* notifierTalkback */2](/* Close */1);
state[/* sourceTalkback */1](/* Close */1);
return sink(/* End */0);
} else {
var innerTb = signal[0];
state[/* notifierTalkback */2] = innerTb;
return innerTb(/* Pull */0);
}
}));
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (state[/* ended */0]) {
return 0;
} else if (signal) {
state[/* sourceTalkback */1](/* Close */1);
return state[/* notifierTalkback */2](/* Close */1);
} else {
return state[/* sourceTalkback */1](/* Pull */0);
}
})]));
});
});
}
function skip(wait, source, sink) {
var rest = /* record */[/* contents */wait];
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && rest[0] > 0)) {
return sink(signal);
} else {
rest[0] = rest[0] - 1 | 0;
return talkback(/* Pull */0);
}
}));
function skip(wait) {
return (function (source) {
return (function (sink) {
var rest = /* record */[/* contents */wait];
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && rest[0] > 0)) {
return sink(signal);
} else {
rest[0] = rest[0] - 1 | 0;
return talkback(/* Pull */0);
}
}));
});
});
}
function skipWhile(predicate, source, sink) {
var skip = /* record */[/* contents */true];
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && skip[0])) {
return sink(signal);
} else if (Curry._1(predicate, signal[0])) {
return talkback(/* Pull */0);
} else {
skip[0] = false;
return sink(signal);
}
}));
function skipWhile(predicate) {
return (function (source) {
return (function (sink) {
var skip = /* record */[/* contents */true];
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number" || !(signal.tag && skip[0])) {
return sink(signal);
} else if (Curry._1(predicate, signal[0])) {
return talkback(/* Pull */0);
} else {
skip[0] = false;
return sink(signal);
}
}));
});
});
}
function skipUntil(notifier, source, sink) {
var state = /* record */[
/* skip */true,
/* ended */false,
/* gotSignal */false,
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* notifierTalkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* skip */0]) {
state[/* notifierTalkback */4](/* Close */1);
}
state[/* ended */1] = true;
return sink(/* End */0);
} else if (signal.tag) {
if (state[/* skip */0] && !state[/* ended */1]) {
return state[/* sourceTalkback */3](/* Pull */0);
} else if (state[/* ended */1]) {
return /* () */0;
} else {
state[/* gotSignal */2] = false;
return sink(signal);
}
} else {
var tb = signal[0];
state[/* sourceTalkback */3] = tb;
return Curry._1(notifier, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
state[/* skip */0] = false;
return state[/* notifierTalkback */4](/* Close */1);
} else {
var innerTb = signal[0];
state[/* notifierTalkback */4] = innerTb;
innerTb(/* Pull */0);
return tb(/* Pull */0);
}
}));
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
if (state[/* skip */0]) {
state[/* notifierTalkback */4](/* Close */1);
}
state[/* ended */1] = true;
return state[/* sourceTalkback */3](/* Close */1);
} else if (!state[/* gotSignal */2] && !state[/* ended */1]) {
state[/* gotSignal */2] = true;
function skipUntil(notifier) {
return (function (source) {
return (function (sink) {
var state = /* record */[
/* skip */true,
/* ended */false,
/* gotSignal */false,
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* notifierTalkback */Wonka_helpers.talkbackPlaceholder
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* skip */0]) {
state[/* notifierTalkback */4](/* Close */1);
}
state[/* ended */1] = true;
return sink(/* End */0);
} else if (signal.tag) {
if (state[/* skip */0] && !state[/* ended */1]) {
return state[/* sourceTalkback */3](/* Pull */0);
} else if (state[/* ended */1]) {
return /* () */0;
} else {
return /* () */0;
state[/* gotSignal */2] = false;
return sink(signal);
}
})]));
} else {
var tb = signal[0];
state[/* sourceTalkback */3] = tb;
return Curry._1(notifier, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
state[/* skip */0] = false;
return state[/* notifierTalkback */4](/* Close */1);
} else {
var innerTb = signal[0];
state[/* notifierTalkback */4] = innerTb;
innerTb(/* Pull */0);
return tb(/* Pull */0);
}
}));
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
if (state[/* skip */0]) {
state[/* notifierTalkback */4](/* Close */1);
}
state[/* ended */1] = true;
return state[/* sourceTalkback */3](/* Close */1);
} else if (!state[/* gotSignal */2] && !state[/* ended */1]) {
state[/* gotSignal */2] = true;
return state[/* sourceTalkback */3](/* Pull */0);
} else {
return /* () */0;
}
})]));
});
});
}
function flatten(source, sink) {
var state = /* record */[
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* innerTalkback */Wonka_helpers.talkbackPlaceholder,
/* sourceEnded */false,
/* innerEnded */true
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* innerEnded */3]) {
return sink(/* End */0);
} else {
state[/* sourceEnded */2] = true;
return /* () */0;
}
} else if (signal.tag) {
var innerSource = signal[0];
return Curry._1(innerSource, (function (signal) {
if (typeof signal === "number") {
if (state[/* sourceEnded */2]) {
return state[/* sourceTalkback */0](/* Close */1);
} else {
state[/* innerEnded */3] = true;
return state[/* sourceTalkback */0](/* Pull */0);
}
} else if (signal.tag) {
return sink(signal);
} else {
var tb = signal[0];
if (!state[/* innerEnded */3]) {
state[/* innerTalkback */1](/* Close */1);
}
state[/* innerEnded */3] = false;
state[/* innerTalkback */1] = tb;
return tb(/* Pull */0);
}
}));
} else {
state[/* sourceTalkback */0] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* sourceTalkback */0](/* Close */1);
return state[/* innerTalkback */1](/* Close */1);
} else if (!state[/* innerEnded */3] && !state[/* sourceEnded */2]) {
return state[/* innerTalkback */1](/* Pull */0);
} else if (state[/* sourceEnded */2]) {
function flatten(source) {
return (function (sink) {
var state = /* record */[
/* sourceTalkback */Wonka_helpers.talkbackPlaceholder,
/* innerTalkback */Wonka_helpers.talkbackPlaceholder,
/* sourceEnded */false,
/* innerEnded */true
];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
if (state[/* innerEnded */3]) {
return sink(/* End */0);
} else {
state[/* sourceEnded */2] = true;
return /* () */0;
}
} else if (signal.tag) {
var innerSource = signal[0];
return Curry._1(innerSource, (function (signal) {
if (typeof signal === "number") {
if (state[/* sourceEnded */2]) {
return state[/* sourceTalkback */0](/* Close */1);
} else {
state[/* innerEnded */3] = true;
return state[/* sourceTalkback */0](/* Pull */0);
}
} else if (signal.tag) {
return sink(signal);
} else {
var tb = signal[0];
if (!state[/* innerEnded */3]) {
state[/* innerTalkback */1](/* Close */1);
}
state[/* innerEnded */3] = false;
state[/* innerTalkback */1] = tb;
return tb(/* Pull */0);
}
}));
} else {
state[/* sourceTalkback */0] = signal[0];
return /* () */0;
}
}));
return sink(/* Start */Block.__(0, [(function (signal) {
if (signal) {
state[/* sourceTalkback */0](/* Close */1);
return state[/* innerTalkback */1](/* Close */1);
} else if (!state[/* innerEnded */3] && !state[/* sourceEnded */2]) {
return state[/* innerTalkback */1](/* Pull */0);
} else if (state[/* sourceEnded */2]) {
return /* () */0;
} else {
return state[/* sourceTalkback */0](/* Pull */0);
}
})]));
});
}
function forEach(f) {
return (function (source) {
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
Curry._1(f, signal[0]);
return talkback(/* Pull */0);
} else {
return state[/* sourceTalkback */0](/* Pull */0);
return talkback(/* Pull */0);
}
})]));
}));
});
}
function forEach(f, source) {
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) {
if (typeof signal === "number") {
function subscribe(f) {
return (function (source) {
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
var ended = /* record */[/* contents */false];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
if (ended[0]) {
return /* () */0;
} else if (signal.tag) {
} else {
Curry._1(f, signal[0]);
return talkback(/* Pull */0);
} else {
return talkback(/* Pull */0);
return talkback[0](/* Pull */0);
}
}));
}
function subscribe(f, source) {
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder];
var ended = /* record */[/* contents */false];
Curry._1(source, (function (signal) {
if (typeof signal === "number") {
return /* () */0;
} else if (signal.tag) {
if (ended[0]) {
return /* () */0;
} else {
Curry._1(f, signal[0]);
return talkback[0](/* Pull */0);
}
} else {
talkback[0] = signal[0];
return talkback[0](/* Pull */0);
}
}));
return (function (param) {
if (ended[0]) {
return 0;
} else {
talkback[0] = signal[0];
return talkback[0](/* Pull */0);
ended[0] = true;
return talkback[0](/* Close */1);
}
}));
return (function (param) {
if (ended[0]) {
return 0;
} else {
ended[0] = true;
return talkback[0](/* Close */1);
}
});
});

@@ -704,0 +762,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc