
9 Apr
2001
9 Apr
'01
9:52 a.m.
Hello, 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 Integer 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, Thomas