Mercurial > urweb
annotate tests/functor.lac @ 43:d94c484337d0
Subtyping for functor signatures
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 19 Jun 2008 16:43:24 -0400 |
parents | b3fbbc6cb1e5 |
children | a9f3ce2d1b9b |
rev | line source |
---|---|
adamc@40 | 1 signature S = sig |
adamc@40 | 2 type t |
adamc@40 | 3 val z : t |
adamc@40 | 4 val s : t -> t |
adamc@40 | 5 end |
adamc@40 | 6 |
adamc@40 | 7 signature T = sig |
adamc@40 | 8 type t |
adamc@40 | 9 val three : t |
adamc@40 | 10 end |
adamc@40 | 11 |
adamc@42 | 12 functor F (M : S) : T where type t = M.t = struct |
adamc@41 | 13 type t = M.t |
adamc@40 | 14 val three = M.s (M.s (M.s M.z)) |
adamc@40 | 15 end |
adamc@43 | 16 |
adamc@43 | 17 structure F2 : functor (M : S) : T where type t = M.t = F |
adamc@43 | 18 structure F3 : functor (M : S) : T = F |
adamc@43 | 19 (*structure F4 : functor (M : S) : sig type q end = F*) |
adamc@43 | 20 (*structure F5 : functor (M : S) : T where type t = int = F*) |