Skip to content

Draft: Make `Int` fields in `GHC.Stack.Types.SrcLoc` strict

konsumlamm requested to merge konsumlamm/ghc:srcloc-strict into master

Implement https://github.com/haskell/core-libraries-committee/issues/55.
Closes #20449.

While the patch makes the Int fields unpacked, for some reason this doesn't seem to apply to the compiler-generated SrcLocs (from HasCallStack). I have a gist that shows the code I used to test this patch and the resulting core output. As you can see, the compiler-generated SrcLoc (lvl9_rNc) still has Int fields, while the manually created one (mySrcLoc) has Int# fields. I'd really like to know what's going on here, since the whole point of the proposal was to reduce the generated core for functions using HasCallStack, by eliminating all the top-level Int bindings.

When compiling the example with -dlint, it produces a core lint error about a type mismatch between Int and Int#. This is probably due to the compiler hardcoding the SrcLoc construction.

Edited by konsumlamm

Merge request reports