Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bind notation with type annotation #174

Closed
alxest opened this issue Jun 6, 2020 · 3 comments
Closed

Bind notation with type annotation #174

alxest opened this issue Jun 6, 2020 · 3 comments

Comments

@alxest
Copy link

alxest commented Jun 6, 2020

In usual Coq development, it is often useful to annotate a variable with its type (for better readability, error localization, better inference, etc), like:

Check (exists n, n = 0).
Check (exists (n: Z), n = 0).

Can we do similar thing with bind notation? like:

Check (x <- Ret tt ;; Ret x).
Check ((x: unit) <- Ret tt; Ret x).

My current workaround is like this:

Check (x <- Ret tt ;; let _ := x: unit in Ret x).
@YaZko
Copy link
Collaborator

YaZko commented Jun 6, 2020

We could certainly add another notation. The trivial PR #175 would allow you to write:

Import ITreeNotations.
Definition foo := unit.
Check (x <- Ret tt ;; Ret x).
Check (`x: foo <- Ret tt;; Ret x).

Note the necessary back-tick, as far as I can tell without it that would break all other type annotations.

@Lysxia
Copy link
Collaborator

Lysxia commented Jun 6, 2020

@alxest is that a good fix for you?

@alxest
Copy link
Author

alxest commented Jun 6, 2020

@YaZko @Lysxia Yes, it works well for me. Thanks a lot!
I will close the issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants