defaults
Malcolm Wallace
Malcolm.Wallace at cs.york.ac.uk
Wed Nov 29 13:08:14 EST 2006
Bernie Pope <bjpop at csse.unimelb.edu.au> wrote:
> > I don't see a proposal to remove defaulting defaulting altogether on
> > that page - has that been discussed already?
> >
> > Defaulting is one wart I would be glad to be rid of.
>
> I would also be happy if it was removed.
Me too, in some ways. But...
> 1) It makes teaching Haskell more difficult, because it is a special
> case mechanism. I would prefer consistency here.
Unfortunately, I suspect that teaching is _the_ major use-case for
defaulting. Imagine, day one, lesson one, a student types
Prelude> 1+2
into Hugs, and gets the response
Unresolved overloading: Num a
Huh? This is lesson one, and you already need to tell students about
type classes and overloading, before you have even covered simple
expressions fully? I am certain this is the reason why defaulting was
introduced.
> 2) It makes source-to-source program transformations more difficult,
> as found in Hat etc.
Sure, I'd be glad to improve that. Removing defaults altogether would
solve the problem for the average user. But power users like Duncan
would like to _extend_ defaulting to work over GUI type classes, and
that too seems a reasonable request to me. Does my proposal for
revision of defaults allow that, and still make Hat-style transformation
easier? Yes, I think so.
Regards,
Malcolm
More information about the Haskell-prime
mailing list