Hi Jakob,

On 06/11/2011 20:43, Jakob Praher wrote:
Dear list,

I have tried to make a comprehension returing Xml, like the following:

sig toXml: ([String]) ->  Xml
fun toXml(goals) {
<#>
   {
      for (goal<- goals) {
         [stringToXml(goal)]
      }
   }
</#>
}

Is there a way to convert lists of Xml to Xml. IMHO a fragment is
actually a list of Xml nodes.

The type Xml is actually an alias for [XmlItem]. So if you just remove the list singleton list constructor from your example then it will type-check.

Another questions: Is there support for recursive variant data structures?
e.g.
    typename Tree = [|Leaf:() | Branch: (Tree, Tree)|]

$ links tree.links
yields
*** Fatal error : Unbound type constructor Tree

Yes. (Equi)-recursive types are specified using explicit 'mu' binders. For your example you could write something like this:

  typename Tree = mu t.[|Leaf:() | Branch: (t, t)|];

Sam
_______________________________________________
links-users mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/links-users

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

Reply via email to