[Haskell-cafe] Monoid wants a (++) equivalent
duncan.coutts at worc.ox.ac.uk
Wed Jul 1 06:38:48 EDT 2009
On Tue, 2009-06-30 at 18:31 -0700, John Meacham wrote:
> On Tue, Jun 30, 2009 at 08:02:48PM -0400, Daniel Peebles wrote:
> > But we don't want to imply it's commutative either. Having something
> > "bidirectional" like <> or <+> feels more commutative than associative
> > to me.
Of course in Text.PrettyPrint, both <> and <+> are associative but not
commutative (with identity empty).
> Not really, think of '++', which doesn't commute but is visually
> symmetric, or Data.Sequence.<>, or the common use of <> to mean
> concatination in pretty printers. I think there is a fair amount of
> precedence for using '<>' actually. As it appears when it is used, it
> is also the natural mappend operator for the Monoid instance.
I agree, if we can't use ++ then <> is the next best thing. As John says
it's already a monoid operator for Data.Sequence and Text.PrettyPrint.
More information about the Haskell-Cafe