Mercurial > urweb
comparison tests/functor.ur @ 244:71bafe66dbe1
Laconic -> Ur
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 31 Aug 2008 08:32:18 -0400 |
parents | tests/functor.lac@ac4c0b4111ba |
children |
comparison
equal
deleted
inserted
replaced
243:2b9dfaffb008 | 244:71bafe66dbe1 |
---|---|
1 signature S = sig | |
2 type t | |
3 val z : t | |
4 val s : t -> t | |
5 end | |
6 | |
7 signature T = sig | |
8 type t | |
9 val three : t | |
10 end | |
11 | |
12 functor F (M : S) : T where type t = M.t = struct | |
13 type t = M.t | |
14 val three = M.s (M.s (M.s M.z)) | |
15 end | |
16 | |
17 | |
18 structure O = F (struct | |
19 type t = int | |
20 val z = 0 | |
21 val s = fn x : t => x | |
22 end) | |
23 val three : int = O.three | |
24 | |
25 structure S = struct | |
26 type t = int | |
27 val z = 0 | |
28 val s = fn x : t => x | |
29 end | |
30 structure SO = F (S) | |
31 val three : int = SO.three | |
32 | |
33 structure SS : S = S | |
34 structure SSO = F (SS) | |
35 val three : SS.t = SSO.three | |
36 | |
37 val main = three |