The following generates JavaScript that crashes due to an Uncaught ReferenceError involving what seems to be a generated symbol (e.g. "_l2"). It succeeds if compiled with --ddisable-js-opts.
import Control.Concurrent.MVar
import Data.Array
main :: IO ()
main = do
let r = ((0,0), (7,7))
mv <- newEmptyMVar
putMVar mv True
b <- takeMVar mv
if b then do
putStrLn "crashes here"
putStrLn $ show [inRange r (0 + x, 7 + y) | x <- [-1, 1], y <- [-1, 1]]
putStrLn "...unless compiled with --ddisable-js-opts"
else undefined
I tried finding a smaller example, but I found the crash disappeared if:
The Integer values are declared as Ints instead: (0 :: Int,0 :: Int), (7,7))
The MVar is removed
The 2-dimensional bounds are replaced with a 1-dimensional bound, e.g. (0, 7)
The following generates JavaScript that crashes due to an Uncaught ReferenceError involving what seems to be a generated symbol (e.g. "_l2"). It succeeds if compiled with --ddisable-js-opts.
I tried finding a smaller example, but I found the crash disappeared if:
(0 :: Int,0 :: Int), (7,7))
(0, 7)
Hopefully the above is enough to go on.