Unboxed Vectors of newtype'd values

Ben Gamari bgamari.foss at gmail.com
Thu May 31 19:16:54 CEST 2012

Reiner Pope <reiner.pope at gmail.com> writes:

> In case anyone missed it, Liyang HU wrote a TH deriver for Unbox
> instances[1].
Thanks! I don't know how I missed this. This is quite sufficient for
most of my purposes.

> Also, I have tried using GHC's new generic deriving[2] to derive instances
> - this is almost possible, but is blocked by a GHC issue[3]. IMHO generic
> deriving would be the best solution (once it works), because it works for
> product types as well as newtypes, and requires no extra GHC assistance or
> TH.
This will be quite nice and it sounds like it should cover nearly all of
the cases I'm interested in. I'm not terribly familiar with generics
support so I'm not sure whether this is possible or not, but it would be
great if there were a way to specify whether an SoA or AoS
representation is derived. This way one could write nearly cache-optimal
code while keeping the mechanics of data layout nicely contained.


- Ben

More information about the Libraries mailing list