Data.Functor.{Product,Sum} functions

Baldur Blöndal baldurpet at gmail.com
Sat Dec 24 00:02:18 UTC 2016


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20161224/497b76bd/attachment.html>


More information about the Libraries mailing list