defaults

Bernie Pope bjpop at csse.unimelb.edu.au
Mon Nov 27 20:23:51 EST 2006


On 28/11/2006, at 11:28 AM, Ian Lynagh wrote:

> On Mon, Nov 20, 2006 at 12:05:46PM +0000, Malcolm Wallace wrote:
>> Prompted by recent discussion on the Hat mailing list about the  
>> problems
>> of type-defaulting, I have added two new proposals for this issue  
>> to the
>> Haskell-prime wiki at:
>>
>>     http://hackage.haskell.org/trac/haskell-prime/wiki/Defaulting
>
> I don't see a proposal to remove defaulting defaulting altogether on
> that page - has that been discussed already?
>
> Am I the only one who puts an explicit type signature in whenever my
> compiler warns me that it is having to do some defaulting? And  
> probably
> 99% of those would be unnecessary if (^)'s second argument was an Int,
> with a genericPower (or whatever) function providing the current type
> signature (analogous to, for example, (!!) and genericIndex).
>
> Defaulting is one wart I would be glad to be rid of.

I would also be happy if it was removed.

My main reasons are:

1) It makes teaching Haskell more difficult, because it is a special  
case
mechanism. I would prefer consistency here.

2) It makes source-to-source program transformations more difficult, as
found in Hat etc.

3) I have found it easy to avoid with the addition of type annotations.

I don't write a lot of numeric code, so the benefits I personally get  
from defaulting have
so far been minimal, and that has coloured my view. Others may find  
it more
useful.

Cheers,
Bernie.


More information about the Haskell-prime mailing list