-
Notifications
You must be signed in to change notification settings - Fork 0
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
Evaluation order of side effect within let bindings #3
Comments
At the moment, the plugin re-orders let-expressions. This is sometimes required, as can be seen by the following example: test :: ()
test = let x = print i
i = (let _ = putStrLn "i" in 1)
in x What would you expect for the effect order here? For simpler cases however, we could make sure that the effect order is top to bottom. |
My example originated from the list comprehension example (where the order is hopefully left-to-right as soon as list comprehensions work). Having top-to-bottom for some cases and for others not seems not better to me. I wonder what is the right way to sequence computations then? Singleton let expressions? |
In List comprehensions, at least each |
As long as there is a possiblity to enforce a certain evaluation order, perhaps we do not need to put extra effort into this matter. Also, I do not know how a transformation of let expressions to achieve a certain order of evaluation would effect other Language-Plugins. Since we want a somehow genera approach, it seems sufficient for me to be able to use single-lets (at least I could live with it). We already state that we do have to make sacrifices regarding the syntax. ;) |
We decided to forbid a user from writing let-expressions with either
|
I wondered if there is any way to guarantee an evaluation order of side effects within let bindings in an expression like
[let {i = 1; _ = putStrLn "Name?"; name = getLine } in name]
. Currently, thegetLine
is executed before theputStrLn
(which was not what I intended ^^).The text was updated successfully, but these errors were encountered: