diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-08-16 14:36:17 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-08-16 14:36:17 -0400 |
commit | 70cd2b655dd741ad04a98dbe6685ec2ec9e11fdd (patch) | |
tree | c7f699c2b19d9de56a7b72a0755b5e176e73e049 | |
parent | b4f1361d2dff2e180e4656efa491b275707cdf02 (diff) |
Testing type-class-parameterized functions
-rw-r--r-- | src/lacweb.grm | 1 | ||||
-rw-r--r-- | tests/type_class.lac | 13 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/lacweb.grm b/src/lacweb.grm index fd24ba31..4f316d74 100644 --- a/src/lacweb.grm +++ b/src/lacweb.grm @@ -427,6 +427,7 @@ eexp : eapps (eapps) | 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 --git a/tests/type_class.lac b/tests/type_class.lac index 72baa3b3..0acca7cd 100644 --- a/tests/type_class.lac +++ b/tests/type_class.lac @@ -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> |