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

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Mon Jan 27 13:29:28 UTC 2014


On Mon, Jan 27, 2014 at 12:32:04PM +0000, Mateusz Kowalczyk wrote:
> On 27/01/14 12:26, Henning Thielemann wrote:
> > Am 27.01.2014 13:23, schrieb Joachim Breitner:
> >> Hi,
> >>
> >> Am Montag, den 27.01.2014, 11:42 +0100 schrieb Sjoerd Visscher:
> >>> 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?
> >>
> >> maybe cases where you implement mconcat for performance reasons anyways
> >> (but are there good examples for that?),
> > 
> > I think it is useful to define a custom mconcat in cases where it 
> > matters whether it is a left or a right fold.
> > 
> >  > and then you don’t want to be bothered with the simple cases....
>
> You can still define your own mconcat and not use the default
> definition. There's no case for this proposal from that aspect.

Sure, but if you are going to define your own mconcat for performance
reasons, it would then be nice not to *have to* define your own mappend, or
mempty.

Tom


More information about the Libraries mailing list