[Haskell-cafe] Typeable and fancy types

Ron Alford ronwalf at volus.net
Fri Jul 11 12:41:57 EDT 2008

Hey all,
I've reduced my previous problem to a small example. Anyone know why
typeOf (...) would work, but typeOf [...] would not?  Is the
derivation for lists funky?

data Expr f = In (f (Expr f))
instance Typeable1 f => Typeable (Expr f) where
    typeOf (In x) = mkTyConApp (mkTyCon "TypeTest.Expr") [typeOf1 x]

data Foo e = Foo
deriving instance Typeable1 Foo

*TypeTest> typeOf (In Foo)
TypeTest.Expr TypeTest.Foo
*TypeTest> typeOf [In Foo]
*** Exception: Prelude.undefined
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TypeTest.hs
Type: application/octet-stream
Size: 398 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080711/bc60e228/TypeTest.obj

More information about the Haskell-Cafe mailing list