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

Fawzi Mohamed fmohamed at mac.com
Tue Mar 20 14:20:49 EDT 2007


Bulat Ziganshin wrote:
> 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 :)
>
>   
Yes looking at the paper describing the type system of aldor
    http://www.aldor.org/mediawiki/index.php/Reports
(I had used it 5 years ago before abandoning it because it was closed
source and did not work on mac) indeed there are quite some differences,
for example no parametric polymorphism, but types (and just about
everything) are values so you can have something similar by passing the
explicit type to a function that generates modules or other functions.

Fawzi



More information about the Haskell-Cafe mailing list