defaults

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Mon Nov 20 07:05:46 EST 2006


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

The main new proposal is a different way of specifying defaults, which
includes the name of the class being defaulted (thus allowing
user-defined classes to play this game), but unlike the original
proposal, permits only one type to be specified per class.  The rules
are therefore also simpler, whilst still (I believe) capturing the
useful cases.

A secondary proposal is to generalise defaults from having module-local
scope, to global scope.  This would allow library authors to capture the
intended behaviour of their own classes and types, without bothering the
library users.   (Also, whilst removing module-local redefinition of
defaults, the proposal would instead permit function-local
re-definition.)  I am less convinced of the need for this proposal, but
in the spirit of exploring the design space, I thought it worth bringing
up.

Regards,
    Malcolm


More information about the Haskell-prime mailing list