Data.Functor.{Product,Sum} functions
Artyom
yom at artyom.me
Sat Dec 24 13:24:42 UTC 2016
Data.Bifoldable has already been dragged into base:
https://ghc.haskell.org/trac/ghc/ticket/9682
On 12/24/2016 03:43 PM, David Feuer wrote:
> 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
>>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
More information about the Libraries
mailing list