[Haskell-cafe] understanding typeable

Anatoly Yakovenko aeyakovenko at gmail.com
Mon Apr 13 01:18:40 EDT 2009

ah, Int vs Integer, i didn't see that at all.  Thats kind of weird, i
thought 1 could be either one.  This works

> funResultTy (typeOf FooC) (typeOf (1::Int))
Just ParseG.Foo


> funResultTy (typeOf FooC) (typeOf $ fromIntegral 1)


so, how do i actually do something with this?  is there a way that i
can pull out the computation?  Like there is a -> TypeRep, is there a
TypeRep -> a function?  cast doesn't seem to do what i want

> let a::Foo = fromJust $ cast $ fromJust $ funResultTy (typeOf FooC) (typeOf (1::Int))
> a
*** Exception: Maybe.fromJust: Nothing

More information about the Haskell-Cafe mailing list