Data.Array.Storable.Internals
| Copyright | (c) The University of Glasgow 2011 |
|---|---|
| License | BSD-style (see the file libraries/base/LICENSE) |
| Maintainer | libraries@haskell.org |
| Stability | experimental |
| Portability | non-portable (uses Data.Array.MArray) |
| Safe Haskell | None |
| Language | Haskell2010 |
Description
Actual implementation of Data.Array.Storable.
WARNING
This module is considered internal.
The Package Versioning Policy does not apply.
The contents of this module may change in any way whatsoever and without any warning between minor versions of this package.
Authors importing this module are expected to track development closely.
Since: array-0.4.0.0
data StorableArray i e Source
The array type
Constructors
| StorableArray !i !i Int !(ForeignPtr e) |
Instances
| Storable e => MArray StorableArray e IO Source | |
Defined in Data.Array.Storable.Internals MethodsgetBounds :: Ix i => StorableArray i e -> IO (i, i) Source getNumElements :: Ix i => StorableArray i e -> IO Int Source newArray :: Ix i => (i, i) -> e -> IO (StorableArray i e) Source newArray_ :: Ix i => (i, i) -> IO (StorableArray i e) Source unsafeNewArray_ :: Ix i => (i, i) -> IO (StorableArray i e) Source unsafeRead :: Ix i => StorableArray i e -> Int -> IO e Source unsafeWrite :: Ix i => StorableArray i e -> Int -> e -> IO () Source | |
withStorableArray :: StorableArray i e -> (Ptr e -> IO a) -> IO a Source
The pointer to the array contents is obtained by withStorableArray. The idea is similar to ForeignPtr (used internally here). The pointer should be used only during execution of the IO action retured by the function passed as argument to withStorableArray.
touchStorableArray :: StorableArray i e -> IO () Source
If you want to use it afterwards, ensure that you touchStorableArray after the last use of the pointer, so the array is not freed too early.
unsafeForeignPtrToStorableArray :: Ix i => ForeignPtr e -> (i, i) -> IO (StorableArray i e) Source
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.
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/9.12.1/docs/libraries/array-0.5.8.0-8d84/Data-Array-Storable-Internals.html