-
-
Save Raynos/b562da97d7275ed9153c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// map:: (A -> B) -> Signal<A> -> Signal<B> | |
function map(lambda) { return function duplex(source) { | |
return function signal(next, end) { | |
signal(function(value) { | |
var sink = next(value) | |
return sink ? rest(duplex, sink) : null | |
}, end) | |
} | |
} } | |
// rest :: (Signal<A> -> Signal<B>) -> Sink<B> -> Sink<A> | |
function rest(duplex, sink) { | |
return function continuable(signal) { | |
sink(duplex(signal)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment