Safe Haskell | None |
---|

- data MVector
- type IOVector u v = MVector u v RealWorld
- type STVector = MVector
- length :: MVector u a => MVector u v s (a, b) -> Int
- null :: MVector u a => MVector u v s (a, b) -> Bool
- slice :: (MVector u a, MVector v b) => Int -> Int -> MVector u v s (a, b) -> MVector u v s (a, b)
- init :: (MVector u a, MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b)
- tail :: (MVector u a, MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b)
- take :: (MVector u a, MVector v b) => Int -> MVector u v s (a, b) -> MVector u v s (a, b)
- drop :: (MVector u a, MVector v b) => Int -> MVector u v s (a, b) -> MVector u v s (a, b)
- unsafeSlice :: (MVector u a, MVector v b) => Int -> Int -> MVector u v s (a, b) -> MVector u v s (a, b)
- unsafeInit :: (MVector u a, MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b)
- unsafeTail :: (MVector u a, MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b)
- unsafeTake :: (MVector u a, MVector v b) => Int -> MVector u v s (a, b) -> MVector u v s (a, b)
- unsafeDrop :: (MVector u a, MVector v b) => Int -> MVector u v s (a, b) -> MVector u v s (a, b)
- overlaps :: (MVector u a, MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b) -> Bool
- new :: (PrimMonad m, MVector u a, MVector v b) => Int -> m (MVector u v (PrimState m) (a, b))
- unsafeNew :: (PrimMonad m, MVector u a, MVector v b) => Int -> m (MVector u v (PrimState m) (a, b))
- replicate :: (PrimMonad m, MVector u a, MVector v b) => Int -> (a, b) -> m (MVector u v (PrimState m) (a, b))
- clone :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> m (MVector u v (PrimState m) (a, b))
- grow :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> m (MVector u v (PrimState m) (a, b))
- unsafeGrow :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> m (MVector u v (PrimState m) (a, b))
- clear :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> m ()
- read :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> m (a, b)
- write :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> (a, b) -> m ()
- swap :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> Int -> m ()
- unsafeRead :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> m (a, b)
- unsafeWrite :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> (a, b) -> m ()
- unsafeSwap :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> Int -> m ()
- set :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> (a, b) -> m ()
- copy :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> MVector u v (PrimState m) (a, b) -> m ()
- unsafeCopy :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> MVector u v (PrimState m) (a, b) -> m ()
- unsafeZip :: u s a -> v s b -> MVector u v s (a, b)
- projectFst :: MVector u v s (a, b) -> u s a
- projectSnd :: MVector u v s (a, b) -> v s b
- newWith :: (PrimMonad m, MVector u a, MVector v b) => Int -> (a, b) -> m (MVector u v (PrimState m) (a, b))
- unsafeNewWith :: (PrimMonad m, MVector u a, MVector v b) => Int -> (a, b) -> m (MVector u v (PrimState m) (a, b))

# Documentation

# Accessors

## Length information

## Extracting subvectors

slice :: (MVector u a, MVector v b) => Int -> Int -> MVector u v s (a, b) -> MVector u v s (a, b)Source

Yield a part of the mutable vector without copying it.

:: (MVector u a, MVector v b) | |

=> Int | starting index |

-> Int | length of the slice |

-> MVector u v s (a, b) | |

-> MVector u v s (a, b) |

Yield a part of the mutable vector without copying it. No bounds checks are performed.

unsafeTake :: (MVector u a, MVector v b) => Int -> MVector u v s (a, b) -> MVector u v s (a, b)Source

unsafeDrop :: (MVector u a, MVector v b) => Int -> MVector u v s (a, b) -> MVector u v s (a, b)Source

## Overlapping

overlaps :: (MVector u a, MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b) -> BoolSource

# Construction

## Initialisation

new :: (PrimMonad m, MVector u a, MVector v b) => Int -> m (MVector u v (PrimState m) (a, b))Source

Create a mutable vector of the given length.

unsafeNew :: (PrimMonad m, MVector u a, MVector v b) => Int -> m (MVector u v (PrimState m) (a, b))Source

Create a mutable vector of the given length. The length is not checked.

replicate :: (PrimMonad m, MVector u a, MVector v b) => Int -> (a, b) -> m (MVector u v (PrimState m) (a, b))Source

Create a mutable vector of the given length (0 if the length is negative) and fill it with an initial value.

clone :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> m (MVector u v (PrimState m) (a, b))Source

Create a copy of a mutable vector.

## Growing

grow :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> m (MVector u v (PrimState m) (a, b))Source

Grow a vector by the given number of elements. The number must be positive.

unsafeGrow :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> m (MVector u v (PrimState m) (a, b))Source

Grow a vector by the given number of elements. The number must be positive but this is not checked.

## Restricting memory usage

clear :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> m ()Source

Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.

# Accessing individual elements

read :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> m (a, b)Source

Yield the element at the given position.

write :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> (a, b) -> m ()Source

Replace the element at the given position.

swap :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> Int -> m ()Source

Swap the elements at the given positions.

unsafeRead :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> m (a, b)Source

Yield the element at the given position. No bounds checks are performed.

unsafeWrite :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> (a, b) -> m ()Source

Replace the element at the given position. No bounds checks are performed.

unsafeSwap :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> Int -> Int -> m ()Source

Swap the elements at the given positions. No bounds checks are performed.

# Modifying vectors

## Filling and copying

set :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> (a, b) -> m ()Source

Set all elements of the vector to the given value.

copy :: (PrimMonad m, MVector u a, MVector v b) => MVector u v (PrimState m) (a, b) -> MVector u v (PrimState m) (a, b) -> m ()Source

Copy a vector. The two vectors must have the same length and may not overlap.

:: (PrimMonad m, MVector u a, MVector v b) | |

=> MVector u v (PrimState m) (a, b) | target |

-> MVector u v (PrimState m) (a, b) | source |

-> m () |

Copy a vector. The two vectors must have the same length and may not overlap. This is not checked.

# Unsafe Construction and deconstruction

unsafeZip :: u s a -> v s b -> MVector u v s (a, b)Source

The mutable vectors are assumed to be of the same length and to not overlap. This is not checked.

projectFst :: MVector u v s (a, b) -> u s aSource

projectSnd :: MVector u v s (a, b) -> v s bSource