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

GHC ghc-devs at haskell.org
Mon Dec 26 00:39:37 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:                    |
-------------------------------------+-------------------------------------

Comment (by Iceland_jack):

 Some more functions (would be `Iso`s in lens)

 {{{#!hs
 runSum :: Sum f g a -> Either (f a) (g a)
 runSum = Left |||| Right

 runProduct :: Product f g a -> (f a, g a)
 runProduct (Pair fa ga) = (fa, ga)
 }}}

 Used [https://github.com/bitemyapp/nt-in-
 haskell/blob/2563047caaffa1a88c540128424a250f0d267aaf/answers/src/NT/Answers/D.hs
 here].

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


More information about the ghc-tickets mailing list