Memory usage exploding for complex pattern matching
It seems like complex pattern matching is consuming a prohibitive amount of memory. From a discussion in ghc-devs, https://mail.haskell.org/pipermail/ghc-devs/2018-March/015538.html, the exhaustiveness checker could be the culprit.
We have tried with 7.10.3, 8.0.2, 8.4.1 and ghc-HEAD. They show similar results.
The "-fmax-pmchecker-iterations=0" option seems to help slightly. Bigger cases will run out of memory even with the option enabled.
I'm attaching a "minimal" example to help diagnosing. The majority of the code has been generated by Template Haskell.