diff options
-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> |