|
| 1 | +GADT indexation through aliases |
| 2 | + |
| 3 | + $ cat > sample.ml <<EOF |
| 4 | + > type _ g = |
| 5 | + > | A : int g |
| 6 | + > | B : string g |
| 7 | + > | C : (int, string) result g |
| 8 | + > type i = int |
| 9 | + > type s = string |
| 10 | + > let f = (A, B, C) |
| 11 | + > EOF |
| 12 | + $ $MERLIN single type-enclosing -position 7:6 -filename sample.ml < sample.ml \ |
| 13 | + > | tr '\r\n' ' ' \ |
| 14 | + > | jq .value[0].type -r |
| 15 | + int g * string g * (int, string) result g |
| 16 | + |
| 17 | + $ $MERLIN single type-enclosing -short-paths -position 7:6 -filename sample.ml < sample.ml \ |
| 18 | + > | tr '\r\n' ' ' \ |
| 19 | + > | jq .value[0].type -r |
| 20 | + i g * s g * (i, s) result g |
| 21 | + |
| 22 | +GADT indexation through aliases with abstraction |
| 23 | + |
| 24 | + $ cat > sample.ml <<EOF |
| 25 | + > module M : sig |
| 26 | + > type 'a g |
| 27 | + > val a : int g |
| 28 | + > val b : string g |
| 29 | + > val c : (int, string) result g |
| 30 | + > end = struct |
| 31 | + > type _ g = |
| 32 | + > | A : int g |
| 33 | + > | B : string g |
| 34 | + > | C : (int, string) result g |
| 35 | + > let (a, b, c) = (A, B, C) |
| 36 | + > end |
| 37 | + > open M |
| 38 | + > let f = (a, b, c) |
| 39 | + > EOF |
| 40 | + $ $MERLIN single type-enclosing -position 14:5 -filename sample.ml < sample.ml \ |
| 41 | + > | tr '\r\n' ' ' \ |
| 42 | + > | jq .value[0].type -r |
| 43 | + int M.g * string M.g * (int, string) result M.g |
| 44 | + |
| 45 | + $ $MERLIN single type-enclosing -short-paths -position 14:5 -filename sample.ml < sample.ml \ |
| 46 | + > | tr '\r\n' ' ' \ |
| 47 | + > | jq .value[0].type -r |
| 48 | + int g * string g * (int, string) result g |
| 49 | + |
| 50 | +GADT indexation through aliases with abstraction at call-site |
| 51 | + |
| 52 | + $ cat > sample.ml <<EOF |
| 53 | + > module M : sig |
| 54 | + > type 'a g |
| 55 | + > val a : int g |
| 56 | + > val b : string g |
| 57 | + > val c : (int, string) result g |
| 58 | + > end = struct |
| 59 | + > type _ g = |
| 60 | + > | A : int g |
| 61 | + > | B : string g |
| 62 | + > | C : (int, string) result g |
| 63 | + > let (a, b, c) = (A, B, C) |
| 64 | + > end |
| 65 | + > type aaa = string type bbb = int type ccc = (int, string) result |
| 66 | + > open M |
| 67 | + > let f = (a, b, c) |
| 68 | + > EOF |
| 69 | + $ $MERLIN single type-enclosing -position 15:5 -filename sample.ml < sample.ml \ |
| 70 | + > | tr '\r\n' ' ' \ |
| 71 | + > | jq .value[0].type -r |
| 72 | + int M.g * string M.g * (int, string) result M.g |
| 73 | + |
| 74 | + $ $MERLIN single type-enclosing -short-paths -position 15:5 -filename sample.ml < sample.ml \ |
| 75 | + > | tr '\r\n' ' ' \ |
| 76 | + > | jq .value[0].type -r |
| 77 | + bbb g * aaa g * (bbb, aaa) result g |
0 commit comments