[Haskell-beginners] Search for docs on operator '<+>'.

Brent Yorgey byorgey at seas.upenn.edu
Wed Nov 9 19:24:54 CET 2011


On Wed, Nov 09, 2011 at 07:15:18PM +0100, Ertugrul Soeylemez wrote:
> "Allen S. Rout" <asr at ufl.edu> wrote:
> 
> > Google seems to barf on '<+>'.  I've found a haskell "list of
> > operators", and it's not mentioned.
> >
> > Could some kind soul point me at documentation for this thing?
> 
> This is the combination operator from the ArrowPlus type class for
> arrows, which can be combined in a monoidic fashion.  It corresponds to
> (<|>) from the Alternative type class and in fact you can give a trivial
> Alternative instance for every arrow that is both ArrowPlus and
> ArrowZero.  Reasonable laws would be:
> 
>     zeroArrow <+> a = a <+> zeroArrow = a
> 
> But I don't think that's official.

Let me point out again, just so the OP is not confused: it completely
depends where you saw the <+>.  There is no "standard" meaning,
although the ArrowPlus one that Ertugrul mentions is common.  But you
could have seen it in some module where the author defines <+> to mean
something completely different.  Until you tell us where you saw this
<+> we cannot really help.

In fact, Allen, I now recall seeing you on the xmonad mailing list --
perhaps you saw <+> in an xmonad config?  In that case, indeed, it is
NOT the ArrowPlus operator, but something defined by xmonad.  In the
context of xmonad, <+> is used for combining ManageHooks (actually, it
can be used to combine any two things which have a type that is an
instance of the 'Monoid' type class, but is most commonly used for
ManageHooks).

-Brent



More information about the Beginners mailing list