[Haskell-cafe] Re: Re: (liftM join .) . mapM

Maciej Piechotka uzytkownik2 at gmail.com
Tue Dec 29 19:07:21 EST 2009


On Tue, 2009-12-29 at 23:00 +0000, Conor McBride wrote:
> Hi Maciej
> 
> On 29 Dec 2009, at 20:52, Maciej Piechotka wrote:
> 
> > On Tue, 2009-12-29 at 18:20 +0000, Conor McBride wrote:
> >>
> >>   ala AppLift foldMap
> >
> > What is benefit of it over:
> > concatMapA f = foldr (liftA2 mappend . f) (pure mempty)
> 
> Given that applicative functors take monoids to monoids, it's
> nice to exploit that property by name, rather than reconstructing
> it by engineered coincidence.

I wouldn't state it as 'coincidence'. I don't need to create explicit
map where implicit (liftA2 mappend and pure mempty) is sufficient. In
this case I have one line when you have many (however it might be other
case with more complicated examples - but I don't quite see how)[1].

Also I'm not quite sure if ala is something general and therefore should
be exposed instead of just putting it. But I may be wrong

Regards

[1]
http://www.willamette.edu/~fruehr/haskell/evolution.html ;)





More information about the Haskell-Cafe mailing list