Incoherence
Levent Erkok
erkok@cse.ogi.edu
Thu, 25 Oct 2001 09:47:31 +0000
On Thursday 25 October 2001 07:21 am, John Hughes wrote:
> My proposal is that := should bind *monomorphically* -- just like lambda
> binding. The motivation for that is that a polymorphic function can easily
> become overloaded after a small change to the program, such as adding
> removal of duplicate elements from a list. Such changes shouldn't cause
> wholesale differences in typing -- which the MR currently can. Another way
> to look at it is that = should imply type generalisation (including
> qualification), and
>
> := should mean no generalisation. It's a little odd to support *two kinds*
>
> of generalisation (with and without qualification).
>
> `x := []' wouldn't be problematic, just monomorphic. That is, x must be
> used consistently as a list of a particular type. But that need not prevent
> the type that x has from being inferred from its uses.
Another place where `:=' bindings are badly needed is the recursive do-notation
(mdo, as supported in hugs.) In an mdo, let bindings have to be monomorphic,
because they are passed back to the mfix loop in a lambda binding. Hence, if
we had :=, we can simply say that mdo only allows let bindings of the `:=' form,
and that would clear up the whole issue.
I'm no expert, but I think the new proposal for the arrow notation, if it allows
recursive binding forms, can make use of this facility as well.
Just take this as another vote in favor of `:=' bindings.
-Levent.