[Ur] Hamlet like XML, structured by indentation with tag autoclosing
Gabriel Riba
gabriel at xarxaire.com
Sat Jun 20 07:43:16 EDT 2015
Correction:
El 18/06/15 a les 23:55, Ziv Scully ha escrit:
> As far as I can see, the proposed changes do 3 things:
>
> (1) Add a few new things especially for layout (the forall/foreach/etc.
> sort of thing).
> (2) Make normal XML a bit nicer by eliminating closing tags.
> (3) Make XML mixed with Ur/Web "macros" less clunky by eliminating some
> extra {} and <xml></xml> pairs.
>
* First, with structure by indentation with tag autoclosing, the
document tree structure shows clearer. (Your (2))
Check https://hackage.haskell.org/package/hamlet
and
http://www.yesodweb.com/book/shakespearean-templates#shakespearean-templates_hamlet_html
----------------
* Second, you can specify conditional subtrees, subject to decision
logic, making nested xml nicer (Your (3))
$if {cond}
subtree1
$elsif {cond}
subtree2
$else {cond}
subtree3
----------------
* Third, you can specify foldMap traversals of foldable containers
$foldmap {items_expr} <| {item_pattern}
item_subtree embedding {[item_patt_var]}
Haskell differentiates between sequentially enforced traversal
(Data.Traversable) and non-enforced (Data.Foldable) as
non-monadic/applicative code exec. order is not granted sequential.
I am not sure about this need in Ur, but in case, an extra logic
statement could be used.
Other logic statements:
------------------
$case {expression}
$of {pattern}
subtree1 embedding {[patt_var]}
$of {pattern}
subtree1 embedding {[patt_var]}
------------------
$some {option_expression} <| {pattern}
subtree1 embedding {[patt_var]}
$none
subtree2
More information about the Ur
mailing list