
S. Alexander Jacobson
Is is possible to read/show an existentially typed list?
Would it be possible if, instead of using read/show, I defined some variant that relies on the typeof/typeable infrastructure? Is there a way to read in a typename for use in coercing a read?
Dylan Thurston and I encountered this problem a while ago. Show is easy: just use a type like "exists a. Show a => ...". Read is hard, because one needs to get the Read dictionary from somewhere, and the dynamic typing facility in Haskell does not include type-class constraint reduction at runtime. The best solution we came up with was to replace the existentially typed list with a list of string-string pairs, where the first string names the type and the second string names the value. The call to "read" is only done at lookup time, not at file-reading time. -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig Be it declared and enacted by this present Parliament / That the People of England / are / a Commonwealth and free State / without any King or House of Lords. -- An Act declaring England to be a Commonwealth 1649-05-19 | 355 years | 2004-05-19 http://tinyurl.com/2dqnh