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

GHC ghc-devs at haskell.org
Tue Jan 24 03:40:14 UTC 2017


#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):

 Please consider these functions from a
 [http://stackoverflow.com/a/25817530/165806 StackOverflow answer]

 {{{#!hs
 liftO :: (Functor f, Applicative g) => f ~> Compose f g
 liftO = Compose . fmap pure

 liftI :: Applicative f => g ~> Compose f g
 liftI = Compose . pure

 hoistO :: f ~> f' -> Compose f g ~> Compose f' g
 hoistO eta = Compose . eta . getCompose

 hoistI :: Functor f => g ~> g' -> Compose f g ~> Compose f g'
 hoistI eta = Compose . fmap eta . getCompose
 }}}

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


More information about the ghc-tickets mailing list