Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there flipped operators for Applicative?

The operators

$
. or <<<
<$>
<*>
=<<
<=<

Go very well together, each in some sense applying something on the left to something on the right. When thinking the other way, we have

&
>>>
>>=
>=>

But are there flipped versions of <$> and <*>?

like image 856
dfeuer Avatar asked Sep 06 '15 18:09

dfeuer


1 Answers

lens defines (<&>) = flip fmap. It will be available from Data.Functor in base-4.11/GHC 8.4. Control.Applicative has (<**>), which takes the arguments in the opposite order but is not flip (<*>) because effects are still sequenced from left to right.

like image 53
duplode Avatar answered Nov 10 '22 05:11

duplode