--
-- Maintainer : libraries@haskell.org
-- Stability : experimental
--- Portability : non-portable
+-- Portability : non-portable (uses Data.Array.MArray)
--
-- A storable array is an IO-mutable array which stores its
-- contents in a contiguous memory block living in the C
-- |The array type
data StorableArray i e = StorableArray !i !i !(ForeignPtr e)
-instance HasBounds StorableArray where
- bounds (StorableArray l u _) = (l,u)
-
instance Storable e => MArray StorableArray e IO where
+ getBounds (StorableArray l u _) = return (l,u)
newArray (l,u) init = do
fp <- mallocForeignPtrArray size