Data.Functor.{Product,Sum} functions

Andrew Martin andrew.thaddeus at gmail.com
Wed Dec 28 14:44:39 UTC 2016


I do not like using infix operators as names. Similar to others, I like the
Sum eliminator and am skeptical of the value that the &&&& operator
provides.

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
>
>


-- 
-Andrew Thaddeus Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20161228/bc015294/attachment.html>


More information about the Libraries mailing list