[Haskell-cafe] Dynamics/Read and Existential types (was: Is it possible to read existential types?)

S. Alexander Jacobson haskell at alexjacobson.com
Thu Apr 29 15:57:31 EDT 2004

So let me ask this question a different way.  Is
it possible to use Read/Show or Typeable with
Existential types.

Given MyClass and MyType as follows:

   class (Read a,Show a,Typeable)=>MyClass a where foo::a

   type MyType = forall a. MyClass a=> [a]

Is there a way to persist MyType?

My suspicion is that there isn't because Haskell
knows how to say that a string can't be parsed
into a particular type but it does not know how to
say that a string can't be parsed into any type
that is an instance of a particular class.  So,
assuming you can't I amn curious to know know if
this is an in-principle problem or just an in-fact


S. Alexander Jacobson                  mailto:me at alexjacobson.com
tel:917-770-6565                       http://alexjacobson.com

More information about the Haskell-Cafe mailing list