
On 2005-06-27, Mads Lindstrøm
Hi John
test :: forall a. (Num a) => a test = 2 * 5 + 3
[ snip ]
I had newer seen anybody use "forall a." in function signatures before, and therefore was curious about its effect. This is probably do to my inexperience regarding Haskell. However, I tried to remove it and wrote this instead:
If you omit it, the compiler will decide that test is some arbitrary type (Double, Integer, whatever). While rpnShow, etc. will still work, they will not show you the same thing, since the compiler will have already "optimized" the expression down to one set type. Which compiler or interpreter are you using?
I tried to find documentation about the use of the forall keyword in respect to functions (I do know about it in with respect to existentially quantified types), but with no luck. So, if anybody has some good pointers, please let med know about it.
Note that test in this example is not a function. -- John