module RIO.Vector.Storable.Unsafe
(
Data.Vector.Storable.unsafeIndex
, Data.Vector.Storable.unsafeHead
, Data.Vector.Storable.unsafeLast
, Data.Vector.Storable.unsafeIndexM
, Data.Vector.Storable.unsafeHeadM
, Data.Vector.Storable.unsafeLastM
, Data.Vector.Storable.unsafeSlice
, Data.Vector.Storable.unsafeInit
, Data.Vector.Storable.unsafeTail
, Data.Vector.Storable.unsafeTake
, Data.Vector.Storable.unsafeDrop
, Data.Vector.Storable.unsafeUpd
, Data.Vector.Storable.unsafeUpdate_
, Data.Vector.Storable.unsafeAccum
, Data.Vector.Storable.unsafeAccumulate_
, Data.Vector.Storable.unsafeBackpermute
, Data.Vector.Storable.unsafeFreeze
, Data.Vector.Storable.unsafeThaw
, Data.Vector.Storable.unsafeCopy
, Data.Vector.Storable.unsafeFromForeignPtr
, Data.Vector.Storable.unsafeFromForeignPtr0
, Data.Vector.Storable.unsafeToForeignPtr
, Data.Vector.Storable.unsafeToForeignPtr0
, unsafeWith
) where
import Data.Vector.Storable(Storable, Vector)
import qualified Data.Vector.Storable
import Foreign.Ptr(Ptr)
import UnliftIO
unsafeWith :: (MonadUnliftIO m, Storable a) => Vector a -> (Ptr a -> m b) -> m b
unsafeWith :: Vector a -> (Ptr a -> m b) -> m b
unsafeWith Vector a
vec Ptr a -> m b
action = ((forall a. m a -> IO a) -> IO b) -> m b
forall (m :: * -> *) b.
MonadUnliftIO m =>
((forall a. m a -> IO a) -> IO b) -> m b
withRunInIO (((forall a. m a -> IO a) -> IO b) -> m b)
-> ((forall a. m a -> IO a) -> IO b) -> m b
forall a b. (a -> b) -> a -> b
$ \forall a. m a -> IO a
unlifter -> Vector a -> (Ptr a -> IO b) -> IO b
forall a b. Storable a => Vector a -> (Ptr a -> IO b) -> IO b
Data.Vector.Storable.unsafeWith Vector a
vec (m b -> IO b
forall a. m a -> IO a
unlifter (m b -> IO b) -> (Ptr a -> m b) -> Ptr a -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr a -> m b
action)