Why does Text.Show.Functions only return <function>?

The standard package for displaying functions only returns a constant:

λ> :m +Text.Show.Functions 
λ> show (+1)
"<function>"

      

Command

GHCi is :type

much more useful:

λ> :t (+1)
(+1) :: Num a => a -> a

      

Can't get that level of verbosity at runtime? Does the compilation process describe any information at all about functions, except that they are functions?

+3


source to share


1 answer


Not exactly the same level of detail, but you can use typeOf

from Data.Typeable :



Prelude> import Data.Typeable
Prelude Data.Typeable> typeOf (+1)
Integer -> Integer

      

+3


source







All Articles