
On Thu, 2004-08-26 at 20:52, Ralf Laemmel wrote:
Hi Simon,
I think you should be able to succeed with Scrap your boilerplate. (I am not sure that you need existentials.)
For the overall XmlIsh style of type erasue and type validation see the XmlIsh example at: http://www.cs.vu.nl/boilerplate/
The main requirements for the XML serializer are; 1) It should be scalable; so users should be able to import a compile module with the basic XML infrastructure and add serializers for new Complex and Simple (i.e. leaf node) types. 2) It should be optionally typeable; there exists several systems for typing an XML document, the most prominent of which is XSD. The main requirement is that if the XML tree is to be typed, clearly each node in the tree must be associated with mapping to an XSD name and name-space (2 Strings) or some other data items if typing by another system. The way I was planning on doing this was using a class; XSDType a with functions xsdType :: a -> String and xsdNS :: a -> String. Then at serialisation if a particular type and all it's constituent types were XSD Typeable, extra data (i.e. an extra attribute type="nsp:name") can (again optionally) be inserted into the tree. The XmlIsh example uses a number of functions for serialising different data-types down the tree. I'm not sure how scalable doing it this way would be; can you integrate a type-class system with it? The other problem is dealing with Schematic extensions, such as SOAP Arrays which have the requirement that the elements are always typeable but should not be part of the core serialiser. My other question is, section 7 only mentions polymorphic types which hold constraints Data, Typeable and Typeable1; can the new Generics deal with other polymorphic constraints? This is the main problem; the type-class system can deal fine with just serialisation of data-type content, it just doesn't seem to be able to handle an optional type-system. Ideally I need to produce a system where one XML namespace maps to one module and that module provides data-types, serialisers and typers for the given XML types, such that other modules which use those data-types themselves should be able to import that module and its serialisers to (heuristically) build serialisers for itself. -Si.