
12 Apr
2009
12 Apr
'09
3:42 p.m.
i am trying to figure out how typeable works, so i have this data type data Foo = FooC Int deriving (Data, Typeable, Show) So how come this works:
funResultTy (typeOf ((+) 1)) (typeOf 1) Just Integer
but this doesnt:
funResultTy (typeOf FooC) (typeOf 1) Nothing
FooC is of type t -> u and 1 is of type t so the result should be u? I don't think t and u need to be the same since
funResultTy (typeOf (\a -> a:[1])) (typeOf 1) Just [Integer]
works fine. So given a constructor, how come i cant seem to construct a type out of it?