-O2 makes exception disappear
In this example, an exception throw/catch seems not to happen when optimization is turned on. The behavior seems to be quite finicky. Collapsing the code into fewer than the three given modules seems either to make the bug go away or to produce a "internal error: PAP object entered!" message. Other seemingly innocuous changes produce similar results.
On both Linux and MacOS, this program produces "False" with no optimization flags to ghc, or "True" with -O2.
On 6.10.4 on Linux, it produces "False" with or without -O2.