
On Fri, Apr 25, 2014 at 1:14 PM, Andreas Abel
I am unhappy about the name "bifor".
forM = flip mapM, so the right generalizations would be
for = flip map bifor = flip bimap
forA = flip mapA = flip traverse biforA = flip bimapA = flip bitraverse
These definitions make no sense to me. flip bimap and flip bitraverse just swap the order of the traversal functions passed in. Their definition in bifunctors actually moves the structure to the first argument, which is the actual point of for(M). Unfortunately, "for" was taken for "flip traverse" by
Data.Traversable. Instead "forA" should have been used.
I don't find this to be unfortunate at all. Sorry. for is useful, and forA is a worse name (as is forM). Especially as we'll be able to get rid of sequenceA (and thus bisequenceA) in 7.10 with the improved hierarchy, leaving no -A functions aside from liftAN. I don't know if we will do that, but it's _not_ the convention to name these functions fooA. And I'm not in favor of making it the convention, either. In my own code, I actually define
for = flip map
and use it in situations like
let ys = for xs $ \ x -> long function body
(I never use "for" from Data.Traversable anyway, since I have not needed yet an Applicative which is not a Monad.)
And in base we don't do that. In my code, I use (<&>) from lens when I need a flipped fmap: let ys = xs <&> \x -> ... and do use Applicative for. Proposal: use "biforA" instead of "bifor".
Negative.