diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-07-20 10:40:25 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-07-20 10:40:25 -0400 |
commit | 0fe71710d474e4c93392ec9d2069ef36464fbfa0 (patch) | |
tree | 4a158085273dfa721a1dcf645c70d5083aa52ebc /lib/basis.lig | |
parent | d76bf83a5e8eb9a0b4e194f83cfadd8d55c00dfd (diff) |
A simpler context encoding
Diffstat (limited to 'lib/basis.lig')
-rw-r--r-- | lib/basis.lig | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/lib/basis.lig b/lib/basis.lig index 86b01992..bdac9ba0 100644 --- a/lib/basis.lig +++ b/lib/basis.lig @@ -18,29 +18,37 @@ val tag : attrsGiven ::: {Type} -> attrsAbsent ::: {Type} -> attrsGiven ~ attrsA -> tag (attrsGiven ++ attrsAbsent) ctxOuter ctxInner useOuter bindOuter -> xml ctxInner useInner bindInner -> xml ctxOuter (useOuter ++ useInner) (bindOuter ++ bindInner) -val join : sharedCtx :: {Unit} - -> ctx1 ::: {Unit} -> ctx1 ~ sharedCtx - -> ctx2 ::: {Unit} -> ctx2 ~ sharedCtx +val join : ctx ::: {Unit} -> use1 ::: {Type} -> bind1 ::: {Type} -> bind2 ::: {Type} -> use1 ~ bind1 -> bind1 ~ bind2 - -> xml (sharedCtx ++ ctx1) use1 bind1 - -> xml (sharedCtx ++ ctx2) (use1 ++ bind1) bind2 - -> xml sharedCtx use1 (bind1 ++ bind2) + -> xml ctx use1 bind1 + -> xml ctx (use1 ++ bind1) bind2 + -> xml ctx use1 (bind1 ++ bind2) con xhtml = xml [Html] con page = xhtml [] [] -val head : tag [] [Html] [Head] [] [] -val title : tag [] [Head] [] [] [] +con html = [Html] +con head = [Head] +con body = [Body] +con form = [Body, Form] -val body : tag [] [Html] [Body] [] [] -val p : tag [] [Body] [Body] [] [] -val b : tag [] [Body] [Body] [] [] -val i : tag [] [Body] [Body] [] [] -val font : tag [Size = int, Face = string] [Body] [Body] [] [] +val head : unit -> tag [] html head [] [] +val title : unit -> tag [] head [] [] [] -val h1 : tag [] [Body] [Body] [] [] -val li : tag [] [Body] [Body] [] [] +val body : unit -> tag [] html body [] [] +con bodyTag = fn attrs :: {Type} => ctx ::: {Unit} -> [Body] ~ ctx -> unit + -> tag attrs ([Body] ++ ctx) ([Body] ++ ctx) [] [] -val a : tag [Link = page] [Body] [Body] [] [] +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 form : unit -> tag [] [Body] [Form] [] [] |