
11 Jul
2008
11 Jul
'08
1:13 p.m.
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.