[Haskell-cafe] Fixity of >>>
Donald Bruce Stewart
dons at cse.unsw.edu.au
Thu Jul 26 11:37:53 EDT 2007
ross:
> On Fri, Jul 27, 2007 at 12:08:30AM +1000, Donald Bruce Stewart wrote:
> > There's a theory this should work:
> >
> > getContents >>= lines >>> map read >>> sum >>> print
> >
> > But unfortunately we have:
> >
> > `(>>=)' [infixl 1]
> > `(>>>)' [infixr 1]
> >
> > Meaning we must write:
> >
> > getContents >>= (lines >>> map read >>> sum >>> print)
> >
> > Indeed, all Arrow ops are infixr.
> > Are there any technical/compelling reasons for this?
>
> Not that I can recall. But it's the precedence rather than the
> associativity that's bothering you here.
Yes, I suppose it is a vote for 0.5 precedence, if they're not to
behave as for >> and >>= ? Which are:
infixl 1 >>, >>=
So I can write:
print 'x' >> getChar >>= ord >>> print
-- Don
More information about the Haskell-Cafe
mailing list