on master help sign in
Remove unsafeIndex in Array.Foreign.Mut.Type
commit097a17113e1b5cfb113b2b2beaa7f7eef00ecc1a authorAdithya Kumar <adithya@composewell.com> dateSun 18 Jul 2021, 19:05 (5 years ago) parent8d31acd
2 files changed+1−7
src/Streamly/Internal/Data/Array/Foreign/Mut/Type.hs−6 src/Streamly/Internal/Data/Array/Foreign/Type.hs+1−1
src/Streamly/Internal/Data/Array/Foreign/Mut/Type.hs−6
@@ -53,7 +53,6 @@ module Streamly.Internal.Data.Array.Foreign.Mut.Type
5353
5454 -- * Random access
5555 , unsafeIndexIO
56− , unsafeIndex
5756
5857 -- * Mutation
5958 , unsafeWriteIndex
@@ -408,11 +407,6 @@ unsafeIndexIO Array {..} i =
408407 (return ())
409408 peek elemOff
410409
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−
416410-- | /O(1)/ Get the byte length of the array.
417411--
418412-- @since 0.7.0
src/Streamly/Internal/Data/Array/Foreign/Type.hs+1−1
@@ -381,7 +381,7 @@ unsafeIndexIO arr = MA.unsafeIndexIO (unsafeThaw arr)
381381-- | Return element at the specified index without checking the bounds.
382382{-# INLINE_NORMAL unsafeIndex #-}
383383unsafeIndex :: 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
385385
386386-- | /O(1)/ Get the byte length of the array.
387387--