Fergus Henderson <[EMAIL PROTECTED]> writes:

> On the Standard Haskell site,
> Alastair Reid wrote:
> > 
> > 1) Fixity declarations usually look like this:
> > 
> >       infixl 6 +, -
> > 
> >    but you can omit the precedence digit and write this instead:
> > 
> >       infixl +, -
> > 
> >    The programmer who uses this avoids having to type 2 characters.
> >    The programmers who'sre reading this code has to learn that 
> >    the precedence digit can be omitted (I didn't believe it when I
> >    first saw it) and then look up the default precedence in the report.
> >    I think it is harder to understand programs that use this shortcut
> >    and that it should be removed.
> 
> I don't think it's harder.  Even if the number is specified explicitly,
> I would *still* have to look up the precedence table in the report,
> or at least grep the source for the standard prelude, because
> I don't know what the precedence of the other operators is.

I think you're missing the point.  Omitting the precedence digit is
important because it allows the programmer to avoid making a decision
about something he doesn't really care about.  Most of the time,
you're not interested in the relative precedence of `thenP` vs. (+),
since it doesn't make any sense to mix them.

If you really *want* a precedence of 9 (or whatever the default is),
one would never dream of leaving it out of the declaration.

ObStandardHaskellProposal: relax the restriction on precedences being
in the range 0-9.  Change the precedences of the Prelude operators
from n to n*100.

Cheers,
        Simon

-- 
Simon Marlow                                             [EMAIL PROTECTED]
University of Glasgow                       http://www.dcs.gla.ac.uk/~simonm/
finger for PGP public key


Reply via email to