Skip to content
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

Add the let* monadic notation #96

Merged
merged 1 commit into from
Aug 6, 2020
Merged

Conversation

lthms
Copy link
Member

@lthms lthms commented Aug 6, 2020

Closes #95

Inspired by the notation introduced by OCaml 4.08, we propose to
introduce a new notation following the same principle.

    let* x := p in q

is strictly equivalent to

    x <- p;; q

Copy link
Member

@liyishuai liyishuai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For compatibility, please create a separate module (e.g. MonadLetNotation), so that importing MonadNotation doesn't introduce two styles of notations at the same time.

@lthms
Copy link
Member Author

lthms commented Aug 6, 2020

Sorry, I misunderstood your comment on the issue.

I was not sure how to proceed, so I propose two approach:

  • Always load _ <- _ ;; _, and load let* _ := _ in _ if desired (first commit)
  • Load either one or the other (second commit)

I personally prefer the latter, and it does not break the previous interface afaict. What do you think?

@liyishuai
Copy link
Member

Thanks! The latter with MonadBaseNotation looks better. I'll try to figure out how to make CI happy.

@lthms
Copy link
Member Author

lthms commented Aug 6, 2020

The failure with the CI was due to a commit I had added which was breaking old Coq version (declaring the scope). I have removed it and now it appears that it works fine.

I should probably squash the two commits together if you prefer the approach with the base module (I do too! (: ). I think it would probably be wise to add some kind of test case too, right?

@liyishuai
Copy link
Member

Yes we could add some Notation.v under /examples.

@lthms
Copy link
Member Author

lthms commented Aug 6, 2020

I think we are good to go now!

Inspired by the notation introduced by OCaml 4.08, we propose to
introduce a new notation following the same principle.

    let* x := p in q

is strictly equivalent to

    x <- p;; q

The former can be made available by importing the newly introduced
[MonadLetNotation]. Loading this module does not provide the
arrow-based notation, which can still be made available by importing
the [MonadNotation] module as before.
@liyishuai liyishuai merged commit 1ced8f6 into coq-community:master Aug 6, 2020
@github-pages github-pages bot temporarily deployed to github-pages August 6, 2020 09:47 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the let* monadic notation
2 participants