Data.Functor.{Product,Sum} functions
David Feuer
david.feuer at gmail.com
Sat Dec 24 12:43:17 UTC 2016
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 <baldurpet at gmail.com> 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 at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
More information about the Libraries
mailing list