carray-0.1.1: A C-compatible array library.Source codeContentsIndex
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 Source
Absolutely equivalent representation, but used for the mutable interface.
show/hide Instances
Foreign support
withIOCArray :: IOCArray i e -> (Ptr e -> IO a) -> IO aSource
touchIOCArray :: IOCArray i e -> IO ()Source
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)Source
The overloaded mutable array interface
Produced by Haddock version 2.3.0