comparison tests/type_classMod.lac @ 217:56db662ebcfd

Fun with type classes and modules
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 Aug 2008 16:30:07 -0400
parents
children
comparison
equal deleted inserted replaced
216:38b299373676 217:56db662ebcfd
1 structure M = struct
2 structure N = struct
3 class c t = t
4 val string_c : c string = "Hi"
5 end
6 end
7
8 val c : t :: Type -> M.N.c t -> t =
9 fn t :: Type => fn pf : M.N.c t => pf
10 val hi = c [string] _
11
12 val bool_c : M.N.c bool = True
13 val true = c [bool] _
14 val hi = c [string] _
15
16 con c = M.N.c
17 val int_c : c int = 0
18 val zero = c [int] _