| 1 |
Declare Scope blafu. |
| 2 |
Delimit Scope blafu with B. |
| 3 |
Axiom DoesNotMatch : Type. |
| 4 |
Axiom consumer : forall {A} (B : A -> Type) (E:Type) (x : A) (ls : list nat), unit. |
| 5 |
|
| 6 |
Notation "| p1 | .. | pn" := (@cons _ p1 .. (@cons _ pn nil) ..) (at level 91) : blafu. |
| 7 |
Notation "'mmatch_do_not_write' x 'in' T 'as' y 'return' 'M' p 'with_do_not_write' ls" := |
| 8 |
(@consumer _ (fun y : T => p%type) DoesNotMatch x ls%B) |
| 9 |
(at level 200, ls at level 91, only parsing). |
| 10 |
Notation "'mmatch' x 'in' T 'as' y 'return' 'M' p 'with' ls 'end'" := |
| 11 |
(mmatch_do_not_write x in T as y return M p with_do_not_write ls) |
| 12 |
(at level 0, ls at level 91, p at level 10, only parsing). |
| 13 |
(* This should not gives a warning *) |
| 14 |
Notation "'mmatch' x 'in' T 'as' y 'return' 'M' p 'with' ls 'end'" := |
| 15 |
(@consumer _ (fun y : T => p%type) DoesNotMatch x ls%B) |
| 16 |
(at level 0, ls at level 91, p at level 10, only printing, |
| 17 |
format "'[ ' mmatch '/' x ']' '/' '[ ' in '/' T ']' '/' '[ ' as '/' y ']' '/' '[ ' return M p ']' with '//' '[' ls ']' '//' end" |
| 18 |
). |
| 19 |
(* Check use of "mmatch" *) |
| 20 |
Check (mmatch 1 + 2 + 3 + 4 + 5 + 6 in nat as x return M (x = x) with | 1 end). |
| 21 |
|
| 22 |
(* 2nd example *) |
| 23 |
Notation "#" := I (at level 0, only parsing). |
| 24 |
Notation "#" := I (at level 0, only printing). |
| 25 |
Check #. |
| 26 |
Notation "##" := I (at level 0, only printing). |
| 27 |
Notation "##" := I (at level 0, only parsing). |
| 28 |
Check ##. |