[Haskell-cafe] some newbie FFI questions

Duncan Coutts duncan.coutts at worcester.oxford.ac.uk
Thu Jul 1 07:56:35 EDT 2004

On Thu, 2004-07-01 at 12:34, MR K P SCHUPKE wrote:
> Oh... also when using unboxed arrays you may well have
> to have a separate array for each colour plane (r,g,b,a)
> as I think unboxed arrays can only contain primitive types - although
> I am not certain about this - it may be enough to have the
> contents strict.

Sadly arrays of unboxed records are not currently possible. The only
instances for MArray / IArray with unboxed arrays are simple primitive

See the instances for mutable arrays:
and for imutable arrays

I don't think it is easy for non-ghc hackers to add extra instances.

Intuitively it seems obvious that user defined types that are just
products of unboxable types are also unboxable. Being able to say
'deriving Unboxable' would be nice...


More information about the Haskell-Cafe mailing list