Mirror: 馃帺 A tiny but capable push & pull stream library for TypeScript and Flow
at v3.2.2 359 B view raw
1open Wonka_types; 2 3let scan = (f, seed) => 4 curry(source => 5 curry(sink => { 6 let acc = ref(seed); 7 8 source((. signal) => 9 sink(. 10 switch (signal) { 11 | Push(x) => 12 acc := f(. acc^, x); 13 Push(acc^); 14 | Start(x) => Start(x) 15 | End => End 16 }, 17 ) 18 ); 19 }) 20 );