Stack Overflow with ApplicativeDo
I tried to compile one of our server applications with 8.2.1 (which compiles fine with 8.0.2).
The compilation runs smoothly, but when it reaches a specific file, the RAM usage goes up to > 20GB pretty fast on my 16GB machine and the GHC process gets terminated with a stack overflow error.
I tried to find a minimal example that causes this behavior:
#!/usr/bin/env stack
-- stack --resolver nightly-2017-08-25 script
{-# LANGUAGE ApplicativeDo #-}
x = do
(a, _) <- undefined
(b, _) <- undefined
(c, _) <- undefined
undefined
main = undefined
It only happens with at least 3 of these pattern matches.