<div dir="ltr"><div>Hi all,</div><div><br></div><div>I'm working on making it possible to pack constructor fields [1],</div><div>example:</div><div><br></div><div>```</div><div>data Foo = Foo {-# UNPACK #-} !Float {-# UNPACK #-} !Int32</div><div>```</div><div><br></div><div>should only require 4 bytes for unpacked `Float` and 4 bytes for</div><div>unpacked `Int32`, which on 64-bit arch would take just 1 word (instead</div><div>of 2 it currently does).</div><div><br></div><div>The diff to support packing of fields is in review [2], but to really</div><div>take advantage of it I think we need to introduce new primitive types:</div><div>- Int{8,16,32}#</div><div>- Word{8,16,32}#</div><div>along with some corresponding primops and with some other follow-up</div><div>changes like extending `PrimRep`.</div><div><br></div><div>Then we could use them in definitions of `Int{8,16,32}` and</div><div>`Word{8,16,32}` (they're currently just wrapping `Int#` and `Word#`).</div><div><br></div><div>Does that sound ok with everyone? (just making sure that this makes</div><div>sense before I invest more time into this :)</div><div><br></div><div>Thanks,</div><div>Michal</div><div><br></div><div>[1] <a href="https://ghc.haskell.org/trac/ghc/ticket/13825">https://ghc.haskell.org/trac/ghc/ticket/13825</a></div><div>[2] <a href="https://phabricator.haskell.org/D3809">https://phabricator.haskell.org/D3809</a></div><div><br></div></div>