adamc@56: type int adamc@56: type float adamc@56: type string adamc@91: adamc@119: type unit = {} adamc@119: adamc@91: adamc@139: con tag :: {Type} -> {Unit} -> {Unit} -> {Type} -> {Type} -> Type adamc@91: adamc@91: adamc@139: con xml :: {Unit} -> {Type} -> {Type} -> Type adamc@141: val cdata : ctx ::: {Unit} -> use ::: {Type} -> string -> xml ctx use [] adamc@104: val tag : attrsGiven ::: {Type} -> attrsAbsent ::: {Type} -> attrsGiven ~ attrsAbsent adamc@139: -> ctxOuter ::: {Unit} -> ctxInner ::: {Unit} adamc@139: -> useOuter ::: {Type} -> useInner ::: {Type} -> useOuter ~ useInner adamc@139: -> bindOuter ::: {Type} -> bindInner ::: {Type} -> bindOuter ~ bindInner adamc@104: -> $attrsGiven adamc@139: -> tag (attrsGiven ++ attrsAbsent) ctxOuter ctxInner useOuter bindOuter adamc@139: -> xml ctxInner useInner bindInner adamc@139: -> xml ctxOuter (useOuter ++ useInner) (bindOuter ++ bindInner) adamc@140: val join : ctx ::: {Unit} adamc@139: -> use1 ::: {Type} -> bind1 ::: {Type} -> bind2 ::: {Type} adamc@139: -> use1 ~ bind1 -> bind1 ~ bind2 adamc@140: -> xml ctx use1 bind1 adamc@140: -> xml ctx (use1 ++ bind1) bind2 adamc@140: -> xml ctx use1 (bind1 ++ bind2) adamc@148: val useMore : ctx ::: {Unit} -> use1 ::: {Type} -> use2 ::: {Type} -> bind ::: {Type} adamc@148: -> use1 ~ use2 adamc@148: -> xml ctx use1 bind adamc@148: -> xml ctx (use1 ++ use2) bind adamc@91: adamc@110: con xhtml = xml [Html] adamc@139: con page = xhtml [] [] adamc@110: adamc@140: con html = [Html] adamc@140: con head = [Head] adamc@140: con body = [Body] adamc@141: con lform = [Body, LForm] adamc@93: adamc@140: val head : unit -> tag [] html head [] [] adamc@140: val title : unit -> tag [] head [] [] [] adamc@110: adamc@140: val body : unit -> tag [] html body [] [] adamc@140: con bodyTag = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit adamc@140: -> tag attrs ([Body] ++ ctx) ([Body] ++ ctx) [] [] adamc@141: con bodyTagStandalone = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit adamc@141: -> tag attrs ([Body] ++ ctx) [] [] [] adamc@141: adamc@141: val br : bodyTagStandalone [] adamc@119: adamc@140: val p : bodyTag [] adamc@140: val b : bodyTag [] adamc@140: val i : bodyTag [] adamc@140: val font : bodyTag [Size = int, Face = string] adamc@140: adamc@140: val h1 : bodyTag [] adamc@140: val li : bodyTag [] adamc@140: adamc@140: val a : bodyTag [Link = page] adamc@140: adamc@141: val lform : ctx ::: {Unit} -> [Body] ~ ctx -> bind ::: {Type} adamc@141: -> xml lform [] bind adamc@141: -> xml ([Body] ++ ctx) [] [] adamc@153: con lformTag = fn ty :: Type => fn inner :: {Unit} => fn attrs :: {Type} => adamc@141: ctx ::: {Unit} -> [LForm] ~ ctx adamc@141: -> nm :: Name -> unit adamc@153: -> tag attrs ([LForm] ++ ctx) inner [] [nm = ty] adamc@153: val textbox : lformTag string [] [] adamc@153: val ltextarea : lformTag string [] [] adamc@153: adamc@153: con radio = [Body, Radio] adamc@153: val radio : lformTag string radio [] adamc@153: val radioOption : unit -> tag [Value = string] radio [] [] [] adamc@142: adamc@142: val submit : ctx ::: {Unit} -> [LForm] ~ ctx adamc@142: -> use ::: {Type} -> unit adamc@142: -> tag [Action = $use -> page] ([LForm] ++ ctx) ([LForm] ++ ctx) use []