annotate lib/basis.lig @ 142:6f9e224692ec

Form submission type-checking
author Adam Chlipala <adamc@hcoop.net>
date Sun, 20 Jul 2008 12:21:30 -0400
parents 63c699450281
children 15e8b9775539
rev   line source
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@91 7
adamc@139 8 con tag :: {Type} -> {Unit} -> {Unit} -> {Type} -> {Type} -> Type
adamc@91 9
adamc@91 10
adamc@139 11 con xml :: {Unit} -> {Type} -> {Type} -> Type
adamc@141 12 val cdata : ctx ::: {Unit} -> use ::: {Type} -> string -> xml ctx use []
adamc@104 13 val tag : attrsGiven ::: {Type} -> attrsAbsent ::: {Type} -> attrsGiven ~ attrsAbsent
adamc@139 14 -> ctxOuter ::: {Unit} -> ctxInner ::: {Unit}
adamc@139 15 -> useOuter ::: {Type} -> useInner ::: {Type} -> useOuter ~ useInner
adamc@139 16 -> bindOuter ::: {Type} -> bindInner ::: {Type} -> bindOuter ~ bindInner
adamc@104 17 -> $attrsGiven
adamc@139 18 -> tag (attrsGiven ++ attrsAbsent) ctxOuter ctxInner useOuter bindOuter
adamc@139 19 -> xml ctxInner useInner bindInner
adamc@139 20 -> xml ctxOuter (useOuter ++ useInner) (bindOuter ++ bindInner)
adamc@140 21 val join : ctx ::: {Unit}
adamc@139 22 -> use1 ::: {Type} -> bind1 ::: {Type} -> bind2 ::: {Type}
adamc@139 23 -> use1 ~ bind1 -> bind1 ~ bind2
adamc@140 24 -> xml ctx use1 bind1
adamc@140 25 -> xml ctx (use1 ++ bind1) bind2
adamc@140 26 -> xml ctx use1 (bind1 ++ bind2)
adamc@91 27
adamc@91 28
adamc@110 29 con xhtml = xml [Html]
adamc@139 30 con page = xhtml [] []
adamc@110 31
adamc@140 32 con html = [Html]
adamc@140 33 con head = [Head]
adamc@140 34 con body = [Body]
adamc@141 35 con lform = [Body, LForm]
adamc@93 36
adamc@140 37 val head : unit -> tag [] html head [] []
adamc@140 38 val title : unit -> tag [] head [] [] []
adamc@110 39
adamc@140 40 val body : unit -> tag [] html body [] []
adamc@140 41 con bodyTag = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit
adamc@140 42 -> tag attrs ([Body] ++ ctx) ([Body] ++ ctx) [] []
adamc@141 43 con bodyTagStandalone = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit
adamc@141 44 -> tag attrs ([Body] ++ ctx) [] [] []
adamc@141 45
adamc@141 46 val br : bodyTagStandalone []
adamc@119 47
adamc@140 48 val p : bodyTag []
adamc@140 49 val b : bodyTag []
adamc@140 50 val i : bodyTag []
adamc@140 51 val font : bodyTag [Size = int, Face = string]
adamc@140 52
adamc@140 53 val h1 : bodyTag []
adamc@140 54 val li : bodyTag []
adamc@140 55
adamc@140 56 val a : bodyTag [Link = page]
adamc@140 57
adamc@141 58 val lform : ctx ::: {Unit} -> [Body] ~ ctx -> bind ::: {Type}
adamc@141 59 -> xml lform [] bind
adamc@141 60 -> xml ([Body] ++ ctx) [] []
adamc@141 61 con lformTag = fn ty :: Type => fn attrs :: {Type} =>
adamc@141 62 ctx ::: {Unit} -> [LForm] ~ ctx
adamc@141 63 -> nm :: Name -> unit
adamc@141 64 -> tag attrs ([LForm] ++ ctx) [] [] [nm = ty]
adamc@141 65 val textbox : lformTag string []
adamc@142 66
adamc@142 67 val submit : ctx ::: {Unit} -> [LForm] ~ ctx
adamc@142 68 -> use ::: {Type} -> unit
adamc@142 69 -> tag [Action = $use -> page] ([LForm] ++ ctx) ([LForm] ++ ctx) use []