The standard package to show functions only returns a constant string:
λ> :m +Text.Show.Functions
λ> show (+1)
"<function>"
GHCi's :type command is much more useful:
λ> :t (+1)
(+1) :: Num a => a -> a
Is it impossible to get such a level of detail at runtime? Does the compilation process leave any kind of information at all about functions, except for them being functions?
Not exactly the same level of details, but you can use typeOf from Data.Typeable:
Prelude> import Data.Typeable
Prelude Data.Typeable> typeOf (+1)
Integer -> Integer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With