<div dir="ltr">The most likely path forward would bring in:<div><br></div><div>class Semigroup a where</div><div>  (<>) :: a -> a -> a</div><div>  (... and sconcat :: NonEmpty a -> a probably hidden in a submodule to avoid bringing NonEmpty into Prelude, and times1p possibly bikeshedded to stimes1p for naming consistency, both probably exiled to Data.Semigroup)</div><div><br></div><div>class Semigroup a => Monoid a where</div><div>  mappend :: a -> a -> a</div><div>  mappend = (<>)</div><div><br></div><div>  mempty :: a</div><div><br></div><div><div>with a path towards eventually removing mappend from Monoid in 7.18+, which would get you more or less to your ObBikeshed in the long run, minus a couple of things, plus a couple of others.</div></div><div><br></div><div>(and possibly a top level mtimes can then be defined in terms of stimes1p and mempty, giving peasant exponentiation for log time construction of many monoids and O(1) for idempotent ones.)</div><div><br></div><div>As an aside: having a concat that is parameterized on Foldable on the other hand as a member of the class actually turns out to almost paradoxically prevent you from doing almost any optimizations for it. (I say almost, since because we added some members to Foldable in 7.10 this isn't quite the case any more.) Also to fold you need at least one member, so Foldable/[] is too weak.</div><div><br></div><div>-Edward</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 6, 2015 at 11:15 PM, wren romano <span dir="ltr"><<a href="mailto:winterkoninkje@gmail.com" target="_blank">winterkoninkje@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm +1 for getting the Prelude to eventually say:<br>
<br>
    class Semigroup a where<br>
        mappend :: a -> a -> a<br>
        mconcat :: [a] -> a<br>
<br>
    (<>) = mappend<br>
    infixr 6 <><br>
<br>
    class Semigroup a => Monoid a where<br>
        mempty :: a<br>
<br>
    instance Semigroup a => Monoid (Maybe a) where...<br>
<br>
<br>
The long path seems the most sensible way to get here with a minimum<br>
of breakage. Tis a shame it'll take so long to complete.<br>
<br>
<br>
<br>
<br>
(ObBikeshed: Honestly, I'd rather see:<br>
<br>
    class Semigroup a where<br>
        (<>) :: a -> a -> a<br>
        concat :: [a] -> a -- or: concat :: Foldable f => f a -> a<br>
<br>
...getting rid of the mwhatever naming scheme and avoiding taking two<br>
names for one function. The name "concat" is pretty ubiquitously used<br>
for monomorphic variants of the [a]->a type. The notable exception<br>
being Foldable.concat, which relies specifically on using the [a]<br>
semigroup for no especially interesting reason I can discern. But I'm<br>
pretty sure that ship has sailed unless we give up hope of providing a<br>
breakage-free upgrade path.)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Live well,<br>
~wren<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br></div>