Debian Codegraph @

test-suite/bugs/bug_5346.v

raw
1 Inductive comp : Type -> Type :=
2 | Ret {T} : forall (v:T), comp T
3 | Bind {T T'} : forall (p: comp T') (p': T' -> comp T), comp T.
4
5 Notation "'do' x .. y <- p1 ; p2" :=
6 (Bind p1 (fun x => .. (fun y => p2) ..))
7 (at level 60, right associativity,
8 x binder, y binder).
9
10 Definition Fst1 A B (p: comp (A*B)) : comp A :=
11 do '(a, b) <- p;
12 Ret a.
13
14 Definition Fst2 A B (p: comp (A*B)) : comp A :=
15 match tt with
16 | _ => Bind p (fun '(a, b) => Ret a)
17 end.
18
19 Definition Fst3 A B (p: comp (A*B)) : comp A :=
20 match tt with
21 | _ => do a <- p;
22 Ret (fst a)
23 end.
24
25 Definition Fst A B (p: comp (A * B)) : comp A :=
26 match tt with
27 | _ => do '(a, b) <- p;
28 Ret a
29 end.