[Proposal] Add default implementation of mappend/mempty in terms of mconcat

Sjoerd Visscher sjoerd at w3future.com
Mon Jan 27 10:42:32 UTC 2014


This seems rather pointless; I’m having trouble coming up with an example where mconcat would be easier or more elegant to implement. Do you have an example?

On 24 Jan 2014, at 22:42, Niklas Haas <haskell at nand.wakku.to> wrote:

> Hello,
> 
> I noticed that the current Monoid class doesn't actually provide default
> implementations of mappend/mempty in terms of mconcat, even though this
> is technically very simple:
> 
>> mempty = mconcat []
>> mappend a b = mconcat [a, b]
> 
> This would be a rather small and non-invasive change that shouldn't
> break any existing programs. The main downside is that an empty Monoid
> declaration would produce no warnings, but #7633 gives us the ability to
> solve this.
> 
> Discussion period: 2 weeks
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list