comparison demo/more/dbgrid.urs @ 915:5e8b6fa5b48f

Start 'more' demo with dbgrid
author Adam Chlipala <adamc@hcoop.net>
date Tue, 08 Sep 2009 07:48:57 -0400
parents
children 51bc7681c47e
comparison
equal deleted inserted replaced
914:782f0b4eea67 915:5e8b6fa5b48f
1 con rawMeta = fn t :: Type =>
2 {New : transaction t,
3 Inj : sql_injectable t}
4
5 con colMeta' = fn (row :: {Type}) (t :: Type) =>
6 {Header : string,
7 Project : $row -> transaction t,
8 Update : $row -> t -> transaction ($row),
9 Display : t -> xbody,
10 Edit : t -> xbody,
11 Validate : t -> signal bool}
12
13 con colMeta = fn (row :: {Type}) (global_t :: (Type * Type)) =>
14 {Initialize : transaction global_t.1,
15 Handlers : global_t.1 -> colMeta' row global_t.2}
16
17 structure Direct : sig
18 con meta = fn global_actual_input :: (Type * Type * Type) =>
19 {Initialize : transaction global_actual_input.1,
20 Handlers : global_actual_input.1
21 -> {Display : global_actual_input.3 -> xbody,
22 Edit : global_actual_input.3 -> xbody,
23 Initialize : global_actual_input.2 -> transaction global_actual_input.3,
24 Parse : global_actual_input.3 -> signal (option global_actual_input.2)}}
25
26 con editableState :: (Type * Type * Type) -> (Type * Type)
27 val editable : ts ::: (Type * Type * Type) -> rest ::: {Type}
28 -> nm :: Name -> [[nm] ~ rest] => string -> meta ts
29 -> colMeta ([nm = ts.2] ++ rest)
30 (editableState ts)
31
32 con readOnlyState :: (Type * Type * Type) -> (Type * Type)
33 val readOnly : ts ::: (Type * Type * Type) -> rest ::: {Type}
34 -> nm :: Name -> [[nm] ~ rest] => string -> meta ts
35 -> colMeta ([nm = ts.2] ++ rest)
36 (readOnlyState ts)
37
38 type intGlobal
39 type intInput
40 val int : meta (intGlobal, int, intInput)
41
42 type stringGlobal
43 type stringInput
44 val string : meta (stringGlobal, string, stringInput)
45
46 type boolGlobal
47 type boolInput
48 val bool : meta (boolGlobal, bool, boolInput)
49
50 functor Foreign (M : sig
51 con row :: {Type}
52 con t :: Type
53 val show_t : show t
54 val read_t : read t
55 val eq_t : eq t
56 val inj_t : sql_injectable t
57 con nm :: Name
58 constraint [nm] ~ row
59 table tab : ([nm = t] ++ row)
60 val render : $([nm = t] ++ row) -> string
61 end) : sig
62 con global :: Type
63 con input :: Type
64 val meta : meta (global, M.t, input)
65 end
66 end
67
68 con computedState :: (Type * Type)
69 val computed : row ::: {Type} -> t ::: Type -> show t
70 -> string -> ($row -> t) -> colMeta row computedState
71 val computedHtml : row ::: {Type} -> string -> ($row -> xbody) -> colMeta row computedState
72
73 functor Make(M : sig
74 con key :: {Type}
75 con row :: {Type}
76 constraint key ~ row
77 table tab : (key ++ row)
78
79 val raw : $(map rawMeta (key ++ row))
80
81 con cols :: {(Type * Type)}
82 val cols : $(map (colMeta (key ++ row)) cols)
83
84 val keyFolder : folder key
85 val rowFolder : folder row
86 val colsFolder : folder cols
87 end) : sig
88 type grid
89
90 val grid : transaction grid
91 val sync : grid -> transaction unit
92 val render : grid -> xbody
93 end