@@ -251,8 +251,8 @@ new n@(I# n#) =
252-- /Pre-release/
252-- /Pre-release/
253{-# INLINE putIndexUnsafe #-}
253{-# INLINE putIndexUnsafe #-}
254−putIndexUnsafe :: forall m a. MonadIO m => Int -> a -> Array a -> m ()
254+putIndexUnsafe :: forall m a. MonadIO m => Int -> Array a -> a -> m ()
255−putIndexUnsafe i x Array {..} =
255+putIndexUnsafe i Array {..} x =
@@ -268,14 +268,14 @@ invalidIndex label i =
268-- | /O(1)/ Write the given element at the given index in the array.
268-- | /O(1)/ Write the given element at the given index in the array.
269-- Performs in-place mutation of the array.
269-- Performs in-place mutation of the array.
271−-- >>> putIndex ix val arr = Array.modifyIndex ix (const (val, ())) arr
271+-- >>> putIndex ix arr val = Array.modifyIndex ix arr (const (val, ()))
273-- /Pre-release/
273-- /Pre-release/
274{-# INLINE putIndex #-}
274{-# INLINE putIndex #-}
275−putIndex :: MonadIO m => Int -> a -> Array a -> m ()
275+putIndex :: MonadIO m => Int -> Array a -> a -> m ()
276−putIndex i x arr@Array {..} =
276+putIndex i arr@Array {..} x =
277 if i >= 0 && i < arrLen
277 if i >= 0 && i < arrLen
278− then putIndexUnsafe i x arr
278+ then putIndexUnsafe i arr x
279 else invalidIndex "putIndex" i
279 else invalidIndex "putIndex" i
281-- | Modify a given index of an array using a modifier function without checking
281-- | Modify a given index of an array using a modifier function without checking
@@ -284,8 +284,8 @@ putIndex i x arr@Array {..} =
284-- Unsafe because it does not check the bounds of the array.
284-- Unsafe because it does not check the bounds of the array.
286-- /Pre-release/
286-- /Pre-release/
287−modifyIndexUnsafe :: MonadIO m => Int -> (a -> (a, b)) -> Array a -> m b
287+modifyIndexUnsafe :: MonadIO m => Int -> Array a -> (a -> (a, b)) -> m b
288−modifyIndexUnsafe i f Array {..} = do
288+modifyIndexUnsafe i Array {..} f = do
@@ -300,10 +300,10 @@ modifyIndexUnsafe i f Array {..} = do
300-- | Modify a given index of an array using a modifier function.
300-- | Modify a given index of an array using a modifier function.
302-- /Pre-release/
302-- /Pre-release/
303−modifyIndex :: MonadIO m => Int -> (a -> (a, b)) -> Array a -> m b
303+modifyIndex :: MonadIO m => Int -> Array a -> (a -> (a, b)) -> m b
304−modifyIndex i f arr@Array {..} = do
304+modifyIndex i arr@Array {..} f = do
305 if i >= 0 && i < arrLen
305 if i >= 0 && i < arrLen
306− then modifyIndexUnsafe i f arr
306+ then modifyIndexUnsafe i arr f
307 else invalidIndex "modifyIndex" i
307 else invalidIndex "modifyIndex" i
309-------------------------------------------------------------------------------
309-------------------------------------------------------------------------------
@@ -362,7 +362,7 @@ reallocWith label sizer reqSize arr = do
362snocUnsafe :: MonadIO m => Array a -> a -> m (Array a)
362snocUnsafe :: MonadIO m => Array a -> a -> m (Array a)
363snocUnsafe arr@Array {..} a = do
363snocUnsafe arr@Array {..} a = do
364 assert (arrStart + arrLen < arrTrueLen) (return ())
364 assert (arrStart + arrLen < arrTrueLen) (return ())
365− putIndexUnsafe arrLen a arr
365+ putIndexUnsafe arrLen arr a
366 return $ arr {arrLen = arrLen + 1}
366 return $ arr {arrLen = arrLen + 1}
368-- NOINLINE to move it out of the way and not pollute the instruction cache.
368-- NOINLINE to move it out of the way and not pollute the instruction cache.