Mercurial > urweb
view 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 |
line wrap: on
line source
type int type float type string type unit = {} con tag :: {Type} -> {Unit} -> {Unit} -> {Type} -> {Type} -> Type con xml :: {Unit} -> {Type} -> {Type} -> Type val cdata : ctx ::: {Unit} -> use ::: {Type} -> string -> xml ctx use [] val tag : attrsGiven ::: {Type} -> attrsAbsent ::: {Type} -> attrsGiven ~ attrsAbsent -> ctxOuter ::: {Unit} -> ctxInner ::: {Unit} -> useOuter ::: {Type} -> useInner ::: {Type} -> useOuter ~ useInner -> bindOuter ::: {Type} -> bindInner ::: {Type} -> bindOuter ~ bindInner -> $attrsGiven -> tag (attrsGiven ++ attrsAbsent) ctxOuter ctxInner useOuter bindOuter -> xml ctxInner useInner bindInner -> xml ctxOuter (useOuter ++ useInner) (bindOuter ++ bindInner) val join : ctx ::: {Unit} -> use1 ::: {Type} -> bind1 ::: {Type} -> bind2 ::: {Type} -> use1 ~ bind1 -> bind1 ~ bind2 -> xml ctx use1 bind1 -> xml ctx (use1 ++ bind1) bind2 -> xml ctx use1 (bind1 ++ bind2) con xhtml = xml [Html] con page = xhtml [] [] con html = [Html] con head = [Head] con body = [Body] con lform = [Body, LForm] val head : unit -> tag [] html head [] [] val title : unit -> tag [] head [] [] [] val body : unit -> tag [] html body [] [] con bodyTag = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit -> tag attrs ([Body] ++ ctx) ([Body] ++ ctx) [] [] con bodyTagStandalone = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit -> tag attrs ([Body] ++ ctx) [] [] [] val br : bodyTagStandalone [] val p : bodyTag [] val b : bodyTag [] val i : bodyTag [] val font : bodyTag [Size = int, Face = string] val h1 : bodyTag [] val li : bodyTag [] val a : bodyTag [Link = page] val lform : ctx ::: {Unit} -> [Body] ~ ctx -> bind ::: {Type} -> xml lform [] bind -> xml ([Body] ++ ctx) [] [] con lformTag = fn ty :: Type => fn attrs :: {Type} => ctx ::: {Unit} -> [LForm] ~ ctx -> nm :: Name -> unit -> tag attrs ([LForm] ++ ctx) [] [] [nm = ty] val textbox : lformTag string [] val submit : ctx ::: {Unit} -> [LForm] ~ ctx -> use ::: {Type} -> unit -> tag [Action = $use -> page] ([LForm] ++ ctx) ([LForm] ++ ctx) use []