[GHC] #13689: Data.Either doesn't export INLINABLE short functions like "rights"

GHC ghc-devs at haskell.org
Fri May 12 15:21:42 UTC 2017


#13689: Data.Either doesn't export INLINABLE short functions like "rights"
-------------------------------------+-------------------------------------
        Reporter:  varosi            |                Owner:  (none)
            Type:  bug               |               Status:  infoneeded
        Priority:  normal            |            Milestone:
       Component:  Core Libraries    |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect API     |  Unknown/Multiple
  annotation                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 They are defined in terms of list comprehensions, which does result in a
 rather large desugared core definition,
 {{{#!hs
 rights' :: forall t_aQz t_aQx. [Either t_aQz t_aQx] -> [t_aQx]
 [LclIdX, Str=DmdType]
 rights' =
   \ (@ t_aQz) (@ t_aQx) (xs_aPD :: [Either t_aQz t_aQx]) ->
     GHC.Base.build
       @ t_aQx
       (\ (@ a_d1An)
          (c_d1Ao [OS=OneShot] :: t_aQx -> a_d1An -> a_d1An)
          (n_d1Ap [OS=OneShot] :: a_d1An) ->
          GHC.Base.foldr
            @ (Either t_aQz t_aQx)
            @ a_d1An
            (\ (ds_d1Ar :: Either t_aQz t_aQx)
               (ds_d1Aq [OS=OneShot] :: a_d1An) ->
               case ds_d1Ar of _ [Occ=Dead] {
                 __DEFAULT ->
                   (\ _ [Occ=Dead, OS=OneShot] -> ds_d1Aq) GHC.Prim.void#;
                 Right x_aPE -> c_d1Ao x_aPE ds_d1Aq
               })
            n_d1Ap
            xs_aPD)
 }}}

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


More information about the ghc-tickets mailing list