Ron Alford wrote:
instance Typeable1 f => Typeable (Expr f) where
typeOf (In x) = mkTyConApp (mkTyCon "TypeTest.Expr") [typeOf1 x]
typeOf ~(In x) = mkTyConApp (mkTyCon "TypeTest.Expr") [typeOf1 x]
Lazy patterns are jolly useful here.
Remember that typeOf will be usually called on _|_, so it must not
inspect its argument.
Also, dummy functions such as
getC :: Foo a b c d -> c
getC _ = undefined
can be exploited in
typeOf x = ... typeOf (getC x) ...
Zun.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe