annotate tests/disjoint.ur @ 1513:5616b2cbdcdb
Tutorial: hyperlinks for metaprogramming and row types
author |
Adam Chlipala <adam@chlipala.net> |
date |
Wed, 20 Jul 2011 08:14:49 -0400 |
parents |
71bafe66dbe1 |
children |
|
rev |
line source |
adamc@86
|
1 con c1 = fn x :: Name => [x] ~ [A] => [x = int, A = string]
|
adamc@84
|
2 con c2 = fn x :: Name => [x] ~ [A] => [A, x]
|
adamc@84
|
3 con c3 = fn x :: Name => [A] ~ [x] => [x, A]
|
adamc@84
|
4 con c4 = fn x :: Name => [A] ~ [x] => [A, x]
|
adamc@84
|
5
|
adamc@84
|
6 con c5 = fn r1 :: {Type} => fn r2 => r1 ~ r2 => r1 ++ r2
|
adamc@84
|
7 con c6 = fn r1 :: {Type} => fn r2 => r2 ~ r1 => r1 ++ r2
|
adamc@84
|
8
|
adamc@86
|
9 con c7 = fn x :: Name => fn r => [x] ~ r => [x = int] ++ r
|
adamc@86
|
10
|
adamc@86
|
11 val vt1 = fn x : $(c1 #B) => x.B
|
adamc@86
|
12 val vt2 = fn x : $(c1 #B) => x.A
|
adamc@86
|
13 val vt3 = fn x : $(c1 #C) => x.A
|
adamc@86
|
14 val vt4 = fn x : $(c1 #C) => x.A
|
adamc@86
|
15 (*
|
adamc@86
|
16 val vtX = fn x : $(c1 #A) => x.A
|
adamc@86
|
17 val vtX = fn x : $(c1 #A) => x.A
|
adamc@86
|
18 *)
|
adamc@85
|
19
|
adamc@85
|
20 val v1 = fn x :: Name => fn [x] ~ [A] => fn y : {x : int, A : string} => y.x
|
adamc@86
|
21
|
adamc@86
|
22 val vt5 = v1 [#B] {A = "Hi", B = 0}
|
adamc@86
|
23 (*
|
adamc@86
|
24 val vtX = v1 [#A] {A = "Hi", A = 0}
|
adamc@86
|
25 *)
|
adamc@86
|
26
|
adamc@86
|
27 val v2 = fn x :: Name => fn r :: {Type} => fn y : $(c7 x r) => fn [x] ~ r => y.x
|
adamc@86
|
28 val vt6 = v2 [#A] [[B = float, C = string]] {A = 8, B = 8.0, C = "8"}
|
adamc@86
|
29
|
adamc@86
|
30 (*
|
adamc@86
|
31 val vtX = v2 [#A] [[B = float, B = string]] {A = 8, B = 8.0, B = "8"}
|
adamc@86
|
32 val vtX = v2 [#A] [[A = float, B = string]] {A = 8, A = 8.0, B = "8"}
|
adamc@86
|
33 *)
|
adamc@87
|
34
|
adamc@87
|
35 val main = vt6
|