<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi,</p>
    <p>I also think we should do this but it has a lot of ramifications:
      contant folding in Core, codegen, TH, etc.</p>
    <p>Also it will break codes that use primitive types directly, so
      maybe it's worth a ghc proposal.<br>
    </p>
    <p>Sylvain<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 01/08/2017 15:37, Michal Terepeta
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEN7k7kyCkXew7DQczSthm_=FjfAZ64pnXMu+MaQNqib-A8pOA@mail.gmail.com">
      <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"
            moz-do-not-send="true">https://ghc.haskell.org/trac/ghc/ticket/13825</a></div>
        <div>[2] <a href="https://phabricator.haskell.org/D3809"
            moz-do-not-send="true">https://phabricator.haskell.org/D3809</a></div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
ghc-devs mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>