[GHC] #9388: Narrow the scope of the notorious "state hack"

GHC ghc-devs at haskell.org
Sat Feb 21 22:49:39 UTC 2015


#9388: Narrow the scope of the notorious "state hack"
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by nomeata):

 Has someone implemented this without telling us?

 In GHC-7.8.4, compiling
 {{{
 pr :: String -> IO ()
 pr x = putStrLn (reverse x)
 }}}
 without the state hack yields
 {{{
 pr =
   \ x_arX ->
     let s_aQl = reverse1 x_arX ([]) in
     (\ eta_aQm -> hPutStr2 stdout s_aQl True eta_aQm) `cast` ...
 }}}
 and only with the state hack, we get the good
 {{{
 pr1 = \ x_arX eta_B1 -> hPutStr2 stdout (reverse x_arX) True eta_B1
 }}}

 But with GHC HEAD, the output is good with and without `-fno-state-hack`.
 So either something implemented this, or the state hack flag gets ignored
 for some reason.

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


More information about the ghc-tickets mailing list