Great, that works, though it makes my head hurt a little.
I'm curious about the restriction that formlet placements have to be
directly within a page (by which I guess you mean no intervening {}
brackets). Could this restriction in principle be lifted (at least
for simple cases like my situation where I want to make a bunch of
formlets using a for loop)?
Another, related question: Assuming {| - |} brackets are meant to
allow a Page to be embedded into an Xml value, why can't we do this
instead:
page
<html>
<body>
{
for (x <- tbl)
<#>{|
page <#>{f => main}</#>
|}</#>
}
</body>
</html>
This seems to have the same effect as the concatPages approach, but
avoids explicitly building a list and then traversing it. But this
also gives me an Undefined_recursive_module error. In fact, this
happens even if I get rid of the formlet stuff and just stick some
random XML inside the inner {} block. So I guess formlets were a red
herring here.
Here's a smaller example demonstrating the Undefined_recursive_module
error:
<foo> {| page <bar/>|}</foo>
Indeed, even doing this:
sig pageToXml : (Page) ~> Xml
fun pageToXml(p) {
<#>{|p|}</#>
}
yields an error, this time:
*** Error: File "sugartoir.ml", line 771, characters 14-20: Assertion
failed
(This is in links 0.5.0.)
But looking at the prelude, the function renderPage : (Page) ~> Xml
also seems to do what I need. So maybe it would be enough to desugar
<#>{|p|}</#> to renderPage(p)?
--James
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
_______________________________________________
links-users mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/links-users