Trac Trac #15349 reveals that lazy blackholing can cause trouble for
fixST much like it can for fixIO. Make fixST work just
- rGHC Glasgow Haskell Compiler
No Unit Test Coverage
- Build Status
Buildable 21705 Build 49627: [GHC] Linux/amd64: Continuous Integration Build 49626: [GHC] OSX/amd64: Continuous Integration Build 49625: [GHC] Windows/amd64: Continuous Integration Build 49624: arc lint + arc unit
Done. Unfortunately, all my attempts to fix lazy ST using noDuplicate# failed the test when compiled with -O0. I wish I understood why, so I could feel more confident that we don't have more troubles lurking in that module. Lazy ST is really subtle. In the mean time, I implemented the lazy ST version using an MVar as well; that seems to work.
I don't think noDuplicate# has any well-defined semantics that we can rely on, so I'm not entirely surprised that you found it difficult to use it to fix Lazy ST.
I presume we're good here for strict ST at least?