Exponential memory use when using lots of <*>
Summary
Some code with the shape F <$> a1 <*> a2 <*> a3 <*> ...
takes forever or lots of memory (up to 50G) or end up in stack overflow (depending on how long I wait) when using optimisation.
Steps to reproduce
I've created a single file project which reproduce the issue. It can be found on github
Clone the project.
run stack build
and wait ...
The issue seems to be related to the use of CountryCode
(the shCountry
field) which is a enum with around hundred constructor.
-
Disabling the optimisation fixes the problem
-
Removing a few field in the form fixes the problem too
Expected behavior
The compilation should finish in a few seconds not crash after hours
Environment
- GHC version used: 8.10.4 8.10.3 8.8.4 8.4.4
Optional:
- Operating System: Linux
- System Architecture: