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

GHC ghc-devs at haskell.org
Mon Feb 10 17:22:43 UTC 2014


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

Comment (by nomeata):

 @ekmett: Ok, thanks for the input. So clearly it should _not_ be closed
 then.

 So what you’d like to see is to have GHC behave here as if `-fpedantic-
 bottoms` is on always.

 Obviously, one could make that flag the default, but there must be reasons
 why it is not the default.

 What I find surprising: The core generated for
 {{{
 mkIdDot2 :: (a -> b) -> a -> Id b
 mkIdDot2 f = f `seq` \x -> MkId (f x)
 }}}
 is
 {{{
 mkIdDot2 = (λ f. f) |> (some cast involving Id))
 }}}
 which is the same core that we get with `mkIdDot2 = coerce` (hey, no
 unsafe!), but the latter produces the desired `map2 = map`... hard to see
 (without knowing the simplifier by heart) where this goes wrong.

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


More information about the ghc-tickets mailing list