[Haskell-cafe] Re: Re: non-total operator precedence order (was:Fractional/negative fixity?)

Benjamin Franksen benjamin.franksen at bessy.de
Fri Nov 10 12:51:44 EST 2006


Henning Thielemann wrote:
> On Fri, 10 Nov 2006, Benjamin Franksen wrote:
>> Although one could view this as a bug in the offending module it makes
>> me somewhat uneasy that one additional import can have such a drastic
>> effect on the code in a module /even if you don't use anything from that
>> module/.
> 
> It's the same as with instance declarations, isn't it? I don't want to
> defend the problems arising with todays anonymous instance declarations,

Right. However, with instances I can imagine solutions that avoid naming
them, that is, I could imagine to write something like

  select instance C T1 T2 ... Tn from module M

or

  import M hiding (instance C T1 T2 ... Tn, ....)

Such a feature could prove extremely useful in practice.

Disclaimer: I am almost sure that there is something I have overlooked that
makes such a simple solution impossible, otherwise it would have been
proposed and implemented long ago...

> but I think a simple error report is better than trying to solve the
> problem automatically and thus hide it from the programmer.

I agree 100% that error is better than silently change ("fix") semantics.
However the fact that there is currently no way to manually resolve
instance clashes coming from imported (library) modules is really
problematic, IMHO. I think the only reason this hasn't yet produced major
upheaval is that Haskell community is still quite small so library writers
can still have most of the field in their eyeview, so to speak. If Haskell
libraries were written and used in multitudes such as seen e.g. on CPAN,
then the probability of conflicting instances would be a lot greater, in
turn causing many libraries to be incompatible with each other. IMHO, this
must be fixed before Haskell reaches even a fraction of that level of
popularity.

Non-total precedence order will give us more potential incompatibilities
that the programmer has no way of resolving satisfactorily, so I'd rather
stick with the current system, however limited. (And yes, I /have/ changed
my mind on this. I'd /love/ to be convinced that this is not really going
to be a problem but I am not and I hate it.)

Cheers
Ben



More information about the Haskell-Cafe mailing list