[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
types.
See the instances for mutable arrays:
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data.Array.MArray.html#1
and for imutable arrays
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data.Array.IArray.html#1
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...
Duncan
More information about the Haskell-Cafe
mailing list