Mercurial > urweb
annotate tests/modules.ur @ 624:354800878b4d
Kind polymorphism through Explify
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 22 Feb 2009 16:32:56 -0500 |
parents | 71bafe66dbe1 |
children |
rev | line source |
---|---|
adamc@31 | 1 signature A = sig end |
adamc@31 | 2 structure A = struct end |
adamc@31 | 3 structure Ao : A = A |
adamc@31 | 4 |
adamc@31 | 5 |
adamc@31 | 6 structure B = struct |
adamc@31 | 7 type t = int |
adamc@31 | 8 end |
adamc@31 | 9 structure Bo0 : sig end = B |
adamc@31 | 10 structure BoA : A = B |
adamc@31 | 11 |
adamc@31 | 12 signature B1 = sig |
adamc@31 | 13 type t |
adamc@31 | 14 end |
adamc@31 | 15 structure Bo1 : B1 = B |
adamc@31 | 16 (*structure AoB1 : B1 = A*) |
adamc@31 | 17 |
adamc@31 | 18 signature B2 = sig |
adamc@31 | 19 type t = int |
adamc@31 | 20 end |
adamc@31 | 21 structure Bo2 : B2 = B |
adamc@31 | 22 |
adamc@31 | 23 |
adamc@31 | 24 structure C = struct |
adamc@31 | 25 type t = float |
adamc@31 | 26 end |
adamc@31 | 27 structure CoB1 : B1 = C |
adamc@31 | 28 (*structure CoB2 : B2 = C*) |
adamc@32 | 29 |
adamc@32 | 30 |
adamc@32 | 31 signature NAT = sig |
adamc@32 | 32 type t |
adamc@32 | 33 val zero : t |
adamc@32 | 34 end |
adamc@32 | 35 structure Nat : NAT = struct |
adamc@32 | 36 type t = int |
adamc@32 | 37 val zero = 0 |
adamc@32 | 38 end |
adamc@32 | 39 (*structure NotNat : NAT = struct |
adamc@32 | 40 type t = int |
adamc@32 | 41 val zero = 0.0 |
adamc@32 | 42 end*) |
adamc@32 | 43 (*structure NotNat : NAT = struct |
adamc@32 | 44 val zero = 0 |
adamc@32 | 45 end*) |
adamc@32 | 46 |
adamc@32 | 47 |
adamc@32 | 48 signature WOBBLE = sig |
adamc@32 | 49 type t |
adamc@32 | 50 type s |
adamc@32 | 51 end |
adamc@32 | 52 structure Wobble1 = struct |
adamc@32 | 53 type t = int |
adamc@32 | 54 type s = float |
adamc@32 | 55 end |
adamc@32 | 56 structure Wobble2 = struct |
adamc@32 | 57 type s = int |
adamc@32 | 58 type t = float |
adamc@32 | 59 end |
adamc@33 | 60 |
adamc@33 | 61 |
adamc@33 | 62 structure N = struct |
adamc@33 | 63 type t = string |
adamc@33 | 64 structure N2 = struct |
adamc@33 | 65 type t = int |
adamc@33 | 66 val zero = 0 |
adamc@33 | 67 end |
adamc@33 | 68 val x = "Hi" |
adamc@33 | 69 end |
adamc@33 | 70 signature N = sig |
adamc@33 | 71 structure N2 : NAT |
adamc@33 | 72 type t |
adamc@33 | 73 val x : t |
adamc@33 | 74 end |
adamc@33 | 75 structure No : N = N |