[GHC] #15349: fixST is a bit wrong

GHC ghc-devs at haskell.org
Mon Jul 9 16:39:24 UTC 2018


#15349: fixST is a bit wrong
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  dfeuer
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Core Libraries    |              Version:  8.5
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Replying to [comment:1 simonmar]:
 > Wow, good catch. I suppose we should do what `fixIO` does, since this is
 clearly wrong. But maybe there's a way to do it with `IORef` that would be
 cheaper than `MVar`? (we'd need benchmarks to check, though)

 I don't think there is. I believe that runs into the same problem as
 `unsafeFixIO`: trouble with multiple threads. In `fixST f`, `f` may spark
 computations (`runEval`, `runPar`, etc.) that demand the final result;
 those should block until the result is available. Just like `fixIO`, what
 we really want here is an `IVar`, and we don't (yet?) have those natively.

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


More information about the ghc-tickets mailing list