Passing a matrix from C to Haskell

Cyril Schmidt cschmidt at deds.nl
Wed Feb 8 11:33:31 EST 2006


Simon Marlow wrote:
> Bulat Ziganshin wrote:
[...]
>> i think we should define "secret door" to construct StorableArray from
>> a pointer to allow to use full power of MArray interface on foreign
>> arrays
>
> You mean this?
>
> -- |Construct a 'StorableArray' from an arbitrary 'ForeignPtr'.  It is
> -- the caller's responsibility to ensure that the 'ForeignPtr' points to
> -- an area of memory sufficient for the specified bounds.
> unsafeForeignPtrToStorableArray
>     :: ForeignPtr e -> (i,i) -> IO (StorableArray i e)

It looks like this function is not available in GHC 6.4.1 (see
http://www.haskell.org/ghc/docs/6.4.1/html/libraries/base/Data-Array-Storable.html
)

It is, however, documented at
http://www.haskell.org/HOpenGL/newAPI/base/Foreign-Storable.html
but I don't know which version of GHC it applies to.

Cheers,

Cyril



More information about the Glasgow-haskell-users mailing list