-
Notifications
You must be signed in to change notification settings - Fork 562
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
Desugar do-notation into Applicative operations (ApplicativeDo) #2435
Comments
I would rather add an |
I agree, with all the possible dodgyness, it would be nicer to have a special syntax form. This would avoid all the compatibility problems and make a release much-much safer.
I wouldn't have thought that this would be a problem unless with Haxl-like (or just any dodgy) type whose The rules used in the paper never explicitly reorder the statements (which could be useful for getting better parallel-block splitting). I understand that this kind of reordering is not the same as effect/evaluation order that you are talking about (I guess).
It might be quite fun to also have intentional reorderings under a commutative constraint of some sort... |
Even with |
Ah, true. I now actually recall hitting such things a few times. Thanks. |
On this front: I would suggest avoiding the ado
x <- foo
y <- bar
in x + y |
The paper describes many details and all that is easily mapped to purescript.
Essentially the process of desugaring is about splitting the do-notation statements into subsequences (parallel blocks) in such a way that the blocks don't share any binders. Those parallel blocks are then combined with
map
,apply
andjoin
.That allows to make use of all the applicative benefits while still being able to use do-notation sugar.
It comes at cost of making do-notation desugaring much harder for understanding, though you could still use the simple
bind
desugaring as a mental model until you need to know more.This would cause some breaking changes too:
map
andapply
would have to be added in relevant places;bind
, but now you'd have to also define themap
andapply
;apply
's semantic differs fromap
's the meaning of a program might get changed.The text was updated successfully, but these errors were encountered: