carray-0.1.2: A C-compatible array library.ContentsIndex
Data.Array.IOCArray
Portabilitynon-portable
Stabilityexperimental
Maintainerjed@59A2.org
Contents
IOCArray type
Foreign support
The overloaded mutable array interface
Description

This module provides both the mutable IOCArray which uses pinned memory on the GC'd heap. Elements are stored according to the class Storable. You can obtain a pointer to the array contents to manipulate elements from languages like C.

IOCArray is 16-byte aligned by default. If you create a IOCArray with unsafeForeignPtrToIOCArray then it may not be aligned. This will be an issue if you intend to use SIMD instructions.

IOCArray is equivalent to Data.Array.Storable.StorableArray and similar to Data.Array.IO.IOUArray but slower. IOCArray has O(1) versions of unsafeFreeze and unsafeThaw when converting to/from CArray.

Synopsis
data IOCArray i e
withIOCArray :: IOCArray i e -> (Ptr e -> IO a) -> IO a
touchIOCArray :: IOCArray i e -> IO ()
unsafeForeignPtrToIOCArray :: Ix i => ForeignPtr e -> (i, i) -> IO (IOCArray i e)
IOCArray type
data IOCArray i e
Absolutely equivalent representation, but used for the mutable interface.
show/hide Instances
Foreign support
withIOCArray :: IOCArray i e -> (Ptr e -> IO a) -> IO a
touchIOCArray :: IOCArray i e -> IO ()
If you want to use it afterwards, ensure that you touchCArray after the last use of the pointer, so the array is not freed too early.
unsafeForeignPtrToIOCArray :: Ix i => ForeignPtr e -> (i, i) -> IO (IOCArray i e)
O(1) Construct a CArray 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.
The overloaded mutable array interface
Produced by Haddock version 2.1.0