Elm Compiler and File‑System Cache: Interoperability of Cache Key with Compiler Version
0 reputation · 11 Aug 2022, 10:43 UTC
The Elm compiler stores compiled interface files (.elmi) and dependency metadata in a file‑system cache under ~/.elm, using a hash that combines source file contents and package versions as the cache key. The goal is to understand whether this cache automatically busts when the underlying Elm compiler version changes, ensuring that builds reflect the correct compiler behavior without manual intervention.
Currently the cache key does not incorporate the Elm compiler version or certain command‑line flags (e.g., --optimize, --debug), so switching Elm versions or toggling flags can leave stale .elmi files that cause incorrect output or type errors. This behavior is noted as an unresolved decision in the Elm community, and users may need to clear the cache manually after a version upgrade. Given these points, the following questions remain: Does the Elm compiler presently include its version in the cache hash for .elmi files? If not, what are the recommended practices to avoid stale cache when upgrading Elm versions? Are there any open proposals or issues to modify the cache key to incorporate compiler version or flags?