comparison tests/foldm.ur @ 244:71bafe66dbe1

Laconic -> Ur
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 08:32:18 -0400
parents tests/foldm.lac@88ffb3d61817
children
comparison
equal deleted inserted replaced
243:2b9dfaffb008 244:71bafe66dbe1
1 con currier = fold (fn nm => fn t => fn acc => t -> acc) {}
2
3 signature S = sig
4 type t
5 val x : t
6
7 con rs :: {Type}
8 val create : currier rs -> t
9 end
10
11 functor Currier (M : sig con rs :: {Type} end) : S where con rs = M.rs = struct
12 val currier : rs :: {Type} -> currier rs =
13 fold [currier] (fn nm :: Name => fn t :: Type => fn rest :: {Type} => fn acc => fn x : t => acc) {}
14
15 type t = currier M.rs
16 val x = currier [M.rs]
17
18 con rs = M.rs
19 val create : t -> t = fn x => x
20 end
21
22 structure ChefsSpecial = Currier(struct
23 con rs = [A = int, B = float]
24 end)
25
26 val main = ChefsSpecial.x