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

Lennart Augustsson lennart at augustsson.net
Tue Mar 20 18:42:07 EDT 2007


The nice thing about Haskell's overloading is that every function,  
like f, has a type.
Not two different types, but one general type you can give it.  It's  
a different approach to overloading.

	-- Lennart

On Mar 20, 2007, at 14:37 , Fawzi Mohamed wrote:

> Bulat Ziganshin wrote:
>> Hello Fawzi,
>>
>> Tuesday, March 20, 2007, 1:47:48 PM, you wrote:
>>
>>
>>> That was the reason that is spoke of aldor ( http:// 
>>> www.aldor.com ), as
>>>
> ehm http://www.aldor.org
>>> it has type inference, but yes indeed this makes type inference  
>>> much more difficult and undefined in some cases (also haskell  
>>> extensions make
>>> inference in general impossible).
>>>
>>
>> the problem is not only implementation, but error messages. are you
>> want to see a message like "a should be Int, b should String, and ñ
>> should be Double; or x should be String and y Int; or ñ should be
>> [Int]" ? :)
>>
> 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.
>
> Fawzi
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list