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

Fawzi Mohamed fmohamed at mac.com
Tue Mar 20 06:47:48 EDT 2007


Bulat Ziganshin wrote:
> Hello Fawzi,
>
> Monday, March 19, 2007, 8:26:33 PM, you wrote:
>
>   
>> Maybe I did not express me clearly enough, I think that classes are
>> useful (and the language that I was speaking of, aldor, has them), but
>> it is not nice that the only way to have an overloaded function is to 
>> define a type class
>>     
>
> overloading without using type classes (as it is implemented in C++)
> is hardly compatible with type inference. imagine that you has two
> functions:
>
> f :: String -> Int
> f :: Int -> Int
>
> and write (f a). what should be type of a? it becomes a list of
> possible types. because type inference mechanism pushes inferred types
> up and down, the whole information about type of each term will become
> much more complicated. compare this to current requirement to overload
> using only type classes. in this case, you know that 'a' belongs to
> some class, so possible variants don't multiply at each inference step
>   
That was the reason that is spoke of aldor ( http://www.aldor.com ), as 
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).

So I understand the choice of haskell, but still as a user (and not 
implementor :) I think that aldor approach is superior.

Anyway I don't want to make this into a language war, I just pointed out 
something where haskell in my opinion (and from my short experience with 
it) could be improved.
Obviously the perfect language does not exist you always have some trade 
offs to do... still one can always imagine some imprvements... ;-)

Fawzi


More information about the Haskell-Cafe mailing list