Debug.crash aborts the Elm runtime despite the no-runtime-exceptions guarantee
0 reputation · 27 May 2021, 10:14 UTC
Elm guarantees that pure code cannot throw runtime exceptions, yet Debug.crash is typed as Never and throws a JavaScript exception whenever it is evaluated. This leaves an unresolved gap between the type-level guarantee and observable behavior in the Elm compiler.
The goal is to determine whether a reachable Debug.crash call should be treated as a user-code defect, a compiler warning candidate, or an acceptable development-only escape hatch. Because Never permits the call in any position, static analysis alone does not flag reachable crash sites before deployment.
Is Debug.crash intended to remain reachable in production applications, and what verification confirms that no code path can evaluate it? Should the compiler treat statically reachable Debug.crash as an error rather than a runtime abort?