# HG changeset patch # User Adam Chlipala # Date 1218911777 14400 # Node ID ba4d7c33a45fda4e25a68d561e14d9b6654eacbc # Parent e86411f647c672ef285aab0a7dc2d350c070e9ae Testing type-class-parameterized functions diff -r e86411f647c6 -r ba4d7c33a45f src/lacweb.grm --- a/src/lacweb.grm Sat Aug 16 14:32:18 2008 -0400 +++ b/src/lacweb.grm Sat Aug 16 14:36:17 2008 -0400 @@ -427,6 +427,7 @@ | FN SYMBOL kcolon kind DARROW eexp (ECAbs (kcolon, SYMBOL, kind, eexp), s (FNleft, eexpright)) | FN SYMBOL COLON cexp DARROW eexp (EAbs (SYMBOL, SOME cexp, eexp), s (FNleft, eexpright)) | FN SYMBOL DARROW eexp (EAbs (SYMBOL, NONE, eexp), s (FNleft, eexpright)) + | FN UNDER COLON cexp DARROW eexp (EAbs ("_", SOME cexp, eexp), s (FNleft, eexpright)) | LBRACK cterm TWIDDLE cterm RBRACK DARROW eexp(EDisjoint (cterm1, cterm2, eexp), s (LBRACKleft, RBRACKright)) | FN UNIT DARROW eexp (let val loc = s (FNleft, eexpright) diff -r e86411f647c6 -r ba4d7c33a45f tests/type_class.lac --- 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 () => + {cdata hi_again} +