[Haskell-cafe] Numeric vs. relative precedences of infix operators

Benjamin Franksen benjamin.franksen at bessy.de
Tue Mar 1 21:03:18 EST 2005


On Tuesday 01 March 2005 15:28, Henning Thielemann wrote:
> On Mon, 28 Feb 2005 ajb at spamcop.net wrote:
> > G'day all.
> >
> > Quoting karczma at info.unicaen.fr:
> > > "Widely accepted" is a widely accepted relativism...
> > > I am also annoyed by the precedences 0,1,2, ...,9, etc.
> > >
> > > Why not 10, 20, 30,... ??
> >
> > I _think_ we had this back around Haskell 1.1 (which I never used, but
> > early Gofers also had it).  Moreover, operators could also have arbitrary
> > "fixity" (prefix, infix, postfix).
> >
> > I'm not sure why this feature was dropped,
>
> Because of readability I don't plead for arbitrary "fixities", I think the
> current solution of infix operators in Haskell is enough. There is really
> no advantage of "n !" over "faculty n".

There is a good argument for 'distfix' i.e. bracketing operators, IMO. You 
could define your own if_then_else:

	`if cond `then` truebranch `else` falsebranch end`

(Syntax, terminology, and example stolen from "Macros and Preprocessing in 
Haskell", (1999) by Keith Wansbrough, see 
http://citeseer.ist.psu.edu/wansbrough99macros.html)

Ben


More information about the Haskell-Cafe mailing list