
12 Sep
2006
12 Sep
'06
8:28 a.m.
hello all, I've been using existentially quantified data constructors like
data Box = forall a. Cxt a => Box a
quite successfully for a while. But now I am trying to implement the Load/Save mechanism and getting stuck with that. It's not hard to write a Box into a file, but how do I get it back? Has anyone solved the same problem before? I would be very thankful for any suggestions! If Template Haskell would support finding out all instances of a given class, I could generate a function that would map Names of types to appropriate Box readers. In the file I would write entries like <NameOfTypeInTheBox> : <BoxContents> But sadly, TH doesn't allow that yet. Cheers, Misha