[GHC] #5916: runST isn't free

GHC ghc-devs at haskell.org
Wed Jan 8 18:24:31 UTC 2014


#5916: runST isn't free
-------------------------------------+------------------------------------
        Reporter:  tibbe             |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:  7.6.2
       Component:  Compiler          |          Version:  7.4.1
      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 nomeata):

 Turns out I spoke too soon (and that the test suite really does not cover
 this):

 This code
 {{{
 #!haskell
 main =
     let f () = runST $ do
         ref <- newSTRef 0
         modifySTRef ref (+1)
         readSTRef ref
     in print (f () + f ())
 }}}
 will be broken by my approach (output `3` instead of `2`), as there are no
 free variables that differing – obvious, now that I see it.

 Too bad, was hoping to produce something usable today... at least I’ll add
 a possibly useful testcase.

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


More information about the ghc-tickets mailing list