Dear Sam, thanks for your quick and perfect answer to my questions.
BTW: When should the arrow ~> be used over -> ? Both can have effects, so I am not sure. (From the visual representation I would say one is maps to and another is leads to ?) Cheers, Jakob Am Montag, 07. November 2011 01:54 CET, Sam Lindley <[email protected]> schrieb: > 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. > _______________________________________________ links-users mailing list [email protected] http://lists.inf.ed.ac.uk/mailman/listinfo/links-users
