From 2ace64baba707b2e76778c74789735263eb50823 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 26 Dec 2009 11:56:40 -0500 Subject: Make summary unification more conservative; infer implicit arguments after applications --- demo/crud.ur | 96 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'demo/crud.ur') diff --git a/demo/crud.ur b/demo/crud.ur index 21c85d8f..bccc3822 100644 --- a/demo/crud.ur +++ b/demo/crud.ur @@ -50,12 +50,12 @@ functor Make(M : sig (fn (fs : {T : $([Id = int] ++ map fst M.cols)}) => {[fs.T.Id]} - {foldRX2 [fst] [colMeta] [tr] - (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] - [[nm] ~ rest] v col => - {col.Show v} - ) - [M.cols] M.fl (fs.T -- #Id) M.cols} + {@foldRX2 [fst] [colMeta] [tr] + (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] + [[nm] ~ rest] v col => + {col.Show v} + ) + M.fl (fs.T -- #Id) M.cols} [Update] [Delete] @@ -66,12 +66,12 @@ functor Make(M : sig - {foldRX [colMeta] [tr] - (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] - [[nm] ~ rest] col => - - ) - [M.cols] M.fl M.cols} + {@foldRX [colMeta] [tr] + (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] + [[nm] ~ rest] col => + + ) + M.fl M.cols} {rows}
ID{cdata col.Nam}{cdata col.Nam}
@@ -79,14 +79,14 @@ functor Make(M : sig


- {foldR [colMeta] [fn cols :: {(Type * Type)} => xml form [] (map snd cols)] - (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] - [[nm] ~ rest] (col : colMeta t) (acc : xml form [] (map snd rest)) => -
  • {cdata col.Nam}: {col.Widget [nm]}
  • - {useMore acc} -
    ) - - [M.cols] M.fl M.cols} + {@foldR [colMeta] [fn cols :: {(Type * Type)} => xml form [] (map snd cols)] + (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] + [[nm] ~ rest] (col : colMeta t) (acc : xml form [] (map snd rest)) => +
  • {cdata col.Nam}: {col.Widget [nm]}
  • + {useMore acc} +
    ) + + M.fl M.cols} @@ -95,13 +95,13 @@ functor Make(M : sig and create (inputs : $(map snd M.cols)) = id <- nextval seq; dml (insert tab - (foldR2 [snd] [colMeta] - [fn cols => $(map (fn t :: (Type * Type) => - sql_exp [] [] [] t.1) cols)] - (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] - [[nm] ~ rest] => - fn input col acc => acc ++ {nm = @sql_inject col.Inject (col.Parse input)}) - {} [M.cols] M.fl inputs M.cols + (@foldR2 [snd] [colMeta] + [fn cols => $(map (fn t :: (Type * Type) => + sql_exp [] [] [] t.1) cols)] + (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] + [[nm] ~ rest] => + fn input col acc => acc ++ {nm = @sql_inject col.Inject (col.Parse input)}) + {} M.fl inputs M.cols ++ {Id = (SQL {[id]})})); ls <- list (); return @@ -113,17 +113,17 @@ functor Make(M : sig and upd (id : int) = let fun save (inputs : $(map snd M.cols)) = - dml (update [map fst M.cols] ! - (foldR2 [snd] [colMeta] - [fn cols => $(map (fn t :: (Type * Type) => - sql_exp [T = [Id = int] - ++ map fst M.cols] - [] [] t.1) cols)] - (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] - [[nm] ~ rest] => - fn input col acc => acc ++ {nm = - @sql_inject col.Inject (col.Parse input)}) - {} [M.cols] M.fl inputs M.cols) + dml (update [map fst M.cols] + (@foldR2 [snd] [colMeta] + [fn cols => $(map (fn t :: (Type * Type) => + sql_exp [T = [Id = int] + ++ map fst M.cols] + [] [] t.1) cols)] + (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] + [[nm] ~ rest] => + fn input col acc => acc ++ {nm = + @sql_inject col.Inject (col.Parse input)}) + {} M.fl inputs M.cols) tab (WHERE T.Id = {[id]})); ls <- list (); return @@ -136,16 +136,16 @@ functor Make(M : sig case fso : (Basis.option {Tab : $(map fst M.cols)}) of None => return Not found! | Some fs => return
    - {foldR2 [fst] [colMeta] [fn cols :: {(Type * Type)} => xml form [] (map snd cols)] - (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] - [[nm] ~ rest] (v : t.1) (col : colMeta t) - (acc : xml form [] (map snd rest)) => - -
  • {cdata col.Nam}: {col.WidgetPopulated [nm] v}
  • - {useMore acc} -
    ) - - [M.cols] M.fl fs.Tab M.cols} + {@foldR2 [fst] [colMeta] [fn cols :: {(Type * Type)} => xml form [] (map snd cols)] + (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}] + [[nm] ~ rest] (v : t.1) (col : colMeta t) + (acc : xml form [] (map snd rest)) => + +
  • {cdata col.Nam}: {col.WidgetPopulated [nm] v}
  • + {useMore acc} +
    ) + + M.fl fs.Tab M.cols} -- cgit v1.2.3