ANNOUNCE: yap-0.0 - yet another prelude

Paterson, Ross R.Paterson at city.ac.uk
Tue Aug 16 01:10:52 CEST 2011


Wolfram Kahl writes:
> On Mon, Aug 15, 2011 at 10:00:03AM +0900, Sebastian Fischer wrote:
> >> I see your versions of + and * are infixr rather than infixl.
> >> Is that important?
> >
> > I copied fixities from the Prelude [1] for + and * but don't know why they
> > are infixl there.
>
> > Sorry, I just saw that I confused infixl and infixr in your question. In
> > fact, in my two Semiring modules I use different fixities. infixr in the
> > regexp library and infixl (copied from Prelude) in the (not yet published)
> > library for parallel programming. So apparently, I don't care very much ;)
> >
> > Are there good arguments in favor of or against either choice?
>
> In the presence of - at the same precedence as + you want both to be infixl,
> to get:
>
>   a + b - c + d - e - f  =  ((((a + b) - c) + d) - e) - f
>
> The same for * with /.

Yes: they need to be left associative for backwards compatibility, and
it's an intuitive choice anyway.


More information about the Libraries mailing list