-
Notifications
You must be signed in to change notification settings - Fork 380
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
[ fix #758 ] desugar non-binding sequencing in do blocks to (>>) #1095
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buzden
reviewed
Feb 20, 2021
The silent expansion of ```idris do p q ``` to ``` p >>= \ _ => q ``` acted like a pattern-synonym when building these grammars and thus did not get in the way of termination / productivity checking. When we introduce (>>), it breaks this convenient feature and to recover it we need to introduce new constructors. It's unfortunate but not too much trouble.
gallais
changed the title
[ fix #758 ] desugar to (>>)
[ fix #758 ] desugar non-binding sequencing in do blocks to (>>)
Feb 20, 2021
This seems like quite a disruptive change, doesn't it break backward compatibility too? Not having to bind resulting values from in do block was a nice quality of life feature that we lose. |
Yes. On the other hand, it helps inference and you get a warning when |
alexhumphreys
pushed a commit
to alexhumphreys/idrall
that referenced
this pull request
Mar 9, 2021
includes fixes for unbound returns in `do` blocks, and some missing Lazy annotations. The `do` block fixes were needed after idris-lang/Idris2#1095 was merged. could also use `ignore` for this rather than `_ <- foo` Signed-off-by: Alex Humphreys <[email protected]>
trevarj
added a commit
to trevarj/Idris2
that referenced
this pull request
Jan 30, 2022
There is a difference between idris1 and idris2 which breaks backwards compatibility when trying to implement `(>>=)` to use `do` notation for a custom type. See idris-lang#1095 for details.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of desugaring do blocks using
>>=
only i.e. elaboratingto
we make sure that non-binding sequencing uses
(>>)
and get:This allows us to have a special
>>
that, for instance, is compatiblewith a linear bind by enforcing that its first argument returns
()
,a value easily consumed.