annotate lib/basis.lig @ 140:f214c535d253

A simpler context encoding
author Adam Chlipala <adamc@hcoop.net>
date Sun, 20 Jul 2008 10:40:25 -0400
parents adfa2c7a75da
children 63c699450281
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@139 12 val cdata : ctx ::: {Unit} -> use ::: {Type} -> bind ::: {Type} -> string -> xml ctx use bind
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@140 35 con form = [Body, Form]
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@119 43
adamc@140 44 val p : bodyTag []
adamc@140 45 val b : bodyTag []
adamc@140 46 val i : bodyTag []
adamc@140 47 val font : bodyTag [Size = int, Face = string]
adamc@140 48
adamc@140 49 val h1 : bodyTag []
adamc@140 50 val li : bodyTag []
adamc@140 51
adamc@140 52 val a : bodyTag [Link = page]
adamc@140 53
adamc@140 54 val form : unit -> tag [] [Body] [Form] [] []