The dreaded State Hack. Optimisation can lose sharing in IO code, esp replicateM
Summary
Many bug reports are ultimately due to the "state hack". This ticket serves a summary of these various reports, and points to thinking about solutions.
Other tickets reporting the same problem (please extend this list; "closed" probably means "duplicate" not "solved):
- #2284 (closed)
- #1957 (closed)
- #3629 (closed)
- #7561 (closed)
- #9349
- #10102 (closed)
- #10401
- #10825 (closed)
- #11271
- #11365 (closed)
- #11677
- #11795 (closed)
- #13406
- #21785
- #22509
Possible solutions
This particular ticket's report
The simplifier is losing sharing in spectral/calendar, probably because we're being a bit fast-and-loose with eta-expanding State# lambdas. A quick look at the Core shows that calFor year
is not shared across multiple executions.
Trac metadata
Trac field | Value |
---|---|
Version | 6.6 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |