Add flipped fmap

Jonathan Cast jonathanccast at fastmail.fm
Thu Apr 8 13:10:45 EDT 2010


On Thu, 2010-04-08 at 14:04 -0300, Felipe Lessa wrote:
> On Thu, Apr 8, 2010 at 9:45 AM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> > I must say that Brent Yorheys comment about (<**>) not being flip
> > (<*>) has made the 'symmetry' argument less convincing and has moved
> > me a bit closer to the - camp. However, I'm still for adding it
> > because it can make code nicer.
> 
> They -- <**> and <$$> -- are symmetric in spirit.

The equational law relating <$> to <*> for Applicative instances is

    f <$> a = return f <*> a

We analogously have

    a <$$> f = a <**> return f

as well.  So the analogy between <$$> and <**> holds.

jcc




More information about the Libraries mailing list