
On Mon, Apr 13, 2009 at 1:37 AM, Anatoly Yakovenko
any idea why this is True
data Foo = FooC Int | BarC Int deriving (Data, Typeable, Show)
fromJust $ funResultTy (typeOf FooC) (typeOf (1::Int)) Loading package syb ... linking ... done. ParseG.Foo typeRepTyCon $ fromJust $ funResultTy (typeOf FooC) (typeOf (1::Int)) ParseG.Foo let a = typeRepTyCon $ fromJust $ funResultTy (typeOf FooC) (typeOf (1::Int)) :t a a :: TyCon typeRepTyCon $ typeOf $ BarC 2 ParseG.Foo let b = typeRepTyCon $ typeOf $ BarC 2 a == b True
They're both representing Foo.
I thought that TyCon can distinguish constructors. it seems no different then a typerep
TyCon distinguishes *type* constructors, like [] and Maybe and (->).
FooC and BarC are *data* constructors. Typeable can't distinguish them
directly. You either need to cast to Foo and then pattern-match, or
use Data.
--
Dave Menendez