annotate lib/basis.lig @ 166:a991431b77eb

Start of unurlify for datatypes
author Adam Chlipala <adamc@hcoop.net>
date Tue, 29 Jul 2008 14:28:44 -0400
parents 4334bb734187
children 88d46972de53
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@148 27 val useMore : ctx ::: {Unit} -> use1 ::: {Type} -> use2 ::: {Type} -> bind ::: {Type}
adamc@148 28 -> use1 ~ use2
adamc@148 29 -> xml ctx use1 bind
adamc@148 30 -> xml ctx (use1 ++ use2) bind
adamc@91 31
adamc@110 32 con xhtml = xml [Html]
adamc@139 33 con page = xhtml [] []
adamc@110 34
adamc@140 35 con html = [Html]
adamc@140 36 con head = [Head]
adamc@140 37 con body = [Body]
adamc@141 38 con lform = [Body, LForm]
adamc@93 39
adamc@140 40 val head : unit -> tag [] html head [] []
adamc@140 41 val title : unit -> tag [] head [] [] []
adamc@110 42
adamc@140 43 val body : unit -> tag [] html body [] []
adamc@140 44 con bodyTag = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit
adamc@140 45 -> tag attrs ([Body] ++ ctx) ([Body] ++ ctx) [] []
adamc@141 46 con bodyTagStandalone = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit
adamc@141 47 -> tag attrs ([Body] ++ ctx) [] [] []
adamc@141 48
adamc@141 49 val br : bodyTagStandalone []
adamc@119 50
adamc@140 51 val p : bodyTag []
adamc@140 52 val b : bodyTag []
adamc@140 53 val i : bodyTag []
adamc@140 54 val font : bodyTag [Size = int, Face = string]
adamc@140 55
adamc@140 56 val h1 : bodyTag []
adamc@140 57 val li : bodyTag []
adamc@140 58
adamc@140 59 val a : bodyTag [Link = page]
adamc@140 60
adamc@141 61 val lform : ctx ::: {Unit} -> [Body] ~ ctx -> bind ::: {Type}
adamc@141 62 -> xml lform [] bind
adamc@141 63 -> xml ([Body] ++ ctx) [] []
adamc@153 64 con lformTag = fn ty :: Type => fn inner :: {Unit} => fn attrs :: {Type} =>
adamc@141 65 ctx ::: {Unit} -> [LForm] ~ ctx
adamc@141 66 -> nm :: Name -> unit
adamc@153 67 -> tag attrs ([LForm] ++ ctx) inner [] [nm = ty]
adamc@153 68 val textbox : lformTag string [] []
adamc@155 69 val password : lformTag string [] []
adamc@153 70 val ltextarea : lformTag string [] []
adamc@153 71
adamc@153 72 con radio = [Body, Radio]
adamc@153 73 val radio : lformTag string radio []
adamc@153 74 val radioOption : unit -> tag [Value = string] radio [] [] []
adamc@142 75
adamc@154 76 con select = [Select]
adamc@154 77 val lselect : lformTag string select []
adamc@154 78 val loption : unit -> tag [Value = string] select [] [] []
adamc@154 79
adamc@142 80 val submit : ctx ::: {Unit} -> [LForm] ~ ctx
adamc@142 81 -> use ::: {Type} -> unit
adamc@142 82 -> tag [Action = $use -> page] ([LForm] ++ ctx) ([LForm] ++ ctx) use []