[Haskell] XML Serialization and type constraints
Simon D. Foster
u1sf at dcs.shef.ac.uk
Wed Aug 25 15:38:51 EDT 2004
On Wed, 2004-08-25 at 16:19, Tomasz Zielonka wrote:
> > Is there anyway of getting around this?
> Perhaps you could just 'encode Id' that parts?
> Best regards,
Ok then, well it looks like this method is going to very cumbersome to
use; for example a context for a reasonably simple complex data-type
(Hook Element t, Hook Bool t, Hook [ERS] t, Hook (Selection ERS) t, Hook
ERS t, Hook (Maybe PackedString) t, Hook PackedString t, Hook
IsQualified t, Hook (Ser t) t, Hook Int t, Hook (Maybe QName) t, Hook
(and baring in mind most of the auto-generated code will have types
namespace qualified making that humongously long).
So I was thinking of another method of doing this;
First of all I though of scrapping the extra type-class and just using a
simple extra parameter; e.g. type Mixer a = a -> (String -> String). But
this doesn't work for any sort of recursive since the a is always
unified with the top-level type. Unless there's someway of getting
Another thought I had was to use an existentially quantified type to
represent the Mix function;
type Mix = forall a . a -> (String -> String)
but I don't think this will allow extra constraints to be brought in.
Is there any other way of doing this without another type-class?
Simon D. Foster <u1sf at dcs.shef.ac.uk>
More information about the Haskell