aboutsummaryrefslogtreecommitdiffhomepage
path: root/demo/more/conference.ur
blob: a028bc41088a78935808d9e7cdc9f96dfc17e22f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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] => <xml><textbox{nm}/></xml>,
     WidgetPopulated = fn [nm :: Name] n =>
                          <xml><textbox{nm} value={show n}/></xml>,
     Parse = readError,
     Inject = _}

val int = default
val float = default
val string = default
val bool = {Show = txt,
            Widget = fn [nm :: Name] => <xml><checkbox{nm}/></xml>,
            WidgetPopulated = fn [nm :: Name] b =>
                                 <xml><checkbox{nm} checked={b}/></xml>,
            Parse = fn x => x,
            Inject = _}

functor Make(M : sig
                 con review :: {(Type * Type)}
                 val review : $(map reviewMeta review)
             end) = struct

    fun main () = return <xml/>

end