[GHC] #9390: Inlining prevents evaluation of ignored parts of unboxed tuples

GHC ghc-devs at haskell.org
Wed Aug 6 12:04:03 UTC 2014


#9390: Inlining prevents evaluation of ignored parts of unboxed tuples
-------------------------------------+-------------------------------------
              Reporter:  snoyberg    |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:  7.8.4
             Component:  Compiler    |          Version:  7.8.3
            Resolution:              |         Keywords:
      Operating System:  Linux       |     Architecture:  x86_64 (amd64)
       Type of failure:  Incorrect   |       Difficulty:  Unknown
  result at runtime                  |       Blocked By:
             Test Case:              |  Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by snoyberg):

 I think you were implying this, but just for complete clarity (and since
 I'd want to include it in an explanatory document), when we have:

 {{{
 x `seq` (y :: IO a)
 }}}

 We have no control of whether `x` or `y` will be evaluated first, and
 therefore there is no ordering of side effects from the evaluation of `x`
 and `y`. However, the IO action contained by `y` *will* be guaranteed to
 be run after both `x` and `y` are evaluated. In other words, with the
 code:

 {{{
 let x = unsafePerformIO $ putStrLn "x evaluated"
     y = unsafePerformIO $ do
             putStrLn "y evaluated"
             return $ "y run"
 x `seq` y
 }}

 The ordering of "x evaluated" and "y evaluated" is undefined, but we are
 guaranteed that both of them will be print before "y run".

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


More information about the ghc-tickets mailing list