[GHC] #14998: Sort out the strictness mess for exceptions

GHC ghc-devs at haskell.org
Mon Apr 9 08:59:56 UTC 2018


#14998: Sort out the strictness mess for exceptions
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.4.3
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:  Exceptions
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 sgraf):

 ... Although it's unclear to me ''why'' the bang has such a dramatic
 effect.

 I presumed that the call to `hGetBuf` and `hPutBuf` were responsible for
 this, but going up from `do_operation`, I can't see any changes in Core
 resulting from the changed strictness signatures.
 In fact, the activations go like this:

 {{{
    GHC.IO.Handle.Text.hPutBuf
 -> GHC.IO.Handle.Internals.wantWritableHandle
 -> GHC.IO.Handle.Internals.withHandle_'
 -> GHC.IO.Handle.Internals.withHandle'
 }}}

 Note from the first diff in comment:10, that while the signature for
 `withHandle'` differs relative to HEAD, that is not the case for
 `withHandle_'` (hooray for names)! `withHandle_'` is lazy in its `act`ion
 parameter in both versions. It should probably have `C(S)`, too, if it has
 in `withHandle'`, but that's a separate issue.

 Since there is no difference in signatures for `withHandle_'`, there is no
 flow in strictness information to callees, which means that the bang just
 fixes some kind of space leak. Which is weird, because I don't see any big
 data structures involved with forcing the result of the `act`ion.

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


More information about the ghc-tickets mailing list