From aece9fdadf1bdfbf069cc5ac5ab397eef1e3f2ad Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 20 Oct 2009 10:19:00 -0400 Subject: Add tuple pattern-matching at the constructor level --- demo/more/conference.ur | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 demo/more/conference.ur (limited to 'demo/more/conference.ur') diff --git a/demo/more/conference.ur b/demo/more/conference.ur new file mode 100644 index 00000000..a028bc41 --- /dev/null +++ b/demo/more/conference.ur @@ -0,0 +1,33 @@ +con reviewMeta = fn (db :: Type, widget :: Type) => + {Show : db -> xbody, + Widget : nm :: Name -> xml form [] [nm = widget], + WidgetPopulated : nm :: Name -> db -> xml form [] [nm = widget], + Parse : widget -> db, + Inject : sql_injectable db} + +fun default [t] (sh : show t) (rd : read t) (inj : sql_injectable t) : reviewMeta (t, string) = + {Show = txt, + Widget = fn [nm :: Name] => , + WidgetPopulated = fn [nm :: Name] n => + , + Parse = readError, + Inject = _} + +val int = default +val float = default +val string = default +val bool = {Show = txt, + Widget = fn [nm :: Name] => , + WidgetPopulated = fn [nm :: Name] b => + , + Parse = fn x => x, + Inject = _} + +functor Make(M : sig + con review :: {(Type * Type)} + val review : $(map reviewMeta review) + end) = struct + + fun main () = return + +end -- cgit v1.2.3