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

GHC ghc-devs at haskell.org
Fri May 12 15:41:36 UTC 2017


#13689: Data.Either doesn't export INLINABLE short functions like "rights"
-------------------------------------+-------------------------------------
        Reporter:  varosi            |                Owner:  (none)
            Type:  bug               |               Status:  patch
        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):  Phab:D3576
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nomeata):

 > It just so happens that list comprehensions are directly desugared into
 fusion primitives and consequently produce rather large Core.

 Oh, annoying. What if the implementation was
 ```
 lefts = concatMap go
   where go (Left x) = [x]
         go (Right _) = []
 ```
 That should result in the same code in terms of `foldr` and `buildr`, but
 maybe produce a smaller unfolding, and be inlinable by itself. (This is
 more out of curiosity, it is not too bad to have a large unfolding, I
 think).

 Although it would be desirable to use a single library defined definition
 of `lefts` when no fusion happens, instead of repeating the code at every
 use-site.

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


More information about the ghc-tickets mailing list