Mercurial > urweb
diff tests/type_class.lac @ 212:ba4d7c33a45f
Testing type-class-parameterized functions
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 16 Aug 2008 14:36:17 -0400 |
parents | e86411f647c6 |
children |
line wrap: on
line diff
--- a/tests/type_class.lac Sat Aug 16 14:32:18 2008 -0400 +++ b/tests/type_class.lac Sat Aug 16 14:36:17 2008 -0400 @@ -1,9 +1,18 @@ class default t = t -val string_default : default string = "" +val string_default : default string = "Hi" val int_default : default int = 0 val default : t :: Type -> default t -> t = fn t :: Type => fn d : default t => d -val empty = default [string] _ +val hi = default [string] _ val zero = default [int] _ + +val frob : t :: Type -> default t -> t = + fn t :: Type => fn _ : default t => default [t] _ +val hi_again = frob [string] _ +val zero_again = frob [int] _ + +val main : unit -> page = fn () => <html><body> + {cdata hi_again} +</body></html>