Description
I am experiencing this issue in the "debounce" test case for purescript-redux-saga (https://github.com/felixSchl/purescript-redux-saga/blob/master/test/Main.purs#L291-L316).
I have done a bit of digging and found that runPar
s kill
function returns an object, instead of a function. Somewhere the output of that gets assigned to an index in kills
(I'll have to dig again to find where that happened when I get the chance, maybe later today). But the cancel
function expects all entries in kill to be functions.
I've managed to "fix" the problem (that is: not have it crash, not sure if correct), by doing this:
function recKill(kills) {
for (var kid in kills) {
if (kills.hasOwnProperty(kid)) {
if (typeof kills[kid] === 'function') {
kills[kid]();
} else {
recKill(kills[kid]);
}
}
}
}
I am sure that "fix" is incorrect so I won't bother with a PR for now.
To see this error occur, you can clone purescript-redux-saga and run pulp test
.
Edit: For completeness sake, here is a stack trace:
/Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:504
throw util.fromLeft(fail);
^
TypeError: kills[kid] is not a function
at cancel (/Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:947:21)
at /Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:973:18
at runAsync (/Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:98:20)
at run (/Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:324:22)
at /Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:576:13
at kill (/Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:189:15)
at /Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:195:15
at runAsync (/Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:98:20)
at run (/Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:324:22)
at Object.run (/Users/felix/projects/purescript-redux-saga/output/Control.Monad.Aff/foreign.js:621:13)