annotate lib/basis.lig @ 186:88d46972de53

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