Skip to content

Inconsistent behaviour when using Eval as Applicative #4553

Answered by armanbilge
nzpr asked this question in Q&A
Discussion options

You must be logged in to vote

Eval is for stack-safety of pure computation. Unlike IO, Eval is not for suspending side-effects. So if you are discarding the result of Eval e.g. with void then there is no purpose to run that computation. Because the computation should be pure and have no side-effects you would not notice that it didn't run. So it is an optimization to not run it.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@johnynek
Comment options

Answer selected by nzpr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #4552 on January 23, 2024 14:53.