DrBoolean / freeky

Free monad Collection
MIT License
176 stars 15 forks source link

Monads that yield a value more than once #13

Open kwijibo opened 8 years ago

kwijibo commented 8 years ago

Monad.do doesn't seem to allow for Streams that yield more than once If you change asyncGet in example.js to:

const asyncGet = n =>
  Cont((rej, res) => setInterval(() => res(n), 100))

(ie, setInterval instead of setTimeout) It bombs out with:

./node_modules/freeky/free.js:49
          return next(result).foldMap(interpreter, of)
                             ^

TypeError: Cannot read property 'foldMap' of undefined
safareli commented 8 years ago

check this to understand limitations of the do freeky#4