rio-0.1.24.0: A standard library for Haskell

Safe Haskell | None
Language | Haskell2010

RIO.Vector.Partial

Contents

- Accessors
  - Indexing
  - Monadic indexing
  - Extracting subvectors
- Modifying vectors
  - Bulk updates
  - Accumulations
  - Permutations
- Folding
  - Specialised folds
  - Monadic folds
- Prefix sums (scans)

Description

Generic `Vector` interface partial functions. Import as:

    import qualified RIO.Vector.Partial as V'

Synopsis

- (!) :: (HasCallStack, Vector v a) => v a -> Int -> a
- head :: Vector v a => v a -> a
- last :: Vector v a => v a -> a
- indexM :: (HasCallStack, Vector v a, Monad m) => v a -> Int -> m a
- headM :: (Vector v a, Monad m) => v a -> m a
- lastM :: (Vector v a, Monad m) => v a -> m a
- init :: Vector v a => v a -> v a
- tail :: Vector v a => v a -> v a
- (//) :: Vector v a => v a -> [(Int, a)] -> v a
- update :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a) -> v a
- update_ :: (Vector v a, Vector v Int) => v a -> v Int -> v a -> v a
- accum :: Vector v a => (a -> b -> a) -> v a -> [(Int, b)] -> v a
- accumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> v a -> v (Int, b) -> v a
- accumulate_ :: (Vector v a, Vector v Int, Vector v b) => (a -> b -> a) -> v a -> v Int -> v b -> v a
- backpermute :: (HasCallStack, Vector v a, Vector v Int) => v a -> v Int -> v a
- foldl1 :: Vector v a => (a -> a -> a) -> v a -> a
- foldl1' :: Vector v a => (a -> a -> a) -> v a -> a
- foldr1 :: Vector v a => (a -> a -> a) -> v a -> a
- foldr1' :: Vector v a => (a -> a -> a) -> v a -> a
- maximum :: (Vector v a, Ord a) => v a -> a
- maximumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a
- minimum :: (Vector v a, Ord a) => v a -> a
- minimumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a
- minIndex :: (Vector v a, Ord a) => v a -> Int
- minIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int
- maxIndex :: (Vector v a, Ord a) => v a -> Int
- maxIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int
- fold1M :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m a
- fold1M' :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m a
- fold1M_ :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m ()
- fold1M'_ :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m ()
- scanl1 :: Vector v a => (a -> a -> a) -> v a -> v a
- scanl1' :: Vector v a => (a -> a -> a) -> v a -> v a
- scanr1 :: Vector v a => (a -> a -> a) -> v a -> v a
- scanr1' :: Vector v a => (a -> a -> a) -> v a -> v a

# Accessors

## Indexing

(!) :: (HasCallStack, Vector v a) => v a -> Int -> a #

head :: Vector v a => v a -> a #

last :: Vector v a => v a -> a #

## Monadic indexing

indexM :: (HasCallStack, Vector v a, Monad m) => v a -> Int -> m a #

headM :: (Vector v a, Monad m) => v a -> m a #

lastM :: (Vector v a, Monad m) => v a -> m a #

## Extracting subvectors

init :: Vector v a => v a -> v a #

tail :: Vector v a => v a -> v a #

# Modifying vectors

## Bulk updates

(//) :: Vector v a => v a -> [(Int, a)] -> v a #

update :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a) -> v a #

update_ :: (Vector v a, Vector v Int) => v a -> v Int -> v a -> v a #

## Accumulations

accum :: Vector v a => (a -> b -> a) -> v a -> [(Int, b)] -> v a #

accumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> v a -> v (Int, b) -> v a #

accumulate_ :: (Vector v a, Vector v Int, Vector v b) => (a -> b -> a) -> v a -> v Int -> v b -> v a #

## Permutations

backpermute :: (HasCallStack, Vector v a, Vector v Int) => v a -> v Int -> v a #

# Folding

foldl1 :: Vector v a => (a -> a -> a) -> v a -> a #

foldl1' :: Vector v a => (a -> a -> a) -> v a -> a #

foldr1 :: Vector v a => (a -> a -> a) -> v a -> a #

foldr1' :: Vector v a => (a -> a -> a) -> v a -> a #

## Specialised folds

maximum :: (Vector v a, Ord a) => v a -> a #

maximumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a #

minimum :: (Vector v a, Ord a) => v a -> a #

minimumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a #

minIndex :: (Vector v a, Ord a) => v a -> Int #

minIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int #

maxIndex :: (Vector v a, Ord a) => v a -> Int #

maxIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int #

## Monadic folds

fold1M :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m a #

fold1M' :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m a #

fold1M_ :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m () #

fold1M'_ :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m () #

# Prefix sums (scans)

scanl1 :: Vector v a => (a -> a -> a) -> v a -> v a #

scanl1' :: Vector v a => (a -> a -> a) -> v a -> v a #

scanr1 :: Vector v a => (a -> a -> a) -> v a -> v a #

scanr1' :: Vector v a => (a -> a -> a) -> v a -> v a #