Debian Codegraph @

test-suite/success/sort_poly_extraction.v

raw
1 Require Extraction.
2
3 Set Universe Polymorphism.
4 Definition foo@{s; |} := tt.
5
6 Definition bar := foo@{Prop;}.
7
8 Extraction bar.
9
10 (* the actual problem only appears once we have inductives with sort poly output: *)
11
12 Inductive Pair@{s;u|} (A:Type@{s;u}) : Type@{s;u} := pair : A -> A -> Pair A.
13
14 Definition use_pair@{s;+|} A (k:A->nat) (x:Pair@{s;_} A) :=
15 k (match x with pair _ x _ => x end).
16
17 Definition make_pair := pair@{Prop;_} _ I I.
18
19 Definition hell := use_pair True (fun _ => 0) make_pair.
20
21 Extraction TestCompile hell.
22
23 (* Some tests *)
24
25 Module Foo.
26
27 Definition foo@{s1 s2| |} := fun (A : Type@{s1|Set}) (x : A) => x.
28
29 Definition foo0 := foo@{SProp Type|}.
30 Definition foo1 := foo@{Type SProp|}.
31
32 Inductive T@{s| |} : Type@{s|Set} := O : T | S : T -> T.
33
34 Inductive box@{s1 s2| |} (A : Type@{s1|Set}) (B : Type@{s2|Set}) : Type@{Set} := Box : A -> B -> box A B.
35
36 Definition bar (A : Type) (x : A) := 0.
37
38 Definition qux := bar (forall A : Prop, A -> A) foo@{Prop Type|}.
39
40 End Foo.
41
42 Extraction TestCompile Foo.
43
44 (* Check module subtyping *)
45
46 Module Type S.
47 Inductive box@{s1 s2| |} (A : Type@{s1|Set}) (B : Type@{s2|Set}) : Type@{Set} := Box : A -> B -> box A B.
48 End S.
49
50 Module Bar : S.
51 Inductive box@{s1 s2| |} (A : Type@{s1|Set}) (B : Type@{s2|Set}) : Type@{Set} := Box : A -> B -> box A B.
52 End Bar.
53
54 Extraction TestCompile Bar.