on master help sign in
Remove unsafeIndex in Array.Foreign.Mut.Type
097a171Adithya Kumar
src/Streamly/Internal/Data/Array/Foreign/Mut/Type.hs−6
@@ -53,7 +53,6 @@ module Streamly.Internal.Data.Array.Foreign.Mut.Type
53
53
54 -- * Random access
54 -- * Random access
55 , unsafeIndexIO
55 , unsafeIndexIO
56− , unsafeIndex
57
56
58 -- * Mutation
57 -- * Mutation
59 , unsafeWriteIndex
58 , unsafeWriteIndex
@@ -408,11 +407,6 @@ unsafeIndexIO Array {..} i =
408 (return ())
407 (return ())
409 peek elemOff
408 peek elemOff
410
409
411−-- | Return element at the specified index without checking the bounds.
412−{-# INLINE_NORMAL unsafeIndex #-}
413−unsafeIndex :: forall a. Storable a => Array a -> Int -> a
414−unsafeIndex arr i = let !r = unsafeInlineIO $ unsafeIndexIO arr i in r
415−
416-- | /O(1)/ Get the byte length of the array.
410-- | /O(1)/ Get the byte length of the array.
417--
411--
418-- @since 0.7.0
412-- @since 0.7.0
src/Streamly/Internal/Data/Array/Foreign/Type.hs+1−1
@@ -381,7 +381,7 @@ unsafeIndexIO arr = MA.unsafeIndexIO (unsafeThaw arr)
381-- | Return element at the specified index without checking the bounds.
381-- | Return element at the specified index without checking the bounds.
382{-# INLINE_NORMAL unsafeIndex #-}
382{-# INLINE_NORMAL unsafeIndex #-}
383unsafeIndex :: forall a. Storable a => Array a -> Int -> a
383unsafeIndex :: forall a. Storable a => Array a -> Int -> a
384−unsafeIndex arr = MA.unsafeIndex (unsafeThaw arr)
384+unsafeIndex arr i = let !r = MA.unsafeInlineIO $ unsafeIndexIO arr i in r
385
385
386-- | /O(1)/ Get the byte length of the array.
386-- | /O(1)/ Get the byte length of the array.
387--
387--