How to convert the type signature of a variable to a String?

Pasch, Thomas (ACTGRO)
Mon, 9 Apr 2001 11:52:47 +0200


it is possible to write

  module Main(main) where

  import Dynamic

  main = putStrLn ( show ( typeOf (f (1::Integer))))

  f x = x

The output is of course 

But the typeOf will only work for 'concrete' data types.
It will not work for functions. So I can't write

  main = putStrLn ( show ( typeOf (f)))

Thus it is possible to write a function that recognize functions, i.e.

  functionType arg = case arg of
    (arg:: a->b) -> "function"

So the question is: Is is possible to write a function the gives
back a String with the signature of the argument of that function?

For example:

 'function f' gives the String "a->a" 

Best regards,