How to get the type of a value in haskell
encodes each type uniquely at compile time and can be used for this purpose:
import Data.Typeable showType :: Typeable a => a -> String showType = show . typeOf
with the result:
*Main> showType (+) "Integer -> Integer -> Integer" *Main> showType [1..5] "[Integer]" *Main> map showType [1..5] ["Integer","Integer","Integer","Integer","Integer"]
All that said, Beclilr is right. What you really want may be something else, so more information will help us help you.
source to share