Extensible Serialization class with type classes

Ralf Laemmel Ralf.Laemmel at cwi.nl
Thu Aug 26 15:52:54 EDT 2004


Simon David Foster wrote:

>I've been trying to put together a type-class based serialization (XML)
>for types in GHC. Essentially the serializer class takes the form
>  
>
...

>The Third attempt was to use existential types to encapsulate a
>constrained polymorphic type and use Typeable + Generics to choose
>between a number of functions. This though doesn't work either, since
>each value down the type tree needs to be of the appropriate monomorphic
>existentially quantified type since polymorphic types aren't Typeable.
>  
>
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/

Regarding Typeable and polymorphism,
see the 2nd boilerplate paper:
in particular Section 7.
Same web site.

For paper, you need to a recent GHC build (April 2004 or later).

Regards,
Ralf




More information about the Glasgow-haskell-users mailing list