[Haskell-cafe] Data.Generics: how do I get the type name of a value?

Neil Mitchell ndmitchell at gmail.com
Fri Dec 14 09:15:56 EST 2007


Hi

> http://haskell.org/hoogle/?q=typeOf
>
> C:\>ghci
> GHCi, version 6.8.1: http://www.haskell.org/ghc/  :? for help
> Loading package base ... linking ... done.
> Prelude> :m Data.Typeable
> Prelude Data.Typeable> typeOf "neil"
> [Char]

Another great thing is that this bit also works in Hugs, while the
Data.Generics stuff is GHC only.

Thanks

Neil


More information about the Haskell-Cafe mailing list