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

GHC ghc-devs at haskell.org
Mon Dec 26 01:11:08 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):

 These functions and more are defined [https://github.com/sboosali
 /commands-
 core/blob/6bcfe72aef9b55f366a4e215720a9475de2d2e6f/sources/Data/HTypes.hs
 here]

 {{{#!hs
 (.|||.) :: (f1 :~> g) -> (f2 :~> g) -> ((f1 :+: f2) :~> g)
 (<|||>) :: (f1 :~> (m :. g)) -> (f2 :~> (m :. g)) -> ((f1 :+: f2) :~> (m
 :. g)

 getFirst,  outL :: (f :*: g) :~> f
 getSecond, inL  :: (f :*: g) :~> g
 getSecond (Pair _ g) = g

 (.&&&.) :: (f :~> g1) -> (f :~> g2) -> (f :~> (g1 :*: g2))
 (<&&&>) :: (Applicative m) => (f :~> (m :. g1)) -> (f :~> (m :. g2)) -> (f
 :~> (m :. (g1 :*: g2)))
 }}}

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


More information about the ghc-tickets mailing list