@@ -56,6 +56,7 @@ module Streamly.Internal.Data.Array.Foreign.Mut.Type
56 , unsafeIndex
56 , unsafeIndex
58 -- * Mutation
58 -- * Mutation
59 , unsafeSnoc
60 , unsafeSnoc
@@ -313,6 +314,14 @@ withNewArray count f = do
314-------------------------------------------------------------------------------
315-------------------------------------------------------------------------------
317+{-# INLINE unsafeWriteIndex #-}
318+unsafeWriteIndex :: forall a. Storable a => Array a -> Int -> a -> IO (Array a)
319+unsafeWriteIndex arr@Array {..} i x =
320+ withForeignPtr aStart
322+ poke (begin `plusPtr` (i * sizeOf (undefined :: a))) x
316-- XXX grow the array when we are beyond bound.
325-- XXX grow the array when we are beyond bound.
318-- Internal routine for when the array is being created. Appends one item at
327-- Internal routine for when the array is being created. Appends one item at