DeepSpec / InteractionTrees

A Library for Representing Recursive and Impure Programs in Coq
MIT License
198 stars 50 forks source link

Bind notation with type annotation #174

Closed alxest closed 4 years ago

alxest commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@alxest is that a good fix for you?

alxest commented 4 years ago

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