[GHC] #8091: retry# lacks strictness information

GHC ghc-devs at haskell.org
Thu Jul 25 12:29:47 CEST 2013


#8091: retry# lacks strictness information
-------------------------------------+------------------------------------
        Reporter:  parcs             |            Owner:
            Type:  bug               |           Status:  patch
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.6.3
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by parcs):

 Ah, subtle..

 But in this particular example , `f` seems to be lazy in `y` even when
 `retry` is replaced with `throw Overflow`: its strictness signature is
 `<S,1*U(U)><L,1*U(U)><L,U>` either way..

 (It would be incorrect, I think, to have `f` strict in `y` since that
 could potentially elide the side-effect-having call to `readTVar`.)

 I found an example of a function whose strictness does change due to this
 patch (courtesy of the comments for `RaiseIOOp` in primops.txt.pp):

 {{{
 #!haskell
 g :: Int -> Int -> STM Int
 g x y | x>0       = retry
       | y>0       = return 1
       | otherwise = return 2
 }}}

 This function is now strict in `y`, where it originally wasn't. It looks
 like this change will only have strictness implications in fairly
 contrived functions where `retry` is used in such a way that the
 transaction could not possibly make any progress; and in that case
 behaving as if `retry` returns bottom makes a good amount of sense.

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




More information about the ghc-tickets mailing list