Mercurial > urweb
annotate tests/constraint.lac @ 88:7bab29834cd6
Constraints in modules
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 01 Jul 2008 15:58:02 -0400 |
parents | |
children | d3ee072fa609 |
rev | line source |
---|---|
adamc@88 | 1 signature S = sig |
adamc@88 | 2 con nm :: Name |
adamc@88 | 3 con r :: {Type} |
adamc@88 | 4 |
adamc@88 | 5 constraint [nm] ~ r |
adamc@88 | 6 end |
adamc@88 | 7 |
adamc@88 | 8 structure M : S = struct |
adamc@88 | 9 con nm = #A |
adamc@88 | 10 con r = [B = float, C = string] |
adamc@88 | 11 |
adamc@88 | 12 constraint [A] ~ [B] |
adamc@88 | 13 constraint [nm] ~ r |
adamc@88 | 14 constraint [C] ~ [D] |
adamc@88 | 15 end |
adamc@88 | 16 |
adamc@88 | 17 structure M' = struct |
adamc@88 | 18 open M |
adamc@88 | 19 |
adamc@88 | 20 con combo = [nm = int] ++ r |
adamc@88 | 21 end |
adamc@88 | 22 |
adamc@88 | 23 structure M' = struct |
adamc@88 | 24 open constraints M |
adamc@88 | 25 |
adamc@88 | 26 con nm' = M.nm |
adamc@88 | 27 con r' = M.r |
adamc@88 | 28 con combo = [nm' = int] ++ r' |
adamc@88 | 29 end |