Running this snippet results in RangeError: Maximum call stack size exceeded:
const Identity = require('fantasy-identities')
const Free = require('@safareli/free')
const runTimes = (n) => (v) => {
console.log(v);
const res = Free.liftF(n)
if (n == 0){
return res
}
return res.chain(runTimes(n-1))
}
console.log(runTimes(1000000)().foldMap(Identity,Identity))
Running this snippet results in
RangeError: Maximum call stack size exceeded: