-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack safety bug #26
Comments
Yup this is a bug. |
@tusharmath it is generated by the eager optimization of pure values introduced to improve perf of sync cases that basically skip the driver altogether: I ended up removing it too a while ago |
To help me understand the scope of the issue @tusharmath @mikearnaldi - is this only when used in recursive functions, or is it possible to blow the stack say by traversing a large enough collection? |
@beezee traverse should not trigger that case, folding would |
Thanks @mikearnaldi - so applicative is stack safe, and monad is not? This means that normal use of the monadic context will blow the stack in a large enough composition of kleisli arrows? |
@beezee the problem is where it forms recursion per se Monad is not unsafe as doing 100.000 .chain in a while loop is perfectly safe but basically sync map & chain are not suspended and eagerly evaluated so if you get in a situation like |
Got it thank you |
Apologies, I haven't confirmed this myself but it looks credible.
Would love to know if this is easily addressable since I'm getting ready to put QIO in place as the main evaluation context in a fairly large application, with one primary driver being stack safety.
From this discussion thread - https://functionalprogramming.slack.com/archives/C7BBY9A95/p1604439126428300?thread_ts=1603574914.302900&cid=C7BBY9A95
it appears the following code would blow the call stack
The text was updated successfully, but these errors were encountered: