This commit is contained in:
Leo Horie 2016-09-23 22:49:20 -04:00
parent fd4284f5a2
commit 8c5fd9ec25
10 changed files with 248 additions and 286 deletions

View file

@ -7,13 +7,13 @@ module.exports = function(log) {
if (arguments.length > 0 && arguments[0] !== HALT) updateStream(stream, arguments[0], undefined)
return stream._state.value
}
initStream(stream, arguments)
initStream(stream)
if (arguments.length > 0 && arguments[0] !== HALT) updateStream(stream, arguments[0], undefined)
return stream
}
function initStream(stream, args) {
function initStream(stream) {
stream.constructor = createStream
stream._state = {id: guid++, value: undefined, error: undefined, state: 0, derive: undefined, recover: undefined, deps: {}, parents: [], errorStream: undefined, endStream: undefined}
stream.map = map, stream.ap = ap, stream.of = createStream
@ -27,7 +27,7 @@ module.exports = function(log) {
if (arguments.length > 0 && arguments[0] !== HALT) updateStream(stream, undefined, arguments[0])
return stream._state.error
}
initStream(errorStream, [])
initStream(errorStream)
initDependency(errorStream, [stream], noop, noop)
stream._state.errorStream = errorStream
}