Add flipped fmap

Johan Tibell johan.tibell at gmail.com
Wed Apr 7 10:20:54 EDT 2010


On Wed, Apr 7, 2010 at 4:12 PM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> On Wed, Apr 7, 2010 at 3:58 PM, Felipe Lessa <felipe.lessa at gmail.com> wrote:
>> Simmetry, as the ticket says.
>
> Indeed, I would like to emphasize that my main reason for adding a
> flipped fmap is symmetry. I find it hard to explain why <$$> shouldn't
> be in this list:
>
> (<$>)  ∷ Functor f ⇒ (α → β) → (f α → f β)
> (<$$>) ∷ Functor f ⇒ f α → (α → β) → f β
>
> (<*>)  ∷ Applicative f ⇒ f (α → β) → (f α → f β)
> (<**>) ∷ Applicative f ⇒ f α → f (α → β) → f β
>
> (>>=)  ∷ Monad f ⇒ f α → (α → f β) → f β
> (=<<)  ∷ Monad f ⇒ (α → f β) → (f α → f β)

I think the argument I would make is that (<**>) and (=<<) shouldn't
have been added in the first place. Now, it might not be feasible to
remove them but should we really add flipped versions of everything
because these exists. I understand the Functor feels "close" to
Applicative and Monad somehow but you could make the argument that any
non-commutative operator should now have a flipped versions and there
are more operators than those you listed above.

> Thanks for the excellent discussion so far,

Thank you!

-- Johan


More information about the Libraries mailing list