[GHC] #7542: GHC doesn't optimize (strict) composition with id

GHC ghc-devs at haskell.org
Thu Oct 18 15:26:53 UTC 2018


#7542: GHC doesn't optimize (strict) composition with id
-------------------------------------+-------------------------------------
        Reporter:  shachaf           |                Owner:  simonpj
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.6.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by chessai):

 I'm using ghc 8.4.3, and compiling your example exactly with -O2 produces
 no difference whether i compile with '-fpedantic-bottoms' or '-fno-
 pedantic-bottoms' produce the same core.

 {{{
 module Foo (foo) where

 (#) :: (b -> c) -> (a -> b) -> a -> c
 (#) f g = f `seq` g `seq` \x -> f (g x)

 foo :: (a -> b) -> [a] -> [b]
 foo f = map (id # f)
 }}}

 the core shows `foo = map`.

 This is in contrast to @nomeata's comment from 5 years ago, where
 compilation with -fpedantic-bottoms is necessary.

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


More information about the ghc-tickets mailing list