<div>A more direct translation is the following, which is a little more clunky than but has the exact same structure as the original.</div><div><br></div><div>fun mymodule items = <xml></div><div> <h3>title</h3></div><div> {if null items</div><div> then <p>Sorry, no items left</p></div><div> else <xml></div><div> <ul></div><div> {List.mapX (fn item =></div><div> <xml><li><b>{[item]}</b><</li></xml>)}</div><div> </ul></div><div> </xml>}</div><div></xml><br><br>At the moment, the only place to learn about List.mapX and friends is by looking through <span></span>the .urs files in lib/ur, though the types of most of the functions make clear what they do.</div><div><br><br>On Thursday, June 18, 2015, Gabriel Riba <<a href="mailto:gabriel@xarxaire.com">gabriel@xarxaire.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Correction:<br>
<br>
his indented xml has been designed as a template system for the yesod web framework (<a href="http://www.yesodweb.com/" target="_blank">http://www.yesodweb.com/</a>).<br>
<br>
Lets make a comparison with equivalent code:<br>
<br>
(* --- hamlet style template *)<br>
<br>
fun mymodule items = <ixml><br>
<h3> title<br>
<div><br>
$if {null items}<br>
<p> Sorry, no items left<br>
$else<br>
<ul><br>
$forall {item} <- {items}<br>
<li> <b>{[item]}</b><br>
</ixml><br>
<br>
(* ---------- without hamlet ---- *)<br>
<br>
val emptyListSnippet = <xml><br>
<p> Sorry, no items left</p><br>
</xml><br>
<br>
fun listItemSnippet item = <xml><br>
<li> <b>{[item]}</b> </li><br>
</xml><br>
<br>
fun listSnippet items =<br>
List.foldr join <xml/> <|<br>
List.map listItemSnippet items<br>
<br>
fun mymodule items =<br>
<xml><br>
<h3>title</h3><br>
<div> { if null<br>
then emptyListSnippet<br>
else <xml><br>
<ul><br>
{listSnippet items}<br>
</ul><br>
</xml><br>
}<br>
</div><br>
</xml><br>
<br>
<br>
_______________________________________________<br>
Ur mailing list<br>
<a>Ur@impredicative.com</a><br>
<a href="http://www.impredicative.com/cgi-bin/mailman/listinfo/ur" target="_blank">http://www.impredicative.com/cgi-bin/mailman/listinfo/ur</a><br>
</blockquote></div>