[GHC] #14001: Inlining does not work between modules

GHC ghc-devs at haskell.org
Tue Feb 20 16:27:34 UTC 2018


#14001: Inlining does not work between modules
-------------------------------------+-------------------------------------
        Reporter:  danilo2           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      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 bgamari):

 Regarding comment:10:

 In general GHC can only evaluate things which it can prove will eventually
 be forced by the program. Consequently if you have,
 {{{#!hs
 (.) :: (b -> c) -> (a -> b) -> a -> c
 (.) f g = \x -> f (g x)

 h = f . g
 }}}
 The performance characteristics of `h` will naturally depend upon the
 strictness characteristics of `f` and `g`. If both are strict in their
 first argument then it would be safe to first force `h`'s argument, as you
 do in your strict composition operator. However, if either are lazy then
 changing the strictness of `(.)` will change the semantics of the program,
 potentially resulting in an incorrectly bottom program.

 > Thus I believe we should consider this bug and should expect from GHC to
 automatically optimize usages of `(.)` in strict code.

 Perhaps, but what do you consider to be "strict code"?

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


More information about the ghc-tickets mailing list