New primitive types?

Sylvain Henry sylvain at haskus.fr
Thu Aug 3 00:27:41 UTC 2017


Hi,

I also think we should do this but it has a lot of ramifications: 
contant folding in Core, codegen, TH, etc.

Also it will break codes that use primitive types directly, so maybe 
it's worth a ghc proposal.

Sylvain


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170803/a78eadbf/attachment.html>


More information about the ghc-devs mailing list