adamc@56
|
1 type int
|
adamc@56
|
2 type float
|
adamc@56
|
3 type string
|
adamc@91
|
4
|
adamc@119
|
5 type unit = {}
|
adamc@119
|
6
|
adamc@186
|
7 datatype bool = False | True
|
adamc@186
|
8
|
adamc@91
|
9
|
adamc@203
|
10 (** SQL *)
|
adamc@203
|
11
|
adamc@203
|
12 con sql_table :: {Type} -> Type
|
adamc@203
|
13
|
adamc@203
|
14
|
adamc@203
|
15 (** XML *)
|
adamc@203
|
16
|
adamc@139
|
17 con tag :: {Type} -> {Unit} -> {Unit} -> {Type} -> {Type} -> Type
|
adamc@91
|
18
|
adamc@91
|
19
|
adamc@139
|
20 con xml :: {Unit} -> {Type} -> {Type} -> Type
|
adamc@141
|
21 val cdata : ctx ::: {Unit} -> use ::: {Type} -> string -> xml ctx use []
|
adamc@104
|
22 val tag : attrsGiven ::: {Type} -> attrsAbsent ::: {Type} -> attrsGiven ~ attrsAbsent
|
adamc@139
|
23 -> ctxOuter ::: {Unit} -> ctxInner ::: {Unit}
|
adamc@139
|
24 -> useOuter ::: {Type} -> useInner ::: {Type} -> useOuter ~ useInner
|
adamc@139
|
25 -> bindOuter ::: {Type} -> bindInner ::: {Type} -> bindOuter ~ bindInner
|
adamc@104
|
26 -> $attrsGiven
|
adamc@139
|
27 -> tag (attrsGiven ++ attrsAbsent) ctxOuter ctxInner useOuter bindOuter
|
adamc@139
|
28 -> xml ctxInner useInner bindInner
|
adamc@139
|
29 -> xml ctxOuter (useOuter ++ useInner) (bindOuter ++ bindInner)
|
adamc@140
|
30 val join : ctx ::: {Unit}
|
adamc@139
|
31 -> use1 ::: {Type} -> bind1 ::: {Type} -> bind2 ::: {Type}
|
adamc@139
|
32 -> use1 ~ bind1 -> bind1 ~ bind2
|
adamc@140
|
33 -> xml ctx use1 bind1
|
adamc@140
|
34 -> xml ctx (use1 ++ bind1) bind2
|
adamc@140
|
35 -> xml ctx use1 (bind1 ++ bind2)
|
adamc@148
|
36 val useMore : ctx ::: {Unit} -> use1 ::: {Type} -> use2 ::: {Type} -> bind ::: {Type}
|
adamc@148
|
37 -> use1 ~ use2
|
adamc@148
|
38 -> xml ctx use1 bind
|
adamc@148
|
39 -> xml ctx (use1 ++ use2) bind
|
adamc@91
|
40
|
adamc@110
|
41 con xhtml = xml [Html]
|
adamc@139
|
42 con page = xhtml [] []
|
adamc@110
|
43
|
adamc@140
|
44 con html = [Html]
|
adamc@140
|
45 con head = [Head]
|
adamc@140
|
46 con body = [Body]
|
adamc@141
|
47 con lform = [Body, LForm]
|
adamc@93
|
48
|
adamc@140
|
49 val head : unit -> tag [] html head [] []
|
adamc@140
|
50 val title : unit -> tag [] head [] [] []
|
adamc@110
|
51
|
adamc@140
|
52 val body : unit -> tag [] html body [] []
|
adamc@140
|
53 con bodyTag = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit
|
adamc@140
|
54 -> tag attrs ([Body] ++ ctx) ([Body] ++ ctx) [] []
|
adamc@141
|
55 con bodyTagStandalone = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit
|
adamc@141
|
56 -> tag attrs ([Body] ++ ctx) [] [] []
|
adamc@141
|
57
|
adamc@141
|
58 val br : bodyTagStandalone []
|
adamc@119
|
59
|
adamc@140
|
60 val p : bodyTag []
|
adamc@140
|
61 val b : bodyTag []
|
adamc@140
|
62 val i : bodyTag []
|
adamc@140
|
63 val font : bodyTag [Size = int, Face = string]
|
adamc@140
|
64
|
adamc@140
|
65 val h1 : bodyTag []
|
adamc@140
|
66 val li : bodyTag []
|
adamc@140
|
67
|
adamc@140
|
68 val a : bodyTag [Link = page]
|
adamc@140
|
69
|
adamc@141
|
70 val lform : ctx ::: {Unit} -> [Body] ~ ctx -> bind ::: {Type}
|
adamc@141
|
71 -> xml lform [] bind
|
adamc@141
|
72 -> xml ([Body] ++ ctx) [] []
|
adamc@153
|
73 con lformTag = fn ty :: Type => fn inner :: {Unit} => fn attrs :: {Type} =>
|
adamc@141
|
74 ctx ::: {Unit} -> [LForm] ~ ctx
|
adamc@141
|
75 -> nm :: Name -> unit
|
adamc@153
|
76 -> tag attrs ([LForm] ++ ctx) inner [] [nm = ty]
|
adamc@153
|
77 val textbox : lformTag string [] []
|
adamc@155
|
78 val password : lformTag string [] []
|
adamc@153
|
79 val ltextarea : lformTag string [] []
|
adamc@153
|
80
|
adamc@190
|
81 val checkbox : lformTag bool [] []
|
adamc@190
|
82
|
adamc@153
|
83 con radio = [Body, Radio]
|
adamc@153
|
84 val radio : lformTag string radio []
|
adamc@153
|
85 val radioOption : unit -> tag [Value = string] radio [] [] []
|
adamc@142
|
86
|
adamc@154
|
87 con select = [Select]
|
adamc@154
|
88 val lselect : lformTag string select []
|
adamc@154
|
89 val loption : unit -> tag [Value = string] select [] [] []
|
adamc@154
|
90
|
adamc@142
|
91 val submit : ctx ::: {Unit} -> [LForm] ~ ctx
|
adamc@142
|
92 -> use ::: {Type} -> unit
|
adamc@142
|
93 -> tag [Action = $use -> page] ([LForm] ++ ctx) ([LForm] ++ ctx) use []
|