Proposal #3339: Add (<>) as a synonym for mappend

Edward Kmett ekmett at
Sun Aug 14 22:15:45 CEST 2011

On Sun, Aug 14, 2011 at 12:44 PM, Yitzchak Gale <gale at> wrote:

> Malcolm Wallace wrote:
> > For instance, although I can guess at "sconcat", what semantics is
> "replicate1p" supposed to have?

A semigroup is just an associative operator.

sconcat is analogous to mconcat, providing a potentially optimized traversal
over a non-empty list. Not necessarily in theory, but in practice quite

replicate1p needs to be renamed, but it repeats an element (n + 1) times
using peasant multiplication, taking advantage of the associativity to get
away with using (<>) only log n times.

replicate1p 0 a = a
replicate1p 1 a = a <> a
replicate1p 3 a = (a <> a) <> (a <> a)


I am happy to spend some time working on the documentation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list