
Er ... that was silly. I guess bifoldMap isn't really (||||), exactly.
It's pretty much `either`, but needs to have a Monoid wrapper. The
generalization I was roughly imagining would be a sort of
higher-kinded Bifoldable1:
class Bifoldable1' p where
bifoldMap1' :: Semigroup m => (f a -> m) -> (g a -> m) -> p f g a -> m
which would then get the job done with Data.Semigroup.First.
But that's getting pretty far from the point, so, we need `||||` or
`sum` or whatever.
On Sat, Dec 24, 2016 at 7:43 AM, David Feuer
This |||| is the sum eliminator. We can't call it `sum`, but maybe `sumE`? I do think it should be included with some name. Another option might be to drag Data.Bifoldable into base from bifunctors; (||||) = bifoldMap, but I think the case for a specialized name is still pretty good.
&&&& is definitely a nice thing to have. However, (&&&&) = liftA2 Pair, so I'm not convinced we need to give it its own name.
On Fri, Dec 23, 2016 at 7:02 PM, Baldur Blöndal
wrote: Let's see if any of these are useful (a lot more at https://ghc.haskell.org/trac/ghc/ticket/13026)
(||||) :: (f a -> b) -> (g a -> b) -> ((Sum f g) a -> b) f |||| g = \case InL fa -> f fa InR ga -> g ga
(&&&&) :: (a -> f b) -> (a -> g b) -> (a -> (Product f g) b) (f &&&& g) a = f a `Pair` g a
I couldn't think of any for Data.Functor.Compose, names are up for bikeshedding
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries