Skip to content

Port over osa's original unpack_sums PR

cgibbard requested to merge obsidiansystems/ghc:os/unpack_sums into master

This is an attempt to resuscitate some code from @osa1 from this repo and rebase it on top of current master. It's an attempt at implementing {-# UNPACK #-} for sum-typed fields, as discussed in this GHC wiki article. It's definitely not quite correct as it stands, three ghci-debugger related tests are panicking, and I'm sure that what we did with the Scaled type information is almost certainly wrong as well, though I have no idea how to trigger any infelicity with that.

However, the tests of the feature's actual usage seem like they're working.

Some help with figuring out how to do this correctly would be appreciated!

#15358 (closed) seems like a request for this.


Thank you for your contribution to GHC!

Please take a few moments to verify that your commits fulfill the following:

  • are either individually buildable or squashed
  • have commit messages which describe what they do (referring to Notes and tickets using #NNNN syntax when appropriate)
  • have added source comments describing your change. For larger changes you likely should add a Note and cross-reference it from the relevant places.
  • add a testcase to the testsuite.
  • replace this message with a description motivating your change

If you have any questions don't hesitate to open your merge request and inquire in a comment. If your patch isn't quite done yet please do add prefix your MR title with WIP:.

Edited by Ben Gamari

Merge request reports