Hi Philip,

On 28 August 2011 23:44, Philip Holzenspies <pkfh@st-andrews.ac.uk> wrote:
import Data.Typeable

data MyADT m = MyADT (m ())

instance (Typeable1 m, Monad m) => Typeable (MyADT m) where
       typeOf t@(MyADT _)
        = mkTyCon "MyADT"
         `mkTyConApp`
         [typeOf1 ((return :: Monad m => MyADT m -> m (MyADT m)) t)]

IIRC, typeOf is supposed to work with undefined as the argument.

Try: typeOf (undefined :: Int)

See: http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-Typeable.html#v:typeOf

I think the undefined is merely because the pattern matching you use in the instance declaration fails.

Hope this helps,
Ozgur