rio-0.1.24.0: A standard library for Haskell

Safe Haskell | None
Language | Haskell2010

RIO.Vector.Storable.Unsafe

Contents

- Accessors
  - Indexing
  - Monadic indexing
  - Extracting subvectors
- Modifying vectors
  - Bulk updates
  - Accumulations
  - Permutations
- Conversions
  - Mutable vectors
- Raw pointers

Description

Storable `Vector` unsafe functions. These perform no bounds checking, and may cause segmentation faults etc.! Import as:

    import qualified RIO.Vector.Storable.Unsafe as VS'

Synopsis

- unsafeIndex :: Storable a => Vector a -> Int -> a
- unsafeHead :: Storable a => Vector a -> a
- unsafeLast :: Storable a => Vector a -> a
- unsafeIndexM :: (Storable a, Monad m) => Vector a -> Int -> m a
- unsafeHeadM :: (Storable a, Monad m) => Vector a -> m a
- unsafeLastM :: (Storable a, Monad m) => Vector a -> m a
- unsafeSlice :: Storable a => Int -> Int -> Vector a -> Vector a
- unsafeInit :: Storable a => Vector a -> Vector a
- unsafeTail :: Storable a => Vector a -> Vector a
- unsafeTake :: Storable a => Int -> Vector a -> Vector a
- unsafeDrop :: Storable a => Int -> Vector a -> Vector a
- unsafeUpd :: Storable a => Vector a -> [(Int, a)] -> Vector a
- unsafeUpdate_ :: Storable a => Vector a -> Vector Int -> Vector a -> Vector a
- unsafeAccum :: Storable a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a
- unsafeAccumulate_ :: (Storable a, Storable b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a
- unsafeBackpermute :: Storable a => Vector a -> Vector Int -> Vector a
- unsafeFreeze :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)
- unsafeThaw :: (Storable a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)
- unsafeCopy :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()
- unsafeFromForeignPtr :: Storable a => ForeignPtr a -> Int -> Int -> Vector a
- unsafeFromForeignPtr0 :: ForeignPtr a -> Int -> Vector a
- unsafeToForeignPtr :: Vector a -> (ForeignPtr a, Int, Int)
- unsafeToForeignPtr0 :: Vector a -> (ForeignPtr a, Int)
- unsafeWith :: (MonadUnliftIO m, Storable a) => Vector a -> (Ptr a -> m b) -> m b

# Accessors

## Indexing

unsafeIndex :: Storable a => Vector a -> Int -> a #

unsafeHead :: Storable a => Vector a -> a #

unsafeLast :: Storable a => Vector a -> a #

## Monadic indexing

unsafeIndexM :: (Storable a, Monad m) => Vector a -> Int -> m a #

unsafeHeadM :: (Storable a, Monad m) => Vector a -> m a #

unsafeLastM :: (Storable a, Monad m) => Vector a -> m a #

## Extracting subvectors

unsafeSlice :: Storable a => Int -> Int -> Vector a -> Vector a #

unsafeInit :: Storable a => Vector a -> Vector a #

unsafeTail :: Storable a => Vector a -> Vector a #

unsafeTake :: Storable a => Int -> Vector a -> Vector a #

unsafeDrop :: Storable a => Int -> Vector a -> Vector a #

# Modifying vectors

## Bulk updates

unsafeUpd :: Storable a => Vector a -> [(Int, a)] -> Vector a #

unsafeUpdate_ :: Storable a => Vector a -> Vector Int -> Vector a -> Vector a #

## Accumulations

unsafeAccum :: Storable a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a #

unsafeAccumulate_ :: (Storable a, Storable b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a #

## Permutations

unsafeBackpermute :: Storable a => Vector a -> Vector Int -> Vector a #

# Conversions

## Mutable vectors

unsafeFreeze :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a) #

unsafeThaw :: (Storable a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a) #

unsafeCopy :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m () #

# Raw pointers

unsafeFromForeignPtr :: Storable a => ForeignPtr a -> Int -> Int -> Vector a #

unsafeFromForeignPtr0 :: ForeignPtr a -> Int -> Vector a #

unsafeToForeignPtr :: Vector a -> (ForeignPtr a, Int, Int) #

unsafeToForeignPtr0 :: Vector a -> (ForeignPtr a, Int) #

unsafeWith :: (MonadUnliftIO m, Storable a) => Vector a -> (Ptr a -> m b) -> m b Source #

Lifted version of `unsafeWith`