summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-03-26 15:13:36 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-03-26 15:13:36 -0400
commit17164a11b7905fda774935471215a36f3f83a820 (patch)
treedbf2b4c8044061fc6efa21d75f4ea1cf0b765995 /tests
parent732a583f6601793bb0ba9246649e45de89fe1067 (diff)
Type class inclusions
Diffstat (limited to 'tests')
-rw-r--r--tests/type_class.ur13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/type_class.ur b/tests/type_class.ur
index 42cbe82f..a41ccdc8 100644
--- a/tests/type_class.ur
+++ b/tests/type_class.ur
@@ -9,6 +9,11 @@ structure M : sig
val option_default : t ::: Type -> default t -> default (option t)
val pair_default : a ::: Type -> b ::: Type -> default a -> default b -> default (pair a b)
+
+ class awesome
+ val awesome_default : t ::: Type -> awesome t -> default t
+
+ val float_awesome : awesome float
end = struct
class default t = t
fun get (t ::: Type) (x : t) = x
@@ -18,6 +23,11 @@ end = struct
fun option_default (t ::: Type) (x : t) = Some x
fun pair_default (a ::: Type) (b ::: Type) (x : a) (y : b) = Pair (x, y)
+
+ class awesome t = t
+ fun awesome_default (t ::: Type) (x : t) = x
+
+ val float_awesome = 1.23
end
open M
@@ -27,6 +37,7 @@ val hi : string = default
val zero : int = default
val some_zero : option int = default
val hi_zero : pair string int = default
+val ott : float = default
fun frob (t ::: Type) (_ : default t) : t = default
val hi_again : string = frob
@@ -44,5 +55,5 @@ fun show_pair (a ::: Type) (b ::: Type) (_ : show a) (_ : show b) : show (pair a
Pair (y, z) => "(" ^ show y ^ "," ^ show z ^ ")")
fun main () : transaction page = return <xml><body>
- {[hi_again]}, {[zero_again]}, {[some_zero]}, {[hi_zero]}
+ {[hi_again]}, {[zero_again]}, {[some_zero]}, {[hi_zero]}, {[ott]}
</body></xml>