[GHC] #13026: RFC functions for sums and products

GHC ghc-devs at haskell.org
Wed Dec 28 06:40:13 UTC 2016


#13026: RFC functions for sums and products
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by Iceland_jack:

@@ -18,0 +18,4 @@
+
+ **Edit**: [http://hackage.haskell.org/package/comonad-
+ transformers-3.1/docs/Data-Functor-Coproduct.html coproduct] is one name
+ for `||||`

New description:

 I'll ask on the libraries mailing list depending on feedback.

 Adding these to `Data.Functor.Sum`, `Data.Functor.Product` a la
 `Control.Arrow`

 {{{#!hs
 (||||) :: (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
 }}}

 `||||` is used in "Monad transformers and modular algebraic effects: What
 binds them together" in section 2.4, the names are up for discussion

 **Edit**: [http://hackage.haskell.org/package/comonad-
 transformers-3.1/docs/Data-Functor-Coproduct.html coproduct] is one name
 for `||||`

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13026#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list