[Haskell-cafe] understanding typeable

Anatoly Yakovenko aeyakovenko at gmail.com
Mon Apr 13 01:37:10 EDT 2009


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


I thought that TyCon can distinguish constructors.  it seems no
different then a typerep


More information about the Haskell-Cafe mailing list