[Haskell-cafe] what I learnt from my first serious haskell programm

Bulat Ziganshin bulat.ziganshin at gmail.com
Tue Mar 20 12:57:55 EDT 2007


Hello Fawzi,

Tuesday, March 20, 2007, 5:37:45 PM, you wrote:

> ambiguous function call at line xxx.
> Possible instances are:
>     f: Int -> String -> Double -> a
>     f: String -> Int -> [Int] -> a
> please explicitly annotate the type to disambiguate

> Note that you want to use also the type of the result to disambiguate.
> Not easy, but doable, and done, again I can understand why haskell did
> not do it.

you not yet realize the whole problem :)  in traditional languages,
all type information flows in one direction and when compiler see f(x,y,z)
call, it already knows x/y/z types because they should be declared
earlier. but in haskell types of these variable may be defined by
subsequent calls. so imagine several such overloaded calls - "f x y z",
then "g (h x) (h y)", and more and more. error messages will become so
complicated that you will shoot the compiler :)

-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list