
13 Jan
2006
13 Jan
'06
5:31 a.m.
On Thu, 12 Jan 2006 Jeff.Harper@handheld.com wrote:
What does the Haskell type system do with expressions such as these . . . ? show 1 show (1+2)
The type of the subexpressions "1" and "1+2" are "ambiguous" since they have type "(Num a) => a". I'm under the assumption before "1+2" is evaluated, the "1" and "2" must be coerced into a "concrete" type such as Int, Integer, Double, etc, and before "show 1" is evaluated, the "1" must be coerced into a "concrete" type. Is my assumption correct?
Yep. If you start ghc with -Wall option then it also tells you that some automatism is invoked.