
On Fri, Jul 6, 2012 at 1:06 PM, Nicolas Trangez
-- This fails: -- Ambiguous type variable `a0' in the constraint: -- (Storable a0) arising from a use of `sizeOf'
Here you can either tie a type knot using proxy types or you can use the scoped type variable language extension. Perhaps I'm missing something specific to your use, but for the alignment issue you should be OK just calling allocBytes or one of its variants. I made some noise about this a bit ago and it resulted in some extra words in the report under mallocBytes: """ The block of memory is sufficiently aligned for any of the basic foreign types that fits into a memory block of the allocated size. """ Which I'm pretty sure GHC did, and still does, follow. Cheers, Thomas