Optimisation removes effectful computation.
Summary
The attached zip contains a small cabal package with a Win32
dependency.
The problematic source file in question is Offending.hs
, where the optimisation level was overridden.
Steps to reproduce
When setting the optimisation level in Offending.hs
to -O1
, and doing a full rebuild
(running cabal clean
if neccessary), the resulting program prints the following:
Sending mask: 0
Somehow, the second call to sendMessage
in Offending.hs
gets dropped.
Expected behavior
When setting the optimisation level in Offending.hs
to -O0
, the program prints the expected result:
Sending mask: 0
Recieved new mask: 2
Environment
- GHC version used: 8.10.1