@@ -240,7 +240,7 @@ _null :: Storable a => Array a -> Bool
240240_null arr = length arr == 0
241241
242242{-# INLINE _last #-}
243−_last :: (MonadIO m, Storable a) => Array a -> m (Maybe a)
243+_last :: Storable a => Array a -> Maybe a
244244_last arr = readIndex arr (length arr - 1)
245245
246246-------------------------------------------------------------------------------
@@ -343,16 +343,16 @@ foldbWith level f = undefined
343343-- Random reads and writes
344344-------------------------------------------------------------------------------
345345
346−-- | /O(1)/ Lookup the element at the given index.
346+-- | /O(1)/ Lookup the element at the given index, starting from 0.
347347--
348348-- @since 0.7.0
349349{-# INLINE readIndex #-}
350−readIndex :: (MonadIO m, Storable a) => Array a -> Int -> m (Maybe a)
350+readIndex :: Storable a => Array a -> Int -> Maybe a
351351readIndex arr i =
352352 if i < 0 || i > length arr - 1
353− then return Nothing
354− else liftIO $ withForeignPtr (aStart arr) $ \p ->
355− fmap Just $ peekElemOff p i
353+ then Nothing
354+ else A.unsafeInlineIO $
355+ withForeignPtr (aStart arr) $ \p -> fmap Just $ peekElemOff p i
356356
357357{-
358358-- | @readSlice arr i count@ streams a slice of the array @arr@ starting