Data.Primitive.Contiguous

contiguous-0.6.4.2: Unified interface for primitive arrays

Safe Haskell | None
Language | Haskell2010

Data.Primitive.Contiguous

Contents

- Accessors
  - Length Information
  - Indexing
  - Monadic indexing
- Construction
  - Initialisation
  - Fixed Length
  - Running
  - Monadic initialisation
  - Unfolding
  - Enumeration
  - Concatenation
  - Splitting and Splicing
- Slicing
- Modifying arrays
  - Permutations
  - Resizing
- Elementwise operations
  - Mapping
  - Zipping
  - Specific elements
- Working with predicates
  - Filtering
  - Searching
  - Comparing for equality
- Folds
  - Zipping Folds
- Traversals
- Typeclass method defaults
- Prefix sums (scans)
- Conversions
  - Lists
  - Other array types
  - Between mutable and immutable variants
- Hashing
- Forcing an array and its contents
- Classes
- Re-Exports

Description

The contiguous package presents a common API to a number of contiguous array types and their mutable counterparts. This is enabled with the `Contiguous` typeclass, which parameterises over a contiguous array type and defines the core operations. However, the stable part of the interface is contained in this module, which combines those primitives into common, efficient array algorithms suitable for replacing pointer-heavy list manipulations.

Synopsis

- size :: (Contiguous arr, Element arr b) => arr b -> Int
- sizeMut :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> m Int
- null :: Contiguous arr => arr b -> Bool
- index :: (Contiguous arr, Element arr b) => arr b -> Int -> b
- index# :: (Contiguous arr, Element arr b) => arr b -> Int -> (# b #)
- read :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> m b
- indexM :: (Contiguous arr, Element arr b, Monad m) => arr b -> Int -> m b
- empty :: Contiguous arr => arr a
- new :: (Contiguous arr, PrimMonad m, Element arr b) => Int -> m (Mutable arr (PrimState m) b)
- singleton :: (Contiguous arr, Element arr a) => a -> arr a
- doubleton :: (Contiguous arr, Element arr a) => a -> a -> arr a
- tripleton :: (Contiguous arr, Element arr a) => a -> a -> a -> arr a
- quadrupleton :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> arr a
- quintupleton :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> a -> arr a
- sextupleton :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> a -> a -> arr a
- replicate :: (Contiguous arr, Element arr a) => Int -> a -> arr a
- replicateMut :: (Contiguous arr, PrimMonad m, Element arr b) => Int -> b -> m (Mutable arr (PrimState m) b)
- generate :: (Contiguous arr, Element arr a) => Int -> (Int -> a) -> arr a
- generateM :: (Contiguous arr, Element arr a, Monad m) => Int -> (Int -> m a) -> m (arr a)
- generateMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> (Int -> a) -> m (Mutable arr (PrimState m) a)
- iterateN :: (Contiguous arr, Element arr a) => Int -> (a -> a) -> a -> arr a
- iterateMutableN :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> (a -> a) -> a -> m (Mutable arr (PrimState m) a)
- write :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> b -> m ()
- construct1 :: (Contiguous arr, Element arr a) => a -> arr a
- construct2 :: (Contiguous arr, Element arr a) => a -> a -> arr a
- construct3 :: (Contiguous arr, Element arr a) => a -> a -> a -> arr a
- construct4 :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> arr a
- construct5 :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> a -> arr a
- construct6 :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> a -> a -> arr a
- run :: Contiguous arr => (forall s. ST s (arr a)) -> arr a
- replicateMutM :: forall m (arr :: Type -> Type) a. (PrimMonad m, Contiguous arr, Element arr a) => Int -> m a -> m (Mutable arr (PrimState m) a)
- generateMutableM :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> (Int -> m a) -> m (Mutable arr (PrimState m) a)
- iterateMutableNM :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> (a -> m a) -> a -> m (Mutable arr (PrimState m) a)
- create :: (Contiguous arr, Element arr a) => (forall s. ST s (Mutable arr s a)) -> arr a
- createT :: (Contiguous arr, Element arr a, Traversable f) => (forall s. ST s (f (Mutable arr s a))) -> f (arr a)
- unfoldr :: (Contiguous arr, Element arr a) => (b -> Maybe (a, b)) -> b -> arr a
- unfoldrN :: (Contiguous arr, Element arr a) => Int -> (b -> Maybe (a, b)) -> b -> arr a
- unfoldrMutable :: forall (arr :: Type -> Type) a m b. (Contiguous arr, Element arr a, PrimMonad m) => (b -> Maybe (a, b)) -> b -> m (Mutable arr (PrimState m) a)
- enumFromN :: (Contiguous arr, Element arr a, Enum a) => a -> Int -> arr a
- enumFromMutableN :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m, Enum a) => a -> Int -> m (Mutable arr (PrimState m) a)
- append :: (Contiguous arr, Element arr a) => arr a -> arr a -> arr a
- insertAt :: (Contiguous arr, Element arr b) => arr b -> Int -> b -> arr b
- data Slice (arr :: Type -> Type) a
- data MutableSlice (arr :: Type -> Type) s a
- slice :: (Contiguous arr, Element arr a) => arr a -> Int -> Int -> Sliced arr a
- sliceMut :: (Contiguous arr, Element arr a) => Mutable arr s a -> Int -> Int -> MutableSliced arr s a
- toSlice :: (Contiguous arr, Element arr a) => arr a -> Sliced arr a
- toSliceMut :: (Contiguous arr, PrimMonad m, Element arr a) => Mutable arr (PrimState m) a -> m (MutableSliced arr (PrimState m) a)
- replaceAt :: (Contiguous arr, Element arr a) => arr a -> Int -> a -> arr a
- modifyAt :: (Contiguous arr, Element arr a) => (a -> a) -> arr a -> Int -> arr a
- modifyAt' :: (Contiguous arr, Element arr a) => (a -> a) -> arr a -> Int -> arr a
- modifyAtF :: (Contiguous arr, Element arr a, Functor f) => (a -> f a) -> arr a -> Int -> f (arr a)
- modifyAtF' :: (Contiguous arr, Element arr a, Monad f) => (a -> f a) -> arr a -> Int -> f (arr a)
- deleteAt :: (Contiguous arr, Element arr a) => arr a -> Int -> arr a
- reverse :: (Contiguous arr, Element arr a) => arr a -> arr a
- reverseMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Mutable arr (PrimState m) a -> m ()
- reverseSlice :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Mutable arr (PrimState m) a -> Int -> Int -> m ()
- resize :: (ContiguousU arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> m (Mutable arr (PrimState m) b)
- shrink :: (Contiguous arr, PrimMonad m, Element arr a) => Mutable arr (PrimState m) a -> Int -> m (Mutable arr (PrimState m) a)
- unsafeShrinkAndFreeze :: (Contiguous arr, PrimMonad m, Element arr a) => Mutable arr (PrimState m) a -> Int -> m (arr a)
- map :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 c) => (b -> c) -> arr1 b -> arr2 c
- map' :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 c) => (b -> c) -> arr1 b -> arr2 c
- mapMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => (a -> a) -> Mutable arr (PrimState m) a -> m ()
- mapMutable' :: forall m (arr :: Type -> Type) a. (PrimMonad m, Contiguous arr, Element arr a) => (a -> a) -> Mutable arr (PrimState m) a -> m ()
- imap :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 c) => (Int -> b -> c) -> arr1 b -> arr2 c
- imap' :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 c) => (Int -> b -> c) -> arr1 b -> arr2 c
- imapMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => (Int -> a -> a) -> Mutable arr (PrimState m) a -> m ()
- imapMutable' :: forall m (arr :: Type -> Type) a. (PrimMonad m, Contiguous arr, Element arr a) => (Int -> a -> a) -> Mutable arr (PrimState m) a -> m ()
- modify :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => (a -> a) -> Mutable arr (PrimState m) a -> m ()
- modify' :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => (a -> a) -> Mutable arr (PrimState m) a -> m ()
- mapMaybe :: forall arr1 arr2 a b. (Contiguous arr1, Element arr1 a, Contiguous arr2, Element arr2 b) => (a -> Maybe b) -> arr1 a -> arr2 b
- zip :: (Contiguous arr1, Contiguous arr2, Contiguous arr3, Element arr1 a, Element arr2 b, Element arr3 (a, b)) => arr1 a -> arr2 b -> arr3 (a, b)
- zipWith :: (Contiguous arr1, Contiguous arr2, Contiguous arr3, Element arr1 a, Element arr2 b, Element arr3 c) => (a -> b -> c) -> arr1 a -> arr2 b -> arr3 c
- izipWith :: (Contiguous arr1, Contiguous arr2, Contiguous arr3, Element arr1 a, Element arr2 b, Element arr3 c) => (Int -> a -> b -> c) -> arr1 a -> arr2 b -> arr3 c
- swap :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Mutable arr (PrimState m) a -> Int -> Int -> m ()
- filter :: (Contiguous arr, Element arr a) => (a -> Bool) -> arr a -> arr a
- ifilter :: (Contiguous arr, Element arr a) => (Int -> a -> Bool) -> arr a -> arr a
- catMaybes :: (Contiguous arr, Element arr a, Element arr (Maybe a)) => arr (Maybe a) -> arr a
- lefts :: (Contiguous arr, Element arr a, Element arr (Either a b)) => arr (Either a b) -> arr a
- rights :: forall arr a b. (Contiguous arr, Element arr b, Element arr (Either a b)) => arr (Either a b) -> arr b
- partitionEithers :: (Contiguous arr, Element arr a, Element arr b, Element arr (Either a b)) => arr (Either a b) -> (arr a, arr b)
- find :: (Contiguous arr, Element arr a) => (a -> Bool) -> arr a -> Maybe a
- findIndex :: (Contiguous arr, Element arr a) => (a -> Bool) -> arr a -> Maybe Int
- elem :: (Contiguous arr, Element arr a, Eq a) => a -> arr a -> Bool
- maximum :: (Contiguous arr, Element arr a, Ord a) => arr a -> Maybe a
- minimum :: (Contiguous arr, Element arr a, Ord a) => arr a -> Maybe a
- maximumBy :: (Contiguous arr, Element arr a) => (a -> a -> Ordering) -> arr a -> Maybe a
- minimumBy :: (Contiguous arr, Element arr a) => (a -> a -> Ordering) -> arr a -> Maybe a
- equals :: (Contiguous arr, Element arr b, Eq b) => arr b -> arr b -> Bool
- equalsMut :: Contiguous arr => Mutable arr s a -> Mutable arr s a -> Bool
- same :: ContiguousU arr => arr a -> arr a -> Bool
- foldl :: (Contiguous arr, Element arr a) => (b -> a -> b) -> b -> arr a -> b
- foldl' :: (Contiguous arr, Element arr a) => (b -> a -> b) -> b -> arr a -> b
- foldr :: (Contiguous arr, Element arr a) => (a -> b -> b) -> b -> arr a -> b
- foldr' :: (Contiguous arr, Element arr a) => (a -> b -> b) -> b -> arr a -> b
- foldMap :: (Contiguous arr, Element arr a, Monoid m) => (a -> m) -> arr a -> m
- foldMap' :: (Contiguous arr, Element arr a, Monoid m) => (a -> m) -> arr a -> m
- foldlMap' :: (Contiguous arr, Element arr a, Monoid m) => (a -> m) -> arr a -> m
- ifoldl' :: (Contiguous arr, Element arr a) => (b -> Int -> a -> b) -> b -> arr a -> b
- ifoldr :: (Contiguous arr, Element arr a) => (Int -> a -> b -> b) -> b -> arr a -> b
- ifoldr' :: (Contiguous arr, Element arr a) => (Int -> a -> b -> b) -> b -> arr a -> b
- ifoldlMap' :: (Contiguous arr, Element arr a, Monoid m) => (Int -> a -> m) -> arr a -> m
- ifoldlMap1' :: (Contiguous arr, Element arr a, Semigroup m) => (Int -> a -> m) -> arr a -> m
- foldlM' :: (Contiguous arr, Element arr a, Monad m) => (b -> a -> m b) -> b -> arr a -> m b
- ifoldlM' :: (Contiguous arr, Element arr a, Monad m) => (b -> Int -> a -> m b) -> b -> arr a -> m b
- foldrM' :: (Contiguous arr, Element arr a, Monad m) => (a -> b -> m b) -> b -> arr a -> m b
- asum :: (Contiguous arr, Element arr (f a), Alternative f) => arr (f a) -> f a
- all :: (Contiguous arr, Element arr a) => (a -> Bool) -> arr a -> Bool
- any :: (Contiguous arr, Element arr a) => (a -> Bool) -> arr a -> Bool
- foldrZipWith :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (a -> b -> c -> c) -> c -> arr1 a -> arr2 b -> c
- ifoldrZipWith :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> a -> b -> c -> c) -> c -> arr1 a -> arr2 b -> c
- foldlZipWith' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (c -> a -> b -> c) -> c -> arr1 a -> arr2 b -> c
- ifoldlZipWith' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> c -> a -> b -> c) -> c -> arr1 a -> arr2 b -> c
- foldlZipWithM' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Monad m) => (c -> a -> b -> m c) -> c -> arr1 a -> arr2 b -> m c
- ifoldlZipWithM' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Monad m) => (Int -> c -> a -> b -> m c) -> c -> arr1 a -> arr2 b -> m c
- traverse :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Applicative f) => (a -> f b) -> arr1 a -> f (arr2 b)
- traverse_ :: (Contiguous arr, Element arr a, Applicative f) => (a -> f b) -> arr a -> f ()
- itraverse :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Applicative f) => (Int -> a -> f b) -> arr1 a -> f (arr2 b)
- itraverse_ :: (Contiguous arr, Element arr a, Applicative f) => (Int -> a -> f b) -> arr a -> f ()
- traverseP :: (PrimMonad m, Contiguous arr1, Element arr1 a, Contiguous arr2, Element arr2 b) => (a -> m b) -> arr1 a -> m (arr2 b)
- itraverseP :: (PrimMonad m, Contiguous arr1, Element arr1 a, Contiguous arr2, Element arr2 b) => (Int -> a -> m b) -> arr1 a -> m (arr2 b)
- mapM :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Monad m) => (a -> m b) -> arr1 a -> m (arr2 b)
- forM :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Monad m) => arr1 a -> (a -> m b) -> m (arr2 b)
- mapM_ :: (Contiguous arr, Element arr a, Element arr b, Applicative f) => (a -> f b) -> arr a -> f ()
- forM_ :: (Contiguous arr, Element arr a, Element arr b, Applicative f) => arr a -> (a -> f b) -> f ()
- for :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Applicative f) => arr1 a -> (a -> f b) -> f (arr2 b)
- for_ :: (Contiguous arr, Element arr a, Applicative f) => arr a -> (a -> f b) -> f ()
- sequence :: (Contiguous arr1, Contiguous arr2, Element arr1 (f a), Element arr2 a, Applicative f) => arr1 (f a) -> f (arr2 a)
- sequence_ :: (Contiguous arr, Element arr (f a), Applicative f) => arr (f a) -> f ()
- (<$) :: (Contiguous arr1, Contiguous arr2, Element arr1 b, Element arr2 a) => a -> arr1 b -> arr2 a
- ap :: (Contiguous arr1, Contiguous arr2, Contiguous arr3, Element arr1 (a -> b), Element arr2 a, Element arr3 b) => arr1 (a -> b) -> arr2 a -> arr3 b
- scanl :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (b -> a -> b) -> b -> arr1 a -> arr2 b
- scanl' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (b -> a -> b) -> b -> arr1 a -> arr2 b
- iscanl :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> b -> a -> b) -> b -> arr1 a -> arr2 b
- iscanl' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> b -> a -> b) -> b -> arr1 a -> arr2 b
- prescanl :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (b -> a -> b) -> b -> arr1 a -> arr2 b
- prescanl' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (b -> a -> b) -> b -> arr1 a -> arr2 b
- iprescanl :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> b -> a -> b) -> b -> arr1 a -> arr2 b
- iprescanl' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> b -> a -> b) -> b -> arr1 a -> arr2 b
- mapAccum' :: forall arr1 arr2 a b c. (Contiguous arr1, Contiguous arr2, Element arr1 b, Element arr2 c, Monoid a) => (b -> (a, c)) -> arr1 b -> (a, arr2 c)
- mapAccumLM' :: (Contiguous arr1, Contiguous arr2, Element arr1 b, Element arr2 c, Monad m) => (a -> b -> m (a, c)) -> a -> arr1 b -> m (a, arr2 c)
- fromList :: (Contiguous arr, Element arr a) => [a] -> arr a
- fromListN :: (Contiguous arr, Element arr a) => Int -> [a] -> arr a
- fromListMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => [a] -> m (Mutable arr (PrimState m) a)
- fromListMutableN :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> [a] -> m (Mutable arr (PrimState m) a)
- unsafeFromListN :: (Contiguous arr, Element arr a) => Int -> [a] -> arr a
- unsafeFromListReverseN :: (Contiguous arr, Element arr a) => Int -> [a] -> arr a
- unsafeFromListReverseMutableN :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> [a] -> m (Mutable arr (PrimState m) a)
- toList :: (Contiguous arr, Element arr a) => arr a -> [a]
- toListMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Mutable arr (PrimState m) a -> m [a]
- convert :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 b) => arr1 b -> arr2 b
- lift :: ContiguousU arr => Unlifted arr b -> arr b
- liftMut :: ContiguousU arr => UnliftedMut arr s b -> Mutable arr s b
- unlift :: ContiguousU arr => arr b -> Unlifted arr b
- unliftMut :: ContiguousU arr => Mutable arr s b -> UnliftedMut arr s b
- clone :: (Contiguous arr, Element arr b) => Sliced arr b -> arr b
- cloneMut :: (Contiguous arr, PrimMonad m, Element arr b) => MutableSliced arr (PrimState m) b -> m (Mutable arr (PrimState m) b)
- copy :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> Sliced arr b -> m ()
- copyMut :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> MutableSliced arr (PrimState m) b -> m ()
- freeze :: (Contiguous arr, PrimMonad m, Element arr a) => MutableSliced arr (PrimState m) a -> m (arr a)
- thaw :: (Contiguous arr, PrimMonad m, Element arr b) => Sliced arr b -> m (Mutable arr (PrimState m) b)
- unsafeFreeze :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> m (arr b)
- liftHashWithSalt :: (Contiguous arr, Element arr a) => (Int -> a -> Int) -> Int -> arr a -> Int
- rnf :: (Contiguous arr, NFData a, Element arr a) => arr a -> ()
- class Contiguous (arr :: Type -> Type) where
  - type Mutable (arr :: Type -> Type) = (r :: Type -> Type -> Type) | r -> arr
  - type Element (arr :: Type -> Type) :: Type -> Constraint
  - type Sliced (arr :: Type -> Type) :: Type -> Type
  - type MutableSliced (arr :: Type -> Type) :: Type -> Type -> Type
- class Contiguous arr => ContiguousU (arr :: Type -> Type)
- class Always a
- data Array a
- data MutableArray s a
- data SmallArray a
- data SmallMutableArray s a
- data PrimArray a
- data MutablePrimArray s a
- type UnliftedArray a = UnliftedArray_ (Unlifted a) a
- type MutableUnliftedArray s a = MutableUnliftedArray_ (Unlifted a) s a

# Accessors

## Length Information

size :: (Contiguous arr, Element arr b) => arr b -> Int #

The size of the array

sizeMut :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> m Int #

The size of the mutable array

null :: Contiguous arr => arr b -> Bool #

Test whether the array is empty.

## Indexing

index :: (Contiguous arr, Element arr b) => arr b -> Int -> b #

Index into an array at the given index.

index# :: (Contiguous arr, Element arr b) => arr b -> Int -> (# b #) #

Index into an array at the given index, yielding an unboxed one-tuple of the element.

read :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> m b #

Read a mutable array at the given index.

## Monadic indexing

indexM :: (Contiguous arr, Element arr b, Monad m) => arr b -> Int -> m b #

Indexing in a monad.

The monad allows operations to be strict in the array when necessary. Suppose array copying is implemented like this:

    copy mv v = ... write mv i (v ! i) ...

For lazy arrays, `v ! i` would not be not be evaluated, which means that `mv` would unnecessarily retain a reference to `v` in each element written.

With `indexM`, copying can be implemented like this instead:

    copy mv v = ... do
      x <- indexM v i
      write mv i x

Here, no references to `v` are retained because indexing (but not the elements) is evaluated eagerly.

# Construction

## Initialisation

empty :: Contiguous arr => arr a #

The empty array.

new :: (Contiguous arr, PrimMonad m, Element arr b) => Int -> m (Mutable arr (PrimState m) b) #

Allocate a new mutable array of the given size.

singleton :: (Contiguous arr, Element arr a) => a -> arr a #

Create a singleton array.

doubleton :: (Contiguous arr, Element arr a) => a -> a -> arr a #

Create a doubleton array.

tripleton :: (Contiguous arr, Element arr a) => a -> a -> a -> arr a #

Create a tripleton array.

quadrupleton :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> arr a #

Create a quadrupleton array.

quintupleton :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> a -> arr a #

Create a quintupleton array.

sextupleton :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> a -> a -> arr a #

Create a sextupleton array.

replicate :: (Contiguous arr, Element arr a) => Int -> a -> arr a #

``replicate` n x` is an array of length `n` with `x` the value of every element.

replicateMut :: (Contiguous arr, PrimMonad m, Element arr b) => Int -> b -> m (Mutable arr (PrimState m) b) #

``replicateMut` n x` is a mutable array of length `n` with `x` the value of every element.

generate :: (Contiguous arr, Element arr a) => Int -> (Int -> a) -> arr a #

Construct an array of the given length by applying the function to each index.

generateM :: (Contiguous arr, Element arr a, Monad m) => Int -> (Int -> m a) -> m (arr a) #

Construct an array of the given length by applying the monadic action to each index.

generateMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> (Int -> a) -> m (Mutable arr (PrimState m) a) #

Construct a mutable array of the given length by applying the function to each index.

iterateN :: (Contiguous arr, Element arr a) => Int -> (a -> a) -> a -> arr a #

Apply a function `n` times to a value and construct an array where each consecutive element is the result of an additional application of this function. The zeroth element is the original value.

    iterateN 5 (+ 1) 0 = fromListN 5 [0,1,2,3,4]

iterateMutableN :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> (a -> a) -> a -> m (Mutable arr (PrimState m) a) #

Apply a function `n` times to a value and construct a mutable array where each consecutive element is the result of an additional application of this function. The zeroth element is the original value.

write :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> b -> m () #

Write to a mutable array at the given index.

## Fixed Length

construct1 :: (Contiguous arr, Element arr a) => a -> arr a #

construct2 :: (Contiguous arr, Element arr a) => a -> a -> arr a #

construct3 :: (Contiguous arr, Element arr a) => a -> a -> a -> arr a #

construct4 :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> arr a #

construct5 :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> a -> arr a #

construct6 :: (Contiguous arr, Element arr a) => a -> a -> a -> a -> a -> a -> arr a #

## Running

run :: Contiguous arr => (forall s. ST s (arr a)) -> arr a #

Run an effectful computation that produces an array.

## Monadic initialisation

replicateMutM :: forall m (arr :: Type -> Type) a. (PrimMonad m, Contiguous arr, Element arr a) => Int -> m a -> m (Mutable arr (PrimState m) a) #

``replicateMutM` n act` performs the action n times, gathering the results.

generateMutableM :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> (Int -> m a) -> m (Mutable arr (PrimState m) a) #

Construct a mutable array of the given length by applying the monadic action to each index.

iterateMutableNM :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> (a -> m a) -> a -> m (Mutable arr (PrimState m) a) #

Apply a monadic function `n` times to a value and construct a mutable array where each consecutive element is the result of an additional application of this function. The zeroth element is the original value.

create :: (Contiguous arr, Element arr a) => (forall s. ST s (Mutable arr s a)) -> arr a #

Execute the monad action and freeze the resulting array.

createT :: (Contiguous arr, Element arr a, Traversable f) => (forall s. ST s (f (Mutable arr s a))) -> f (arr a) #

Execute the monadic action and freeze the resulting array.

## Unfolding

unfoldr :: (Contiguous arr, Element arr a) => (b -> Maybe (a, b)) -> b -> arr a #

Construct an array by repeatedly applying a generator function to a seed. The generator function yields `Just` the next element and the new seed or `Nothing` if there are no more elements.

    >>> unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1) 10
        <10,9,8,7,6,5,4,3,2,1>

unfoldrN :: (Contiguous arr, Element arr a) => Int -> (b -> Maybe (a, b)) -> b -> arr a #

Construct an array with at most n elements by repeatedly applying the generator function to a seed. The generator function yields `Just` the next element and the new seed or `Nothing` if there are no more elements.

unfoldrMutable :: forall (arr :: Type -> Type) a m b. (Contiguous arr, Element arr a, PrimMonad m) => (b -> Maybe (a, b)) -> b -> m (Mutable arr (PrimState m) a) #

Construct a mutable array by repeatedly applying a generator function to a seed. The generator function yields `Just` the next element and the new seed or `Nothing` if there are no more elements.

    >>> unfoldrMutable (\n -> if n == 0 then Nothing else Just (n,n-1) 10
        <10,9,8,7,6,5,4,3,2,1>

## Enumeration

enumFromN :: (Contiguous arr, Element arr a, Enum a) => a -> Int -> arr a #

Yield an array of the given length containing the values `x, `succ` x, `succ` (`succ` x)` etc.

enumFromMutableN :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m, Enum a) => a -> Int -> m (Mutable arr (PrimState m) a) #

Yield a mutable array of the given length containing the values `x, `succ` x, `succ` (`succ` x)` etc.

## Concatenation

append :: (Contiguous arr, Element arr a) => arr a -> arr a -> arr a #

Append two arrays.

## Splitting and Splicing

insertAt #

Arguments

:: (Contiguous arr, Element arr b) |
=> arr b | slice to copy from
-> Int | index in the output array to insert at
-> b | element to insert
-> arr b |

Copy a slice of an array and then insert an element into that array.

The default implementation performs a memset which would be unnecessary except that the garbage collector might trace the uninitialized array.

Was previously `insertSlicing` @since 0.6.0

# Slicing

data Slice (arr :: Type -> Type) a #

Slices of immutable arrays: packages an offset and length with a backing array.

Since: 0.6.0

#### Instances

Instances details

ContiguousU arr => Contiguous (Slice arr) # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Mutable (Slice arr) |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable (Slice arr) = MutableSlice arr
type Element (Slice arr) |
Instance details Defined in Data.Primitive.Contiguous.Class type Element (Slice arr) = Element arr
type Sliced (Slice arr) |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced (Slice arr) = Slice arr
type MutableSliced (Slice arr) |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced (Slice arr) = MutableSlice arr
Methods new :: (PrimMonad m, Element (Slice arr) b) => Int -> m (Mutable (Slice arr) (PrimState m) b) # replicateMut :: (PrimMonad m, Element (Slice arr) b) => Int -> b -> m (Mutable (Slice arr) (PrimState m) b) # shrink :: (PrimMonad m, Element (Slice arr) a) => Mutable (Slice arr) (PrimState m) a -> Int -> m (Mutable (Slice arr) (PrimState m) a) # empty :: Slice arr a # singleton :: Element (Slice arr) a => a -> Slice arr a # doubleton :: Element (Slice arr) a => a -> a -> Slice arr a # tripleton :: Element (Slice arr) a => a -> a -> a -> Slice arr a # quadrupleton :: Element (Slice arr) a => a -> a -> a -> a -> Slice arr a # quintupleton :: Element (Slice arr) a => a -> a -> a -> a -> a -> Slice arr a # sextupleton :: Element (Slice arr) a => a -> a -> a -> a -> a -> a -> Slice arr a # index :: Element (Slice arr) b => Slice arr b -> Int -> b # index# :: Element (Slice arr) b => Slice arr b -> Int -> (# b #) # indexM :: (Element (Slice arr) b, Monad m) => Slice arr b -> Int -> m b # read :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> m b # write :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> b -> m () # null :: Slice arr b -> Bool # size :: Element (Slice arr) b => Slice arr b -> Int # sizeMut :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> m Int # equals :: (Element (Slice arr) b, Eq b) => Slice arr b -> Slice arr b -> Bool # equalsMut :: Mutable (Slice arr) s a -> Mutable (Slice arr) s a -> Bool # slice :: Element (Slice arr) a => Slice arr a -> Int -> Int -> Sliced (Slice arr) a # sliceMut :: Element (Slice arr) a => Mutable (Slice arr) s a -> Int -> Int -> MutableSliced (Slice arr) s a # toSlice :: Element (Slice arr) a => Slice arr a -> Sliced (Slice arr) a # toSliceMut :: (PrimMonad m, Element (Slice arr) a) => Mutable (Slice arr) (PrimState m) a -> m (MutableSliced (Slice arr) (PrimState m) a) # clone :: Element (Slice arr) b => Sliced (Slice arr) b -> Slice arr b # clone_ :: Element (Slice arr) a => Slice arr a -> Int -> Int -> Slice arr a # cloneMut :: (PrimMonad m, Element (Slice arr) b) => MutableSliced (Slice arr) (PrimState m) b -> m (Mutable (Slice arr) (PrimState m) b) # cloneMut_ :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> Int -> m (Mutable (Slice arr) (PrimState m) b) # freeze :: (PrimMonad m, Element (Slice arr) a) => MutableSliced (Slice arr) (PrimState m) a -> m (Slice arr a) # freeze_ :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> Int -> m (Slice arr b) # unsafeFreeze :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> m (Slice arr b) # unsafeShrinkAndFreeze :: (PrimMonad m, Element (Slice arr) a) => Mutable (Slice arr) (PrimState m) a -> Int -> m (Slice arr a) # thaw :: (PrimMonad m, Element (Slice arr) b) => Sliced (Slice arr) b -> m (Mutable (Slice arr) (PrimState m) b) # thaw_ :: (PrimMonad m, Element (Slice arr) b) => Slice arr b -> Int -> Int -> m (Mutable (Slice arr) (PrimState m) b) # copy :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> Sliced (Slice arr) b -> m () # copy_ :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> Slice arr b -> Int -> Int -> m () # copyMut :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> MutableSliced (Slice arr) (PrimState m) b -> m () # copyMut_ :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> Mutable (Slice arr) (PrimState m) b -> Int -> Int -> m () # insertAt :: Element (Slice arr) b => Slice arr b -> Int -> b -> Slice arr b # rnf :: (NFData a, Element (Slice arr) a) => Slice arr a -> () # run :: (forall s. ST s (Slice arr a)) -> Slice arr a #
type Element (Slice arr) # |
Instance details Defined in Data.Primitive.Contiguous.Class type Element (Slice arr) = Element arr
type Mutable (Slice arr) # |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable (Slice arr) = MutableSlice arr
type MutableSliced (Slice arr) # |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced (Slice arr) = MutableSlice arr
type Sliced (Slice arr) # |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced (Slice arr) = Slice arr

data MutableSlice (arr :: Type -> Type) s a #

Slices of mutable arrays: packages an offset and length with a mutable backing array.

Since: 0.6.0

slice :: (Contiguous arr, Element arr a) => arr a -> Int -> Int -> Sliced arr a #

Create a `Slice` of an array.

`O(1)`.

Since: 0.6.0

sliceMut :: (Contiguous arr, Element arr a) => Mutable arr s a -> Int -> Int -> MutableSliced arr s a #

Create a `MutableSlice` of a mutable array.

`O(1)`.

Since: 0.6.0

toSlice :: (Contiguous arr, Element arr a) => arr a -> Sliced arr a #

Create a `Slice` that covers the entire array.

Since: 0.6.0

toSliceMut :: (Contiguous arr, PrimMonad m, Element arr a) => Mutable arr (PrimState m) a -> m (MutableSliced arr (PrimState m) a) #

Create a `MutableSlice` that covers the entire array.

Since: 0.6.0

# Modifying arrays

replaceAt :: (Contiguous arr, Element arr a) => arr a -> Int -> a -> arr a #

Create a copy of an array except the element at the index is replaced with the given value.

modifyAt :: (Contiguous arr, Element arr a) => (a -> a) -> arr a -> Int -> arr a #

modifyAt' :: (Contiguous arr, Element arr a) => (a -> a) -> arr a -> Int -> arr a #

Variant of modifyAt that forces the result before installing it in the array.

modifyAtF :: (Contiguous arr, Element arr a, Functor f) => (a -> f a) -> arr a -> Int -> f (arr a) #

modifyAtF' :: (Contiguous arr, Element arr a, Monad f) => (a -> f a) -> arr a -> Int -> f (arr a) #

Variant of modifyAtF that forces the result before installing it in the array. Note that this requires `Monad` rather than `Functor`.

deleteAt :: (Contiguous arr, Element arr a) => arr a -> Int -> arr a #

Delete the element at the given position.

## Permutations

reverse :: (Contiguous arr, Element arr a) => arr a -> arr a #

Reverse the elements of an array.

reverseMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Mutable arr (PrimState m) a -> m () #

Reverse the elements of a mutable array, in-place.

reverseSlice #

Arguments

:: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) |
=> Mutable arr (PrimState m) a |
-> Int | start index
-> Int | end index
-> m () |

Reverse the elements of a slice of a mutable array, in-place.

## Resizing

resize :: (ContiguousU arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> Int -> m (Mutable arr (PrimState m) b) #

Resize an array into one with the given size.

shrink #

Arguments

:: (Contiguous arr, PrimMonad m, Element arr a) |
=> Mutable arr (PrimState m) a |
-> Int | new length
-> m (Mutable arr (PrimState m) a) |

Resize an array without growing it.

Since: 0.6.0

unsafeShrinkAndFreeze #

Arguments

:: (Contiguous arr, PrimMonad m, Element arr a) |
=> Mutable arr (PrimState m) a |
-> Int | final size
-> m (arr a) |

# Elementwise operations

## Mapping

map :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 c) => (b -> c) -> arr1 b -> arr2 c #

Map over the elements of an array.

Note that because a new array must be created, the resulting array type can be different than the original.

map' :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 c) => (b -> c) -> arr1 b -> arr2 c #

Map strictly over the elements of an array.

Note that because a new array must be created, the resulting array type can be different than the original.

mapMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => (a -> a) -> Mutable arr (PrimState m) a -> m () #

Map over a mutable array, modifying the elements in place.

mapMutable' :: forall m (arr :: Type -> Type) a. (PrimMonad m, Contiguous arr, Element arr a) => (a -> a) -> Mutable arr (PrimState m) a -> m () #

Strictly map over a mutable array, modifying the elements in place.

imap :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 c) => (Int -> b -> c) -> arr1 b -> arr2 c #

Map over the elements of an array with the index.

imap' :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 c) => (Int -> b -> c) -> arr1 b -> arr2 c #

Map strictly over the elements of an array with the index.

Note that because a new array must be created, the resulting array type can be different than the original.

imapMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => (Int -> a -> a) -> Mutable arr (PrimState m) a -> m () #

Map over a mutable array with indices, modifying the elements in place.

imapMutable' :: forall m (arr :: Type -> Type) a. (PrimMonad m, Contiguous arr, Element arr a) => (Int -> a -> a) -> Mutable arr (PrimState m) a -> m () #

Strictly map over a mutable array with indices, modifying the elements in place.

modify :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => (a -> a) -> Mutable arr (PrimState m) a -> m () #

Modify the elements of a mutable array in-place.

modify' :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => (a -> a) -> Mutable arr (PrimState m) a -> m () #

Strictly modify the elements of a mutable array in-place.

mapMaybe :: forall arr1 arr2 a b. (Contiguous arr1, Element arr1 a, Contiguous arr2, Element arr2 b) => (a -> Maybe b) -> arr1 a -> arr2 b #

The `mapMaybe` function is a version of `map` which can throw out elements. In particular, the functional arguments returns something of type ``Maybe` b`. If this is `Nothing`, no element is added on to the result array. If it is ``Just` b`, then `b` is included in the result array.

## Zipping

zip :: (Contiguous arr1, Contiguous arr2, Contiguous arr3, Element arr1 a, Element arr2 b, Element arr3 (a, b)) => arr1 a -> arr2 b -> arr3 (a, b) #

`zip` takes two arrays and returns an array of corresponding pairs.

    zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]

If one input array is shorter than the other, excess elements of the longer array are discarded:

    zip [1] ['a', 'b'] = [(1, 'a')]
    zip [1, 2] ['a'] = [(1, 'a')]

zipWith :: (Contiguous arr1, Contiguous arr2, Contiguous arr3, Element arr1 a, Element arr2 b, Element arr3 c) => (a -> b -> c) -> arr1 a -> arr2 b -> arr3 c #

`zipWith` generalises `zip` by zipping with the function given as the first argument, instead of a tupling function. For example, `zipWith` (+) is applied to two arrays to produce an array of the corresponding sums.

izipWith :: (Contiguous arr1, Contiguous arr2, Contiguous arr3, Element arr1 a, Element arr2 b, Element arr3 c) => (Int -> a -> b -> c) -> arr1 a -> arr2 b -> arr3 c #

Variant of `zipWith` that provides the index of each pair of elements.

## Specific elements

swap :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Mutable arr (PrimState m) a -> Int -> Int -> m () #

Swap the elements of the mutable array at the given indices.

# Working with predicates

## Filtering

filter :: (Contiguous arr, Element arr a) => (a -> Bool) -> arr a -> arr a #

Drop elements that do not satisfy the predicate.

ifilter :: (Contiguous arr, Element arr a) => (Int -> a -> Bool) -> arr a -> arr a #

Drop elements that do not satisfy the predicate which is applied to values and their indices.

catMaybes :: (Contiguous arr, Element arr a, Element arr (Maybe a)) => arr (Maybe a) -> arr a #

The `catMaybes` function takes a list of `Maybe`s and returns a list of all the `Just` values.

lefts :: (Contiguous arr, Element arr a, Element arr (Either a b)) => arr (Either a b) -> arr a #

Extracts from an array of `Either` all the `Left` elements. All the `Left` elements are extracted in order.

rights :: forall arr a b. (Contiguous arr, Element arr b, Element arr (Either a b)) => arr (Either a b) -> arr b #

Extracts from an array of `Either` all the `Right` elements. All the `Right` elements are extracted in order.

partitionEithers :: (Contiguous arr, Element arr a, Element arr b, Element arr (Either a b)) => arr (Either a b) -> (arr a, arr b) #

Partitions an array of `Either` into two arrays. All the `Left` elements are extracted, in order, to the first component of the output. Similarly the `Right` elements are extracted to the second component of the output.

## Searching

find :: (Contiguous arr, Element arr a) => (a -> Bool) -> arr a -> Maybe a #

`find` takes a predicate and an array, and returns the leftmost element of the array matching the prediate, or `Nothing` if there is no such element.

findIndex :: (Contiguous arr, Element arr a) => (a -> Bool) -> arr a -> Maybe Int #

`findIndex` takes a predicate and an array, and returns the index of the leftmost element of the array matching the prediate, or `Nothing` if there is no such element.

elem :: (Contiguous arr, Element arr a, Eq a) => a -> arr a -> Bool #

Does the element occur in the structure?

maximum :: (Contiguous arr, Element arr a, Ord a) => arr a -> Maybe a #

The largest element of a structure.

minimum :: (Contiguous arr, Element arr a, Ord a) => arr a -> Maybe a #

The least element of a structure.

maximumBy :: (Contiguous arr, Element arr a) => (a -> a -> Ordering) -> arr a -> Maybe a #

The largest element of a structure with respect to the given comparison function.

minimumBy :: (Contiguous arr, Element arr a) => (a -> a -> Ordering) -> arr a -> Maybe a #

The least element of a structure with respect to the given comparison function.

## Comparing for equality

equals :: (Contiguous arr, Element arr b, Eq b) => arr b -> arr b -> Bool #

Test the two arrays for equality.

equalsMut :: Contiguous arr => Mutable arr s a -> Mutable arr s a -> Bool #

Test the two mutable arrays for pointer equality. Does not check equality of elements.

same :: ContiguousU arr => arr a -> arr a -> Bool #

This function does not behave deterministically. Optimization level and inlining can affect its results. However, the one thing that can be counted on is that if it returns `True`, the two immutable arrays are definitely the same. This is useful as shortcut for equality tests. However, keep in mind that a result of `False` tells us nothing about the arguments.

# Folds

foldl :: (Contiguous arr, Element arr a) => (b -> a -> b) -> b -> arr a -> b #

Left fold over the elements of an array.

foldl' :: (Contiguous arr, Element arr a) => (b -> a -> b) -> b -> arr a -> b #

Strict left fold over the elements of an array.

foldr :: (Contiguous arr, Element arr a) => (a -> b -> b) -> b -> arr a -> b #

Right fold over the element of an array.

foldr' :: (Contiguous arr, Element arr a) => (a -> b -> b) -> b -> arr a -> b #

Strict right fold over the elements of an array.

foldMap :: (Contiguous arr, Element arr a, Monoid m) => (a -> m) -> arr a -> m #

Monoidal fold over the element of an array.

foldMap' :: (Contiguous arr, Element arr a, Monoid m) => (a -> m) -> arr a -> m #

Strict monoidal fold over the elements of an array.

foldlMap' :: (Contiguous arr, Element arr a, Monoid m) => (a -> m) -> arr a -> m #

Strict left monoidal fold over the elements of an array.

ifoldl' :: (Contiguous arr, Element arr a) => (b -> Int -> a -> b) -> b -> arr a -> b #

Strict left fold over the elements of an array, where the accumulating function cares about the index of the element.

ifoldr :: (Contiguous arr, Element arr a) => (Int -> a -> b -> b) -> b -> arr a -> b #

Right fold over the element of an array, lazy in the accumulator, provides index to the step function.

ifoldr' :: (Contiguous arr, Element arr a) => (Int -> a -> b -> b) -> b -> arr a -> b #

Strict right fold over the elements of an array, where the accumulating function cares about the index of the element.

ifoldlMap' :: (Contiguous arr, Element arr a, Monoid m) => (Int -> a -> m) -> arr a -> m #

Strict monoidal fold over the elements of an array.

ifoldlMap1' :: (Contiguous arr, Element arr a, Semigroup m) => (Int -> a -> m) -> arr a -> m #

Strict monoidal fold over the elements of an array.

foldlM' :: (Contiguous arr, Element arr a, Monad m) => (b -> a -> m b) -> b -> arr a -> m b #

Strict left monadic fold over the elements of an array.

ifoldlM' :: (Contiguous arr, Element arr a, Monad m) => (b -> Int -> a -> m b) -> b -> arr a -> m b #

Strict left monadic fold over the elements of an array.

foldrM' :: (Contiguous arr, Element arr a, Monad m) => (a -> b -> m b) -> b -> arr a -> m b #

Strict right monadic fold over the elements of an array.

asum :: (Contiguous arr, Element arr (f a), Alternative f) => arr (f a) -> f a #

The sum of a collection of actions, generalizing `concat`.

    >>> asum (C.fromList ['Just' "Hello", 'Nothing', Just "World"] :: Array String)
    Just "Hello"

all :: (Contiguous arr, Element arr a) => (a -> Bool) -> arr a -> Bool #

any :: (Contiguous arr, Element arr a) => (a -> Bool) -> arr a -> Bool #

## Zipping Folds

foldrZipWith :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (a -> b -> c -> c) -> c -> arr1 a -> arr2 b -> c #

Variant of `zipWith` that accepts an accumulator, performing a lazy right fold over both arrays.

ifoldrZipWith :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> a -> b -> c -> c) -> c -> arr1 a -> arr2 b -> c #

Variant of `foldrZipWith` that provides the index of each pair of elements.

foldlZipWith' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (c -> a -> b -> c) -> c -> arr1 a -> arr2 b -> c #

ifoldlZipWith' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> c -> a -> b -> c) -> c -> arr1 a -> arr2 b -> c #

foldlZipWithM' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Monad m) => (c -> a -> b -> m c) -> c -> arr1 a -> arr2 b -> m c #

Variant of `zipWith` that accepts an accumulator, performing a strict left monadic fold over both arrays.

ifoldlZipWithM' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Monad m) => (Int -> c -> a -> b -> m c) -> c -> arr1 a -> arr2 b -> m c #

Variant of 'foldlZipWithM'' that provides the index of each pair of elements.

# Traversals

traverse :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Applicative f) => (a -> f b) -> arr1 a -> f (arr2 b) #

Map each element of the array to an action, evaluate these actions from left to right, and collect the results. For a version that ignores the results, see `traverse_`.

traverse_ :: (Contiguous arr, Element arr a, Applicative f) => (a -> f b) -> arr a -> f () #

Map each element of the array to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results, see `traverse`.

itraverse :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Applicative f) => (Int -> a -> f b) -> arr1 a -> f (arr2 b) #

Map each element of the array and its index to an action, evaluating these actions from left to right.

itraverse_ :: (Contiguous arr, Element arr a, Applicative f) => (Int -> a -> f b) -> arr a -> f () #

Map each element of the array and its index to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results, see `itraverse`.

traverseP :: (PrimMonad m, Contiguous arr1, Element arr1 a, Contiguous arr2, Element arr2 b) => (a -> m b) -> arr1 a -> m (arr2 b) #

Map each element of the array to an action, evaluate these actions from left to right, and collect the results in a new array.

itraverseP :: (PrimMonad m, Contiguous arr1, Element arr1 a, Contiguous arr2, Element arr2 b) => (Int -> a -> m b) -> arr1 a -> m (arr2 b) #

Map each element of the array to an action, evaluate these actions from left to right, and collect the results in a new array.

mapM :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Monad m) => (a -> m b) -> arr1 a -> m (arr2 b) #

Map each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results. for a version that ignores the results see `mapM_`.

forM :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Monad m) => arr1 a -> (a -> m b) -> m (arr2 b) #

`forM` is `mapM` with its arguments flipped. For a version that ignores its results, see `forM_`.

mapM_ :: (Contiguous arr, Element arr a, Element arr b, Applicative f) => (a -> f b) -> arr a -> f () #

Map each element of a structure to a monadic action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see `mapM`.

`mapM_` = `traverse_`

forM_ :: (Contiguous arr, Element arr a, Element arr b, Applicative f) => arr a -> (a -> f b) -> f () #

`forM_` is `mapM_` with its arguments flipped. For a version that doesn't ignore its results, see `forM`.

for :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b, Applicative f) => arr1 a -> (a -> f b) -> f (arr2 b) #

`for` is `traverse` with its arguments flipped. For a version that ignores the results see `for_`.

for_ :: (Contiguous arr, Element arr a, Applicative f) => arr a -> (a -> f b) -> f () #

`for_` is `traverse_` with its arguments flipped. For a version that doesn't ignore the results see `for`.

    >>> for_ (C.fromList [1..4] :: PrimArray Int) print
    1
    2
    3
    4

sequence :: (Contiguous arr1, Contiguous arr2, Element arr1 (f a), Element arr2 a, Applicative f) => arr1 (f a) -> f (arr2 a) #

Evaluate each action in the structure from left to right and collect the results. For a version that ignores the results see `sequence_`.

sequence_ :: (Contiguous arr, Element arr (f a), Applicative f) => arr (f a) -> f () #

Evaluate each action in the structure from left to right and ignore the results. For a version that doesn't ignore the results see `sequence`.

# Typeclass method defaults

(<$) :: (Contiguous arr1, Contiguous arr2, Element arr1 b, Element arr2 a) => a -> arr1 b -> arr2 a #

Replace all locations in the input with the same value.

Equivalent to Data.Functor.`<$`.

ap :: (Contiguous arr1, Contiguous arr2, Contiguous arr3, Element arr1 (a -> b), Element arr2 a, Element arr3 b) => arr1 (a -> b) -> arr2 a -> arr3 b #

Sequential application.

Equivalent to Control.Applicative.`<*>`.

# Prefix sums (scans)

scanl :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (b -> a -> b) -> b -> arr1 a -> arr2 b #

`scanl` is similar to `foldl`, but returns an array of successive reduced values from the left:

    scanl f z [x1, x2, ...] = [z, f z x1, f (f z x1) x2, ...]

Note that

    last (toList (scanl f z xs)) == foldl f z xs.

scanl' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (b -> a -> b) -> b -> arr1 a -> arr2 b #

A strictly accumulating version of `scanl`.

iscanl :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> b -> a -> b) -> b -> arr1 a -> arr2 b #

A variant of `scanl` whose function argument takes the current index as an argument.

iscanl' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> b -> a -> b) -> b -> arr1 a -> arr2 b #

A strictly accumulating version of `iscanl`.

prescanl :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (b -> a -> b) -> b -> arr1 a -> arr2 b #

A prescan.

    prescanl f z = init . scanl f z

Example: `prescanl (+) 0 <1,2,3,4> = <0,1,3,6>`

prescanl' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (b -> a -> b) -> b -> arr1 a -> arr2 b #

Like `prescanl`, but with a strict accumulator.

iprescanl :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> b -> a -> b) -> b -> arr1 a -> arr2 b #

A variant of `prescanl` where the function argument takes the current index of the array as an additional argument.

iprescanl' :: (Contiguous arr1, Contiguous arr2, Element arr1 a, Element arr2 b) => (Int -> b -> a -> b) -> b -> arr1 a -> arr2 b #

Like `iprescanl`, but with a strict accumulator.

mapAccum' :: forall arr1 arr2 a b c. (Contiguous arr1, Contiguous arr2, Element arr1 b, Element arr2 c, Monoid a) => (b -> (a, c)) -> arr1 b -> (a, arr2 c) #

mapAccumLM' :: (Contiguous arr1, Contiguous arr2, Element arr1 b, Element arr2 c, Monad m) => (a -> b -> m (a, c)) -> a -> arr1 b -> m (a, arr2 c) #

Monadic accumulating strict left fold over the elements on an array.

# Conversions

## Lists

fromList :: (Contiguous arr, Element arr a) => [a] -> arr a #

Convert a list into an array.

fromListN :: (Contiguous arr, Element arr a) => Int -> [a] -> arr a #

Given an `Int` that is representative of the length of the list, convert the list into a mutable array of the given length.

Note: calls `error` if the given length is incorrect.

fromListMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => [a] -> m (Mutable arr (PrimState m) a) #

Convert a list into a mutable array of the given length.

fromListMutableN :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> [a] -> m (Mutable arr (PrimState m) a) #

Given an `Int` that is representative of the length of the list, convert the list into a mutable array of the given length.

Note: calls `error` if the given length is incorrect.

unsafeFromListN #

Arguments

:: (Contiguous arr, Element arr a) |
=> Int | length of list
-> [a] | list
-> arr a |

Create an array from a list. If the given length does not match the actual length, this function has undefined behavior.

unsafeFromListReverseN :: (Contiguous arr, Element arr a) => Int -> [a] -> arr a #

Create an array from a list, reversing the order of the elements. If the given length does not match the actual length, this function has undefined behavior.

unsafeFromListReverseMutableN :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Int -> [a] -> m (Mutable arr (PrimState m) a) #

Create a mutable array from a list, reversing the order of the elements. If the given length does not match the actual length, this function has undefined behavior.

toList :: (Contiguous arr, Element arr a) => arr a -> [a] #

Convert an array to a list.

toListMutable :: forall (arr :: Type -> Type) a m. (Contiguous arr, Element arr a, PrimMonad m) => Mutable arr (PrimState m) a -> m [a] #

Convert a mutable array to a list.

## Other array types

convert :: (Contiguous arr1, Element arr1 b, Contiguous arr2, Element arr2 b) => arr1 b -> arr2 b #

Convert one type of array into another.

lift :: ContiguousU arr => Unlifted arr b -> arr b #

Lift an array (i.e. point to the data through an intervening thunk).

Since: 0.6.0

liftMut :: ContiguousU arr => UnliftedMut arr s b -> Mutable arr s b #

Lift a mutable array (i.e. point to the data through an intervening thunk).

Since: 0.6.0

unlift :: ContiguousU arr => arr b -> Unlifted arr b #

Unlift an array (i.e. point to the data without an intervening thunk).

Since: 0.6.0

unliftMut :: ContiguousU arr => Mutable arr s b -> UnliftedMut arr s b #

Unlift a mutable array (i.e. point to the data without an intervening thunk).

Since: 0.6.0

## Between mutable and immutable variants

clone #

Arguments

:: (Contiguous arr, Element arr b) |
=> Sliced arr b | slice to copy
-> arr b |

Clone a slice of an array.

cloneMut #

Arguments

:: (Contiguous arr, PrimMonad m, Element arr b) |
=> MutableSliced arr (PrimState m) b | Array to copy a slice of
-> m (Mutable arr (PrimState m) b) |

Clone a slice of a mutable array.

copy #

Arguments

:: (Contiguous arr, PrimMonad m, Element arr b) |
=> Mutable arr (PrimState m) b | destination array
-> Int | offset into destination array
-> Sliced arr b | source slice
-> m () |

Copy a slice of an array into a mutable array.

copyMut #

Arguments

:: (Contiguous arr, PrimMonad m, Element arr b) |
=> Mutable arr (PrimState m) b | destination array
-> Int | offset into destination array
-> MutableSliced arr (PrimState m) b | source slice
-> m () |

Copy a slice of a mutable array into another mutable array. In the case that the destination and source arrays are the same, the regions may overlap.

freeze :: (Contiguous arr, PrimMonad m, Element arr a) => MutableSliced arr (PrimState m) a -> m (arr a) #

Turn a mutable array slice an immutable array by copying.

Since: 0.6.0

thaw :: (Contiguous arr, PrimMonad m, Element arr b) => Sliced arr b -> m (Mutable arr (PrimState m) b) #

Copy a slice of an immutable array into a new mutable array.

unsafeFreeze :: (Contiguous arr, PrimMonad m, Element arr b) => Mutable arr (PrimState m) b -> m (arr b) #

Turn a mutable array into an immutable one without copying. The mutable array should not be used after this conversion.

# Hashing

liftHashWithSalt :: (Contiguous arr, Element arr a) => (Int -> a -> Int) -> Int -> arr a -> Int #

Lift an accumulating hash function over the elements of the array, returning the final accumulated hash.

# Forcing an array and its contents

rnf :: (Contiguous arr, NFData a, Element arr a) => arr a -> () #

Reduce the array and all of its elements to WHNF.

# Classes

class Contiguous (arr :: Type -> Type) #

The `Contiguous` typeclass as an interface to a multitude of contiguous structures.

Some functions do not make sense on slices; for those, see `ContiguousU`.

Minimal complete definition

new, replicateMut, empty, singleton, doubleton, tripleton, quadrupleton, quintupleton, sextupleton, index, index#, indexM, read, write, null, size, sizeMut, equals, equalsMut, slice, sliceMut, toSlice, toSliceMut, clone_, cloneMut_, freeze_, thaw_, copy_, copyMut_, rnf, run

Associated Types

type Mutable (arr :: Type -> Type) = (r :: Type -> Type -> Type) | r -> arr #

The Mutable counterpart to the array.

type Element (arr :: Type -> Type) :: Type -> Constraint #

The constraint needed to store elements in the array.

type Sliced (arr :: Type -> Type) :: Type -> Type #

The slice type of this array. The slice of a raw array type `t` should be 'Slice t', whereas the slice of a slice should be the same slice type.

Since: 0.6.0

type MutableSliced (arr :: Type -> Type) :: Type -> Type -> Type #

The mutable slice type of this array. The mutable slice of a raw array type `t` should be 'MutableSlice t', whereas the mutable slice of a mutable slice should be the same slice type.

Since: 0.6.0

#### Instances

Instances details

Contiguous Array # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Mutable Array |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable Array = MutableArray
type Element Array |
Instance details Defined in Data.Primitive.Contiguous.Class type Element Array = Always
type Sliced Array |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced Array = Slice Array
type MutableSliced Array |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced Array = MutableSlice Array
Methods new :: (PrimMonad m, Element Array b) => Int -> m (Mutable Array (PrimState m) b) # replicateMut :: (PrimMonad m, Element Array b) => Int -> b -> m (Mutable Array (PrimState m) b) # shrink :: (PrimMonad m, Element Array a) => Mutable Array (PrimState m) a -> Int -> m (Mutable Array (PrimState m) a) # empty :: Array a # singleton :: Element Array a => a -> Array a # doubleton :: Element Array a => a -> a -> Array a # tripleton :: Element Array a => a -> a -> a -> Array a # quadrupleton :: Element Array a => a -> a -> a -> a -> Array a # quintupleton :: Element Array a => a -> a -> a -> a -> a -> Array a # sextupleton :: Element Array a => a -> a -> a -> a -> a -> a -> Array a # index :: Element Array b => Array b -> Int -> b # index# :: Element Array b => Array b -> Int -> (# b #) # indexM :: (Element Array b, Monad m) => Array b -> Int -> m b # read :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> m b # write :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> b -> m () # null :: Array b -> Bool # size :: Element Array b => Array b -> Int # sizeMut :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> m Int # equals :: (Element Array b, Eq b) => Array b -> Array b -> Bool # equalsMut :: Mutable Array s a -> Mutable Array s a -> Bool # slice :: Element Array a => Array a -> Int -> Int -> Sliced Array a # sliceMut :: Element Array a => Mutable Array s a -> Int -> Int -> MutableSliced Array s a # toSlice :: Element Array a => Array a -> Sliced Array a # toSliceMut :: (PrimMonad m, Element Array a) => Mutable Array (PrimState m) a -> m (MutableSliced Array (PrimState m) a) # clone :: Element Array b => Sliced Array b -> Array b # clone_ :: Element Array a => Array a -> Int -> Int -> Array a # cloneMut :: (PrimMonad m, Element Array b) => MutableSliced Array (PrimState m) b -> m (Mutable Array (PrimState m) b) # cloneMut_ :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> Int -> m (Mutable Array (PrimState m) b) # freeze :: (PrimMonad m, Element Array a) => MutableSliced Array (PrimState m) a -> m (Array a) # freeze_ :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> Int -> m (Array b) # unsafeFreeze :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> m (Array b) # unsafeShrinkAndFreeze :: (PrimMonad m, Element Array a) => Mutable Array (PrimState m) a -> Int -> m (Array a) # thaw :: (PrimMonad m, Element Array b) => Sliced Array b -> m (Mutable Array (PrimState m) b) # thaw_ :: (PrimMonad m, Element Array b) => Array b -> Int -> Int -> m (Mutable Array (PrimState m) b) # copy :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> Sliced Array b -> m () # copy_ :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> Array b -> Int -> Int -> m () # copyMut :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> MutableSliced Array (PrimState m) b -> m () # copyMut_ :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> Mutable Array (PrimState m) b -> Int -> Int -> m () # insertAt :: Element Array b => Array b -> Int -> b -> Array b # rnf :: (NFData a, Element Array a) => Array a -> () # run :: (forall s. ST s (Array a)) -> Array a #
Contiguous PrimArray # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Mutable PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable PrimArray = MutablePrimArray
type Element PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Element PrimArray = Prim
type Sliced PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced PrimArray = Slice PrimArray
type MutableSliced PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced PrimArray = MutableSlice PrimArray
Methods new :: (PrimMonad m, Element PrimArray b) => Int -> m (Mutable PrimArray (PrimState m) b) # replicateMut :: (PrimMonad m, Element PrimArray b) => Int -> b -> m (Mutable PrimArray (PrimState m) b) # shrink :: (PrimMonad m, Element PrimArray a) => Mutable PrimArray (PrimState m) a -> Int -> m (Mutable PrimArray (PrimState m) a) # empty :: PrimArray a # singleton :: Element PrimArray a => a -> PrimArray a # doubleton :: Element PrimArray a => a -> a -> PrimArray a # tripleton :: Element PrimArray a => a -> a -> a -> PrimArray a # quadrupleton :: Element PrimArray a => a -> a -> a -> a -> PrimArray a # quintupleton :: Element PrimArray a => a -> a -> a -> a -> a -> PrimArray a # sextupleton :: Element PrimArray a => a -> a -> a -> a -> a -> a -> PrimArray a # index :: Element PrimArray b => PrimArray b -> Int -> b # index# :: Element PrimArray b => PrimArray b -> Int -> (# b #) # indexM :: (Element PrimArray b, Monad m) => PrimArray b -> Int -> m b # read :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> m b # write :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> b -> m () # null :: PrimArray b -> Bool # size :: Element PrimArray b => PrimArray b -> Int # sizeMut :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> m Int # equals :: (Element PrimArray b, Eq b) => PrimArray b -> PrimArray b -> Bool # equalsMut :: Mutable PrimArray s a -> Mutable PrimArray s a -> Bool # slice :: Element PrimArray a => PrimArray a -> Int -> Int -> Sliced PrimArray a # sliceMut :: Element PrimArray a => Mutable PrimArray s a -> Int -> Int -> MutableSliced PrimArray s a # toSlice :: Element PrimArray a => PrimArray a -> Sliced PrimArray a # toSliceMut :: (PrimMonad m, Element PrimArray a) => Mutable PrimArray (PrimState m) a -> m (MutableSliced PrimArray (PrimState m) a) # clone :: Element PrimArray b => Sliced PrimArray b -> PrimArray b # clone_ :: Element PrimArray a => PrimArray a -> Int -> Int -> PrimArray a # cloneMut :: (PrimMonad m, Element PrimArray b) => MutableSliced PrimArray (PrimState m) b -> m (Mutable PrimArray (PrimState m) b) # cloneMut_ :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> Int -> m (Mutable PrimArray (PrimState m) b) # freeze :: (PrimMonad m, Element PrimArray a) => MutableSliced PrimArray (PrimState m) a -> m (PrimArray a) # freeze_ :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> Int -> m (PrimArray b) # unsafeFreeze :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> m (PrimArray b) # unsafeShrinkAndFreeze :: (PrimMonad m, Element PrimArray a) => Mutable PrimArray (PrimState m) a -> Int -> m (PrimArray a) # thaw :: (PrimMonad m, Element PrimArray b) => Sliced PrimArray b -> m (Mutable PrimArray (PrimState m) b) # thaw_ :: (PrimMonad m, Element PrimArray b) => PrimArray b -> Int -> Int -> m (Mutable PrimArray (PrimState m) b) # copy :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> Sliced PrimArray b -> m () # copy_ :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> PrimArray b -> Int -> Int -> m () # copyMut :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> MutableSliced PrimArray (PrimState m) b -> m () # copyMut_ :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> Mutable PrimArray (PrimState m) b -> Int -> Int -> m () # insertAt :: Element PrimArray b => PrimArray b -> Int -> b -> PrimArray b # rnf :: (NFData a, Element PrimArray a) => PrimArray a -> () # run :: (forall s. ST s (PrimArray a)) -> PrimArray a #
Contiguous SmallArray # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Mutable SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable SmallArray = SmallMutableArray
type Element SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Element SmallArray = Always
type Sliced SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced SmallArray = Slice SmallArray
type MutableSliced SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced SmallArray = MutableSlice SmallArray
Methods new :: (PrimMonad m, Element SmallArray b) => Int -> m (Mutable SmallArray (PrimState m) b) # replicateMut :: (PrimMonad m, Element SmallArray b) => Int -> b -> m (Mutable SmallArray (PrimState m) b) # shrink :: (PrimMonad m, Element SmallArray a) => Mutable SmallArray (PrimState m) a -> Int -> m (Mutable SmallArray (PrimState m) a) # empty :: SmallArray a # singleton :: Element SmallArray a => a -> SmallArray a # doubleton :: Element SmallArray a => a -> a -> SmallArray a # tripleton :: Element SmallArray a => a -> a -> a -> SmallArray a # quadrupleton :: Element SmallArray a => a -> a -> a -> a -> SmallArray a # quintupleton :: Element SmallArray a => a -> a -> a -> a -> a -> SmallArray a # sextupleton :: Element SmallArray a => a -> a -> a -> a -> a -> a -> SmallArray a # index :: Element SmallArray b => SmallArray b -> Int -> b # index# :: Element SmallArray b => SmallArray b -> Int -> (# b #) # indexM :: (Element SmallArray b, Monad m) => SmallArray b -> Int -> m b # read :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> m b # write :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> b -> m () # null :: SmallArray b -> Bool # size :: Element SmallArray b => SmallArray b -> Int # sizeMut :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> m Int # equals :: (Element SmallArray b, Eq b) => SmallArray b -> SmallArray b -> Bool # equalsMut :: Mutable SmallArray s a -> Mutable SmallArray s a -> Bool # slice :: Element SmallArray a => SmallArray a -> Int -> Int -> Sliced SmallArray a # sliceMut :: Element SmallArray a => Mutable SmallArray s a -> Int -> Int -> MutableSliced SmallArray s a # toSlice :: Element SmallArray a => SmallArray a -> Sliced SmallArray a # toSliceMut :: (PrimMonad m, Element SmallArray a) => Mutable SmallArray (PrimState m) a -> m (MutableSliced SmallArray (PrimState m) a) # clone :: Element SmallArray b => Sliced SmallArray b -> SmallArray b # clone_ :: Element SmallArray a => SmallArray a -> Int -> Int -> SmallArray a # cloneMut :: (PrimMonad m, Element SmallArray b) => MutableSliced SmallArray (PrimState m) b -> m (Mutable SmallArray (PrimState m) b) # cloneMut_ :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> Int -> m (Mutable SmallArray (PrimState m) b) # freeze :: (PrimMonad m, Element SmallArray a) => MutableSliced SmallArray (PrimState m) a -> m (SmallArray a) # freeze_ :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> Int -> m (SmallArray b) # unsafeFreeze :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> m (SmallArray b) # unsafeShrinkAndFreeze :: (PrimMonad m, Element SmallArray a) => Mutable SmallArray (PrimState m) a -> Int -> m (SmallArray a) # thaw :: (PrimMonad m, Element SmallArray b) => Sliced SmallArray b -> m (Mutable SmallArray (PrimState m) b) # thaw_ :: (PrimMonad m, Element SmallArray b) => SmallArray b -> Int -> Int -> m (Mutable SmallArray (PrimState m) b) # copy :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> Sliced SmallArray b -> m () # copy_ :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> SmallArray b -> Int -> Int -> m () # copyMut :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> MutableSliced SmallArray (PrimState m) b -> m () # copyMut_ :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> Mutable SmallArray (PrimState m) b -> Int -> Int -> m () # insertAt :: Element SmallArray b => SmallArray b -> Int -> b -> SmallArray b # rnf :: (NFData a, Element SmallArray a) => SmallArray a -> () # run :: (forall s. ST s (SmallArray a)) -> SmallArray a #
ContiguousU arr => Contiguous (Slice arr) # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Mutable (Slice arr) |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable (Slice arr) = MutableSlice arr
type Element (Slice arr) |
Instance details Defined in Data.Primitive.Contiguous.Class type Element (Slice arr) = Element arr
type Sliced (Slice arr) |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced (Slice arr) = Slice arr
type MutableSliced (Slice arr) |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced (Slice arr) = MutableSlice arr
Methods new :: (PrimMonad m, Element (Slice arr) b) => Int -> m (Mutable (Slice arr) (PrimState m) b) # replicateMut :: (PrimMonad m, Element (Slice arr) b) => Int -> b -> m (Mutable (Slice arr) (PrimState m) b) # shrink :: (PrimMonad m, Element (Slice arr) a) => Mutable (Slice arr) (PrimState m) a -> Int -> m (Mutable (Slice arr) (PrimState m) a) # empty :: Slice arr a # singleton :: Element (Slice arr) a => a -> Slice arr a # doubleton :: Element (Slice arr) a => a -> a -> Slice arr a # tripleton :: Element (Slice arr) a => a -> a -> a -> Slice arr a # quadrupleton :: Element (Slice arr) a => a -> a -> a -> a -> Slice arr a # quintupleton :: Element (Slice arr) a => a -> a -> a -> a -> a -> Slice arr a # sextupleton :: Element (Slice arr) a => a -> a -> a -> a -> a -> a -> Slice arr a # index :: Element (Slice arr) b => Slice arr b -> Int -> b # index# :: Element (Slice arr) b => Slice arr b -> Int -> (# b #) # indexM :: (Element (Slice arr) b, Monad m) => Slice arr b -> Int -> m b # read :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> m b # write :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> b -> m () # null :: Slice arr b -> Bool # size :: Element (Slice arr) b => Slice arr b -> Int # sizeMut :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> m Int # equals :: (Element (Slice arr) b, Eq b) => Slice arr b -> Slice arr b -> Bool # equalsMut :: Mutable (Slice arr) s a -> Mutable (Slice arr) s a -> Bool # slice :: Element (Slice arr) a => Slice arr a -> Int -> Int -> Sliced (Slice arr) a # sliceMut :: Element (Slice arr) a => Mutable (Slice arr) s a -> Int -> Int -> MutableSliced (Slice arr) s a # toSlice :: Element (Slice arr) a => Slice arr a -> Sliced (Slice arr) a # toSliceMut :: (PrimMonad m, Element (Slice arr) a) => Mutable (Slice arr) (PrimState m) a -> m (MutableSliced (Slice arr) (PrimState m) a) # clone :: Element (Slice arr) b => Sliced (Slice arr) b -> Slice arr b # clone_ :: Element (Slice arr) a => Slice arr a -> Int -> Int -> Slice arr a # cloneMut :: (PrimMonad m, Element (Slice arr) b) => MutableSliced (Slice arr) (PrimState m) b -> m (Mutable (Slice arr) (PrimState m) b) # cloneMut_ :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> Int -> m (Mutable (Slice arr) (PrimState m) b) # freeze :: (PrimMonad m, Element (Slice arr) a) => MutableSliced (Slice arr) (PrimState m) a -> m (Slice arr a) # freeze_ :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> Int -> m (Slice arr b) # unsafeFreeze :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> m (Slice arr b) # unsafeShrinkAndFreeze :: (PrimMonad m, Element (Slice arr) a) => Mutable (Slice arr) (PrimState m) a -> Int -> m (Slice arr a) # thaw :: (PrimMonad m, Element (Slice arr) b) => Sliced (Slice arr) b -> m (Mutable (Slice arr) (PrimState m) b) # thaw_ :: (PrimMonad m, Element (Slice arr) b) => Slice arr b -> Int -> Int -> m (Mutable (Slice arr) (PrimState m) b) # copy :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> Sliced (Slice arr) b -> m () # copy_ :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> Slice arr b -> Int -> Int -> m () # copyMut :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> MutableSliced (Slice arr) (PrimState m) b -> m () # copyMut_ :: (PrimMonad m, Element (Slice arr) b) => Mutable (Slice arr) (PrimState m) b -> Int -> Mutable (Slice arr) (PrimState m) b -> Int -> Int -> m () # insertAt :: Element (Slice arr) b => Slice arr b -> Int -> b -> Slice arr b # rnf :: (NFData a, Element (Slice arr) a) => Slice arr a -> () # run :: (forall s. ST s (Slice arr a)) -> Slice arr a #
Contiguous (UnliftedArray_ unlifted_a) # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Mutable (UnliftedArray_ unlifted_a) |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable (UnliftedArray_ unlifted_a) = MutableUnliftedArray_ unlifted_a
type Element (UnliftedArray_ unlifted_a) |
Instance details Defined in Data.Primitive.Contiguous.Class type Element (UnliftedArray_ unlifted_a)
type Sliced (UnliftedArray_ unlifted_a) |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced (UnliftedArray_ unlifted_a) = Slice (UnliftedArray_ unlifted_a)
type MutableSliced (UnliftedArray_ unlifted_a) |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced (UnliftedArray_ unlifted_a) = MutableSlice (UnliftedArray_ unlifted_a)
Methods new :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Int -> m (Mutable (UnliftedArray_ unlifted_a) (PrimState m) b) # replicateMut :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Int -> b -> m (Mutable (UnliftedArray_ unlifted_a) (PrimState m) b) # shrink :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) a) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) a -> Int -> m (Mutable (UnliftedArray_ unlifted_a) (PrimState m) a) # empty :: UnliftedArray_ unlifted_a a # singleton :: Element (UnliftedArray_ unlifted_a) a => a -> UnliftedArray_ unlifted_a a # doubleton :: Element (UnliftedArray_ unlifted_a) a => a -> a -> UnliftedArray_ unlifted_a a # tripleton :: Element (UnliftedArray_ unlifted_a) a => a -> a -> a -> UnliftedArray_ unlifted_a a # quadrupleton :: Element (UnliftedArray_ unlifted_a) a => a -> a -> a -> a -> UnliftedArray_ unlifted_a a # quintupleton :: Element (UnliftedArray_ unlifted_a) a => a -> a -> a -> a -> a -> UnliftedArray_ unlifted_a a # sextupleton :: Element (UnliftedArray_ unlifted_a) a => a -> a -> a -> a -> a -> a -> UnliftedArray_ unlifted_a a # index :: Element (UnliftedArray_ unlifted_a) b => UnliftedArray_ unlifted_a b -> Int -> b # index# :: Element (UnliftedArray_ unlifted_a) b => UnliftedArray_ unlifted_a b -> Int -> (# b #) # indexM :: (Element (UnliftedArray_ unlifted_a) b, Monad m) => UnliftedArray_ unlifted_a b -> Int -> m b # read :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> Int -> m b # write :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> Int -> b -> m () # null :: UnliftedArray_ unlifted_a b -> Bool # size :: Element (UnliftedArray_ unlifted_a) b => UnliftedArray_ unlifted_a b -> Int # sizeMut :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> m Int # equals :: (Element (UnliftedArray_ unlifted_a) b, Eq b) => UnliftedArray_ unlifted_a b -> UnliftedArray_ unlifted_a b -> Bool # equalsMut :: Mutable (UnliftedArray_ unlifted_a) s a -> Mutable (UnliftedArray_ unlifted_a) s a -> Bool # slice :: Element (UnliftedArray_ unlifted_a) a => UnliftedArray_ unlifted_a a -> Int -> Int -> Sliced (UnliftedArray_ unlifted_a) a # sliceMut :: Element (UnliftedArray_ unlifted_a) a => Mutable (UnliftedArray_ unlifted_a) s a -> Int -> Int -> MutableSliced (UnliftedArray_ unlifted_a) s a # toSlice :: Element (UnliftedArray_ unlifted_a) a => UnliftedArray_ unlifted_a a -> Sliced (UnliftedArray_ unlifted_a) a # toSliceMut :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) a) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) a -> m (MutableSliced (UnliftedArray_ unlifted_a) (PrimState m) a) # clone :: Element (UnliftedArray_ unlifted_a) b => Sliced (UnliftedArray_ unlifted_a) b -> UnliftedArray_ unlifted_a b # clone_ :: Element (UnliftedArray_ unlifted_a) a => UnliftedArray_ unlifted_a a -> Int -> Int -> UnliftedArray_ unlifted_a a # cloneMut :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => MutableSliced (UnliftedArray_ unlifted_a) (PrimState m) b -> m (Mutable (UnliftedArray_ unlifted_a) (PrimState m) b) # cloneMut_ :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> Int -> Int -> m (Mutable (UnliftedArray_ unlifted_a) (PrimState m) b) # freeze :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) a) => MutableSliced (UnliftedArray_ unlifted_a) (PrimState m) a -> m (UnliftedArray_ unlifted_a a) # freeze_ :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> Int -> Int -> m (UnliftedArray_ unlifted_a b) # unsafeFreeze :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> m (UnliftedArray_ unlifted_a b) # unsafeShrinkAndFreeze :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) a) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) a -> Int -> m (UnliftedArray_ unlifted_a a) # thaw :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Sliced (UnliftedArray_ unlifted_a) b -> m (Mutable (UnliftedArray_ unlifted_a) (PrimState m) b) # thaw_ :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => UnliftedArray_ unlifted_a b -> Int -> Int -> m (Mutable (UnliftedArray_ unlifted_a) (PrimState m) b) # copy :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> Int -> Sliced (UnliftedArray_ unlifted_a) b -> m () # copy_ :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> Int -> UnliftedArray_ unlifted_a b -> Int -> Int -> m () # copyMut :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> Int -> MutableSliced (UnliftedArray_ unlifted_a) (PrimState m) b -> m () # copyMut_ :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> Int -> Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> Int -> Int -> m () # insertAt :: Element (UnliftedArray_ unlifted_a) b => UnliftedArray_ unlifted_a b -> Int -> b -> UnliftedArray_ unlifted_a b # rnf :: (NFData a, Element (UnliftedArray_ unlifted_a) a) => UnliftedArray_ unlifted_a a -> () # run :: (forall s. ST s (UnliftedArray_ unlifted_a a)) -> UnliftedArray_ unlifted_a a #

class Contiguous arr => ContiguousU (arr :: Type -> Type) #

The `ContiguousU` typeclass is an extension of the `Contiguous` typeclass, but includes operations that make sense only on unsliced contiguous structures.

Since: 0.6.0

Minimal complete definition

resize, unlift, unliftMut, lift, liftMut

#### Instances

Instances details

ContiguousU Array # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Unlifted Array |
Instance details Defined in Data.Primitive.Contiguous.Class type Unlifted Array = Array# :: Type -> UnliftedType
type UnliftedMut Array |
Instance details Defined in Data.Primitive.Contiguous.Class type UnliftedMut Array = MutableArray# :: Type -> Type -> UnliftedType
Methods resize :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> m (Mutable Array (PrimState m) b) # unlift :: Array b -> Unlifted Array b # unliftMut :: Mutable Array s b -> UnliftedMut Array s b # lift :: Unlifted Array b -> Array b # liftMut :: UnliftedMut Array s b -> Mutable Array s b #
ContiguousU PrimArray # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Unlifted PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Unlifted PrimArray
type UnliftedMut PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type UnliftedMut PrimArray
Methods resize :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> m (Mutable PrimArray (PrimState m) b) # unlift :: PrimArray b -> Unlifted PrimArray b # unliftMut :: Mutable PrimArray s b -> UnliftedMut PrimArray s b # lift :: Unlifted PrimArray b -> PrimArray b # liftMut :: UnliftedMut PrimArray s b -> Mutable PrimArray s b #
ContiguousU SmallArray # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Unlifted SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Unlifted SmallArray = SmallArray# :: Type -> UnliftedType
type UnliftedMut SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type UnliftedMut SmallArray = SmallMutableArray# :: Type -> Type -> UnliftedType
Methods resize :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> m (Mutable SmallArray (PrimState m) b) # unlift :: SmallArray b -> Unlifted SmallArray b # unliftMut :: Mutable SmallArray s b -> UnliftedMut SmallArray s b # lift :: Unlifted SmallArray b -> SmallArray b # liftMut :: UnliftedMut SmallArray s b -> Mutable SmallArray s b #
ContiguousU (UnliftedArray_ unlifted_a) # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Unlifted (UnliftedArray_ unlifted_a) |
Instance details Defined in Data.Primitive.Contiguous.Class type Unlifted (UnliftedArray_ unlifted_a)
type UnliftedMut (UnliftedArray_ unlifted_a) |
Instance details Defined in Data.Primitive.Contiguous.Class type UnliftedMut (UnliftedArray_ unlifted_a)
Methods resize :: (PrimMonad m, Element (UnliftedArray_ unlifted_a) b) => Mutable (UnliftedArray_ unlifted_a) (PrimState m) b -> Int -> m (Mutable (UnliftedArray_ unlifted_a) (PrimState m) b) # unlift :: UnliftedArray_ unlifted_a b -> Unlifted (UnliftedArray_ unlifted_a) b # unliftMut :: Mutable (UnliftedArray_ unlifted_a) s b -> UnliftedMut (UnliftedArray_ unlifted_a) s b # lift :: Unlifted (UnliftedArray_ unlifted_a) b -> UnliftedArray_ unlifted_a b # liftMut :: UnliftedMut (UnliftedArray_ unlifted_a) s b -> Mutable (UnliftedArray_ unlifted_a) s b #

class Always a #

A typeclass that is satisfied by all types. This is used used to provide a fake constraint for `Array` and `SmallArray`.

#### Instances

Instances details

Always a # |
Instance details Defined in Data.Primitive.Contiguous.Class

# Re-Exports

data Array a #

Boxed arrays.

#### Instances

Instances details

MonadZip Array |
Instance details Defined in Data.Primitive.Array Methods mzip :: Array a -> Array b -> Array (a, b) # mzipWith :: (a -> b -> c) -> Array a -> Array b -> Array c # munzip :: Array (a, b) -> (Array a, Array b) #
Eq1 Array | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.Array Methods liftEq :: (a -> b -> Bool) -> Array a -> Array b -> Bool #
Ord1 Array | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.Array Methods liftCompare :: (a -> b -> Ordering) -> Array a -> Array b -> Ordering #
Read1 Array | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.Array Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Array a) # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Array a] # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Array a) # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Array a] #
Show1 Array | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.Array Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Array a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Array a] -> ShowS #
Contiguous Array # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Mutable Array |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable Array = MutableArray
type Element Array |
Instance details Defined in Data.Primitive.Contiguous.Class type Element Array = Always
type Sliced Array |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced Array = Slice Array
type MutableSliced Array |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced Array = MutableSlice Array
Methods new :: (PrimMonad m, Element Array b) => Int -> m (Mutable Array (PrimState m) b) # replicateMut :: (PrimMonad m, Element Array b) => Int -> b -> m (Mutable Array (PrimState m) b) # shrink :: (PrimMonad m, Element Array a) => Mutable Array (PrimState m) a -> Int -> m (Mutable Array (PrimState m) a) # empty :: Array a # singleton :: Element Array a => a -> Array a # doubleton :: Element Array a => a -> a -> Array a # tripleton :: Element Array a => a -> a -> a -> Array a # quadrupleton :: Element Array a => a -> a -> a -> a -> Array a # quintupleton :: Element Array a => a -> a -> a -> a -> a -> Array a # sextupleton :: Element Array a => a -> a -> a -> a -> a -> a -> Array a # index :: Element Array b => Array b -> Int -> b # index# :: Element Array b => Array b -> Int -> (# b #) # indexM :: (Element Array b, Monad m) => Array b -> Int -> m b # read :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> m b # write :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> b -> m () # null :: Array b -> Bool # size :: Element Array b => Array b -> Int # sizeMut :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> m Int # equals :: (Element Array b, Eq b) => Array b -> Array b -> Bool # equalsMut :: Mutable Array s a -> Mutable Array s a -> Bool # slice :: Element Array a => Array a -> Int -> Int -> Sliced Array a # sliceMut :: Element Array a => Mutable Array s a -> Int -> Int -> MutableSliced Array s a # toSlice :: Element Array a => Array a -> Sliced Array a # toSliceMut :: (PrimMonad m, Element Array a) => Mutable Array (PrimState m) a -> m (MutableSliced Array (PrimState m) a) # clone :: Element Array b => Sliced Array b -> Array b # clone_ :: Element Array a => Array a -> Int -> Int -> Array a # cloneMut :: (PrimMonad m, Element Array b) => MutableSliced Array (PrimState m) b -> m (Mutable Array (PrimState m) b) # cloneMut_ :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> Int -> m (Mutable Array (PrimState m) b) # freeze :: (PrimMonad m, Element Array a) => MutableSliced Array (PrimState m) a -> m (Array a) # freeze_ :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> Int -> m (Array b) # unsafeFreeze :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> m (Array b) # unsafeShrinkAndFreeze :: (PrimMonad m, Element Array a) => Mutable Array (PrimState m) a -> Int -> m (Array a) # thaw :: (PrimMonad m, Element Array b) => Sliced Array b -> m (Mutable Array (PrimState m) b) # thaw_ :: (PrimMonad m, Element Array b) => Array b -> Int -> Int -> m (Mutable Array (PrimState m) b) # copy :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> Sliced Array b -> m () # copy_ :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> Array b -> Int -> Int -> m () # copyMut :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> MutableSliced Array (PrimState m) b -> m () # copyMut_ :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> Mutable Array (PrimState m) b -> Int -> Int -> m () # insertAt :: Element Array b => Array b -> Int -> b -> Array b # rnf :: (NFData a, Element Array a) => Array a -> () # run :: (forall s. ST s (Array a)) -> Array a #
ContiguousU Array # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Unlifted Array |
Instance details Defined in Data.Primitive.Contiguous.Class type Unlifted Array = Array# :: Type -> UnliftedType
type UnliftedMut Array |
Instance details Defined in Data.Primitive.Contiguous.Class type UnliftedMut Array = MutableArray# :: Type -> Type -> UnliftedType
Methods resize :: (PrimMonad m, Element Array b) => Mutable Array (PrimState m) b -> Int -> m (Mutable Array (PrimState m) b) # unlift :: Array b -> Unlifted Array b # unliftMut :: Mutable Array s b -> UnliftedMut Array s b # lift :: Unlifted Array b -> Array b # liftMut :: UnliftedMut Array s b -> Mutable Array s b #
NFData1 Array |
Instance details Defined in Data.Primitive.Array Methods liftRnf :: (a -> ()) -> Array a -> () #
Alternative Array |
Instance details Defined in Data.Primitive.Array Methods empty :: Array a # (<|>) :: Array a -> Array a -> Array a # some :: Array a -> Array [a] # many :: Array a -> Array [a] #
Applicative Array |
Instance details Defined in Data.Primitive.Array Methods pure :: a -> Array a # (<*>) :: Array (a -> b) -> Array a -> Array b # liftA2 :: (a -> b -> c) -> Array a -> Array b -> Array c # (*>) :: Array a -> Array b -> Array b # (<*) :: Array a -> Array b -> Array a #
Functor Array |
Instance details Defined in Data.Primitive.Array Methods fmap :: (a -> b) -> Array a -> Array b # (<$) :: a -> Array b -> Array a #
Monad Array |
Instance details Defined in Data.Primitive.Array Methods (>>=) :: Array a -> (a -> Array b) -> Array b # (>>) :: Array a -> Array b -> Array b # return :: a -> Array a #
MonadPlus Array |
Instance details Defined in Data.Primitive.Array Methods mzero :: Array a # mplus :: Array a -> Array a -> Array a #
MonadFail Array |
Instance details Defined in Data.Primitive.Array Methods fail :: String -> Array a #
MonadFix Array |
Instance details Defined in Data.Primitive.Array Methods mfix :: (a -> Array a) -> Array a #
Foldable Array |
Instance details Defined in Data.Primitive.Array Methods fold :: Monoid m => Array m -> m # foldMap :: Monoid m => (a -> m) -> Array a -> m # foldMap' :: Monoid m => (a -> m) -> Array a -> m # foldr :: (a -> b -> b) -> b -> Array a -> b # foldr' :: (a -> b -> b) -> b -> Array a -> b # foldl :: (b -> a -> b) -> b -> Array a -> b # foldl' :: (b -> a -> b) -> b -> Array a -> b # foldr1 :: (a -> a -> a) -> Array a -> a # foldl1 :: (a -> a -> a) -> Array a -> a # toList :: Array a -> [a] # null :: Array a -> Bool # length :: Array a -> Int # elem :: Eq a => a -> Array a -> Bool # maximum :: Ord a => Array a -> a # minimum :: Ord a => Array a -> a # sum :: Num a => Array a -> a # product :: Num a => Array a -> a #
Traversable Array |
Instance details Defined in Data.Primitive.Array Methods traverse :: Applicative f => (a -> f b) -> Array a -> f (Array b) # sequenceA :: Applicative f => Array (f a) -> f (Array a) # mapM :: Monad m => (a -> m b) -> Array a -> m (Array b) # sequence :: Monad m => Array (m a) -> m (Array a) #
Lift a => Lift (Array a :: Type) |
Instance details Defined in Data.Primitive.Array Methods lift :: Quote m => Array a -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Array a -> Code m (Array a) #
NFData a => NFData (Array a) |
Instance details Defined in Data.Primitive.Array Methods rnf :: Array a -> () #
Monoid (Array a) |
Instance details Defined in Data.Primitive.Array Methods mempty :: Array a # mappend :: Array a -> Array a -> Array a # mconcat :: [Array a] -> Array a #
Semigroup (Array a) | Since: primitive-0.6.3.0
Instance details Defined in Data.Primitive.Array Methods (<>) :: Array a -> Array a -> Array a # sconcat :: NonEmpty (Array a) -> Array a # stimes :: Integral b => b -> Array a -> Array a #
Data a => Data (Array a) |
Instance details Defined in Data.Primitive.Array Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Array a -> c (Array a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Array a) # toConstr :: Array a -> Constr # dataTypeOf :: Array a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Array a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Array a)) # gmapT :: (forall b. Data b => b -> b) -> Array a -> Array a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Array a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Array a -> r # gmapQ :: (forall d. Data d => d -> u) -> Array a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Array a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Array a -> m (Array a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Array a -> m (Array a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Array a -> m (Array a) #
IsList (Array a) |
Instance details Defined in Data.Primitive.Array Associated Types
type Item (Array a) |
Instance details Defined in Data.Primitive.Array type Item (Array a) = a
Methods fromList :: [Item (Array a)] -> Array a # fromListN :: Int -> [Item (Array a)] -> Array a # toList :: Array a -> [Item (Array a)] #
Read a => Read (Array a) |
Instance details Defined in Data.Primitive.Array Methods readsPrec :: Int -> ReadS (Array a) # readList :: ReadS [Array a] # readPrec :: ReadPrec (Array a) # readListPrec :: ReadPrec [Array a] #
Show a => Show (Array a) |
Instance details Defined in Data.Primitive.Array Methods showsPrec :: Int -> Array a -> ShowS # show :: Array a -> String # showList :: [Array a] -> ShowS #
Eq a => Eq (Array a) |
Instance details Defined in Data.Primitive.Array Methods (==) :: Array a -> Array a -> Bool # (/=) :: Array a -> Array a -> Bool #
Ord a => Ord (Array a) | Lexicographic ordering. Subject to change between major versions.
Instance details Defined in Data.Primitive.Array Methods compare :: Array a -> Array a -> Ordering # (<) :: Array a -> Array a -> Bool # (<=) :: Array a -> Array a -> Bool # (>) :: Array a -> Array a -> Bool # (>=) :: Array a -> Array a -> Bool # max :: Array a -> Array a -> Array a # min :: Array a -> Array a -> Array a #
PrimUnlifted (Array a) |
Instance details Defined in Data.Primitive.Unlifted.Class Associated Types
type Unlifted (Array a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (Array a) = Array# a
Methods toUnlifted# :: Array a -> Unlifted (Array a) # fromUnlifted# :: Unlifted (Array a) -> Array a #
type Element Array # |
Instance details Defined in Data.Primitive.Contiguous.Class type Element Array = Always
type Mutable Array # |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable Array = MutableArray
type MutableSliced Array # |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced Array = MutableSlice Array
type Sliced Array # |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced Array = Slice Array
type Unlifted Array # |
Instance details Defined in Data.Primitive.Contiguous.Class type Unlifted Array = Array# :: Type -> UnliftedType
type UnliftedMut Array # |
Instance details Defined in Data.Primitive.Contiguous.Class type UnliftedMut Array = MutableArray# :: Type -> Type -> UnliftedType
type Item (Array a) |
Instance details Defined in Data.Primitive.Array type Item (Array a) = a
type Unlifted (Array a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (Array a) = Array# a

data MutableArray s a #

Mutable boxed arrays associated with a primitive state token.

#### Instances

Instances details

(Typeable s, Typeable a) => Data (MutableArray s a) |
Instance details Defined in Data.Primitive.Array Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MutableArray s a -> c (MutableArray s a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (MutableArray s a) # toConstr :: MutableArray s a -> Constr # dataTypeOf :: MutableArray s a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (MutableArray s a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (MutableArray s a)) # gmapT :: (forall b. Data b => b -> b) -> MutableArray s a -> MutableArray s a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MutableArray s a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MutableArray s a -> r # gmapQ :: (forall d. Data d => d -> u) -> MutableArray s a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> MutableArray s a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> MutableArray s a -> m (MutableArray s a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MutableArray s a -> m (MutableArray s a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MutableArray s a -> m (MutableArray s a) #
Eq (MutableArray s a) |
Instance details Defined in Data.Primitive.Array Methods (==) :: MutableArray s a -> MutableArray s a -> Bool # (/=) :: MutableArray s a -> MutableArray s a -> Bool #
PrimUnlifted (MutableArray s a) |
Instance details Defined in Data.Primitive.Unlifted.Class Associated Types
type Unlifted (MutableArray s a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (MutableArray s a) = MutableArray# s a
Methods toUnlifted# :: MutableArray s a -> Unlifted (MutableArray s a) # fromUnlifted# :: Unlifted (MutableArray s a) -> MutableArray s a #
type Unlifted (MutableArray s a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (MutableArray s a) = MutableArray# s a

data SmallArray a #

#### Instances

Instances details

MonadZip SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods mzip :: SmallArray a -> SmallArray b -> SmallArray (a, b) # mzipWith :: (a -> b -> c) -> SmallArray a -> SmallArray b -> SmallArray c # munzip :: SmallArray (a, b) -> (SmallArray a, SmallArray b) #
Eq1 SmallArray | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.SmallArray Methods liftEq :: (a -> b -> Bool) -> SmallArray a -> SmallArray b -> Bool #
Ord1 SmallArray | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.SmallArray Methods liftCompare :: (a -> b -> Ordering) -> SmallArray a -> SmallArray b -> Ordering #
Read1 SmallArray | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.SmallArray Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (SmallArray a) # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [SmallArray a] # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (SmallArray a) # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [SmallArray a] #
Show1 SmallArray | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.SmallArray Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> SmallArray a -> ShowS # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [SmallArray a] -> ShowS #
Contiguous SmallArray # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Mutable SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable SmallArray = SmallMutableArray
type Element SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Element SmallArray = Always
type Sliced SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced SmallArray = Slice SmallArray
type MutableSliced SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced SmallArray = MutableSlice SmallArray
Methods new :: (PrimMonad m, Element SmallArray b) => Int -> m (Mutable SmallArray (PrimState m) b) # replicateMut :: (PrimMonad m, Element SmallArray b) => Int -> b -> m (Mutable SmallArray (PrimState m) b) # shrink :: (PrimMonad m, Element SmallArray a) => Mutable SmallArray (PrimState m) a -> Int -> m (Mutable SmallArray (PrimState m) a) # empty :: SmallArray a # singleton :: Element SmallArray a => a -> SmallArray a # doubleton :: Element SmallArray a => a -> a -> SmallArray a # tripleton :: Element SmallArray a => a -> a -> a -> SmallArray a # quadrupleton :: Element SmallArray a => a -> a -> a -> a -> SmallArray a # quintupleton :: Element SmallArray a => a -> a -> a -> a -> a -> SmallArray a # sextupleton :: Element SmallArray a => a -> a -> a -> a -> a -> a -> SmallArray a # index :: Element SmallArray b => SmallArray b -> Int -> b # index# :: Element SmallArray b => SmallArray b -> Int -> (# b #) # indexM :: (Element SmallArray b, Monad m) => SmallArray b -> Int -> m b # read :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> m b # write :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> b -> m () # null :: SmallArray b -> Bool # size :: Element SmallArray b => SmallArray b -> Int # sizeMut :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> m Int # equals :: (Element SmallArray b, Eq b) => SmallArray b -> SmallArray b -> Bool # equalsMut :: Mutable SmallArray s a -> Mutable SmallArray s a -> Bool # slice :: Element SmallArray a => SmallArray a -> Int -> Int -> Sliced SmallArray a # sliceMut :: Element SmallArray a => Mutable SmallArray s a -> Int -> Int -> MutableSliced SmallArray s a # toSlice :: Element SmallArray a => SmallArray a -> Sliced SmallArray a # toSliceMut :: (PrimMonad m, Element SmallArray a) => Mutable SmallArray (PrimState m) a -> m (MutableSliced SmallArray (PrimState m) a) # clone :: Element SmallArray b => Sliced SmallArray b -> SmallArray b # clone_ :: Element SmallArray a => SmallArray a -> Int -> Int -> SmallArray a # cloneMut :: (PrimMonad m, Element SmallArray b) => MutableSliced SmallArray (PrimState m) b -> m (Mutable SmallArray (PrimState m) b) # cloneMut_ :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> Int -> m (Mutable SmallArray (PrimState m) b) # freeze :: (PrimMonad m, Element SmallArray a) => MutableSliced SmallArray (PrimState m) a -> m (SmallArray a) # freeze_ :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> Int -> m (SmallArray b) # unsafeFreeze :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> m (SmallArray b) # unsafeShrinkAndFreeze :: (PrimMonad m, Element SmallArray a) => Mutable SmallArray (PrimState m) a -> Int -> m (SmallArray a) # thaw :: (PrimMonad m, Element SmallArray b) => Sliced SmallArray b -> m (Mutable SmallArray (PrimState m) b) # thaw_ :: (PrimMonad m, Element SmallArray b) => SmallArray b -> Int -> Int -> m (Mutable SmallArray (PrimState m) b) # copy :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> Sliced SmallArray b -> m () # copy_ :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> SmallArray b -> Int -> Int -> m () # copyMut :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> MutableSliced SmallArray (PrimState m) b -> m () # copyMut_ :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> Mutable SmallArray (PrimState m) b -> Int -> Int -> m () # insertAt :: Element SmallArray b => SmallArray b -> Int -> b -> SmallArray b # rnf :: (NFData a, Element SmallArray a) => SmallArray a -> () # run :: (forall s. ST s (SmallArray a)) -> SmallArray a #
ContiguousU SmallArray # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Unlifted SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Unlifted SmallArray = SmallArray# :: Type -> UnliftedType
type UnliftedMut SmallArray |
Instance details Defined in Data.Primitive.Contiguous.Class type UnliftedMut SmallArray = SmallMutableArray# :: Type -> Type -> UnliftedType
Methods resize :: (PrimMonad m, Element SmallArray b) => Mutable SmallArray (PrimState m) b -> Int -> m (Mutable SmallArray (PrimState m) b) # unlift :: SmallArray b -> Unlifted SmallArray b # unliftMut :: Mutable SmallArray s b -> UnliftedMut SmallArray s b # lift :: Unlifted SmallArray b -> SmallArray b # liftMut :: UnliftedMut SmallArray s b -> Mutable SmallArray s b #
NFData1 SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods liftRnf :: (a -> ()) -> SmallArray a -> () #
Alternative SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods empty :: SmallArray a # (<|>) :: SmallArray a -> SmallArray a -> SmallArray a # some :: SmallArray a -> SmallArray [a] # many :: SmallArray a -> SmallArray [a] #
Applicative SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods pure :: a -> SmallArray a # (<*>) :: SmallArray (a -> b) -> SmallArray a -> SmallArray b # liftA2 :: (a -> b -> c) -> SmallArray a -> SmallArray b -> SmallArray c # (*>) :: SmallArray a -> SmallArray b -> SmallArray b # (<*) :: SmallArray a -> SmallArray b -> SmallArray a #
Functor SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods fmap :: (a -> b) -> SmallArray a -> SmallArray b # (<$) :: a -> SmallArray b -> SmallArray a #
Monad SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods (>>=) :: SmallArray a -> (a -> SmallArray b) -> SmallArray b # (>>) :: SmallArray a -> SmallArray b -> SmallArray b # return :: a -> SmallArray a #
MonadPlus SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods mzero :: SmallArray a # mplus :: SmallArray a -> SmallArray a -> SmallArray a #
MonadFail SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods fail :: String -> SmallArray a #
MonadFix SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods mfix :: (a -> SmallArray a) -> SmallArray a #
Foldable SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods fold :: Monoid m => SmallArray m -> m # foldMap :: Monoid m => (a -> m) -> SmallArray a -> m # foldMap' :: Monoid m => (a -> m) -> SmallArray a -> m # foldr :: (a -> b -> b) -> b -> SmallArray a -> b # foldr' :: (a -> b -> b) -> b -> SmallArray a -> b # foldl :: (b -> a -> b) -> b -> SmallArray a -> b # foldl' :: (b -> a -> b) -> b -> SmallArray a -> b # foldr1 :: (a -> a -> a) -> SmallArray a -> a # foldl1 :: (a -> a -> a) -> SmallArray a -> a # toList :: SmallArray a -> [a] # null :: SmallArray a -> Bool # length :: SmallArray a -> Int # elem :: Eq a => a -> SmallArray a -> Bool # maximum :: Ord a => SmallArray a -> a # minimum :: Ord a => SmallArray a -> a # sum :: Num a => SmallArray a -> a # product :: Num a => SmallArray a -> a #
Traversable SmallArray |
Instance details Defined in Data.Primitive.SmallArray Methods traverse :: Applicative f => (a -> f b) -> SmallArray a -> f (SmallArray b) # sequenceA :: Applicative f => SmallArray (f a) -> f (SmallArray a) # mapM :: Monad m => (a -> m b) -> SmallArray a -> m (SmallArray b) # sequence :: Monad m => SmallArray (m a) -> m (SmallArray a) #
Lift a => Lift (SmallArray a :: Type) |
Instance details Defined in Data.Primitive.SmallArray Methods lift :: Quote m => SmallArray a -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => SmallArray a -> Code m (SmallArray a) #
NFData a => NFData (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray Methods rnf :: SmallArray a -> () #
Monoid (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray Methods mempty :: SmallArray a # mappend :: SmallArray a -> SmallArray a -> SmallArray a # mconcat :: [SmallArray a] -> SmallArray a #
Semigroup (SmallArray a) | Since: primitive-0.6.3.0
Instance details Defined in Data.Primitive.SmallArray Methods (<>) :: SmallArray a -> SmallArray a -> SmallArray a # sconcat :: NonEmpty (SmallArray a) -> SmallArray a # stimes :: Integral b => b -> SmallArray a -> SmallArray a #
Data a => Data (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SmallArray a -> c (SmallArray a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (SmallArray a) # toConstr :: SmallArray a -> Constr # dataTypeOf :: SmallArray a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (SmallArray a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (SmallArray a)) # gmapT :: (forall b. Data b => b -> b) -> SmallArray a -> SmallArray a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SmallArray a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SmallArray a -> r # gmapQ :: (forall d. Data d => d -> u) -> SmallArray a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SmallArray a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SmallArray a -> m (SmallArray a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SmallArray a -> m (SmallArray a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SmallArray a -> m (SmallArray a) #
IsList (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray Associated Types
type Item (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray type Item (SmallArray a) = a
Methods fromList :: [Item (SmallArray a)] -> SmallArray a # fromListN :: Int -> [Item (SmallArray a)] -> SmallArray a # toList :: SmallArray a -> [Item (SmallArray a)] #
Read a => Read (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray Methods readsPrec :: Int -> ReadS (SmallArray a) # readList :: ReadS [SmallArray a] # readPrec :: ReadPrec (SmallArray a) # readListPrec :: ReadPrec [SmallArray a] #
Show a => Show (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray Methods showsPrec :: Int -> SmallArray a -> ShowS # show :: SmallArray a -> String # showList :: [SmallArray a] -> ShowS #
Eq a => Eq (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray Methods (==) :: SmallArray a -> SmallArray a -> Bool # (/=) :: SmallArray a -> SmallArray a -> Bool #
Ord a => Ord (SmallArray a) | Lexicographic ordering. Subject to change between major versions.
Instance details Defined in Data.Primitive.SmallArray Methods compare :: SmallArray a -> SmallArray a -> Ordering # (<) :: SmallArray a -> SmallArray a -> Bool # (<=) :: SmallArray a -> SmallArray a -> Bool # (>) :: SmallArray a -> SmallArray a -> Bool # (>=) :: SmallArray a -> SmallArray a -> Bool # max :: SmallArray a -> SmallArray a -> SmallArray a # min :: SmallArray a -> SmallArray a -> SmallArray a #
PrimUnlifted (SmallArray a) |
Instance details Defined in Data.Primitive.Unlifted.Class Associated Types
type Unlifted (SmallArray a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (SmallArray a) = SmallArray# a
Methods toUnlifted# :: SmallArray a -> Unlifted (SmallArray a) # fromUnlifted# :: Unlifted (SmallArray a) -> SmallArray a #
type Element SmallArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type Element SmallArray = Always
type Mutable SmallArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable SmallArray = SmallMutableArray
type MutableSliced SmallArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced SmallArray = MutableSlice SmallArray
type Sliced SmallArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced SmallArray = Slice SmallArray
type Unlifted SmallArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type Unlifted SmallArray = SmallArray# :: Type -> UnliftedType
type UnliftedMut SmallArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type UnliftedMut SmallArray = SmallMutableArray# :: Type -> Type -> UnliftedType
type Item (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray type Item (SmallArray a) = a
type Unlifted (SmallArray a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (SmallArray a) = SmallArray# a

data SmallMutableArray s a #

#### Instances

Instances details

(Typeable s, Typeable a) => Data (SmallMutableArray s a) |
Instance details Defined in Data.Primitive.SmallArray Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SmallMutableArray s a -> c (SmallMutableArray s a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (SmallMutableArray s a) # toConstr :: SmallMutableArray s a -> Constr # dataTypeOf :: SmallMutableArray s a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (SmallMutableArray s a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (SmallMutableArray s a)) # gmapT :: (forall b. Data b => b -> b) -> SmallMutableArray s a -> SmallMutableArray s a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SmallMutableArray s a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SmallMutableArray s a -> r # gmapQ :: (forall d. Data d => d -> u) -> SmallMutableArray s a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SmallMutableArray s a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SmallMutableArray s a -> m (SmallMutableArray s a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SmallMutableArray s a -> m (SmallMutableArray s a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SmallMutableArray s a -> m (SmallMutableArray s a) #
Eq (SmallMutableArray s a) |
Instance details Defined in Data.Primitive.SmallArray Methods (==) :: SmallMutableArray s a -> SmallMutableArray s a -> Bool # (/=) :: SmallMutableArray s a -> SmallMutableArray s a -> Bool #
PrimUnlifted (SmallMutableArray s a) |
Instance details Defined in Data.Primitive.Unlifted.Class Associated Types
type Unlifted (SmallMutableArray s a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (SmallMutableArray s a) = SmallMutableArray# s a
Methods toUnlifted# :: SmallMutableArray s a -> Unlifted (SmallMutableArray s a) # fromUnlifted# :: Unlifted (SmallMutableArray s a) -> SmallMutableArray s a #
type Unlifted (SmallMutableArray s a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (SmallMutableArray s a) = SmallMutableArray# s a

data PrimArray a #

Arrays of unboxed elements. This accepts types like `Double`, `Char`, `Int` and `Word`, as well as their fixed-length variants (`Word8`, `Word16`, etc.). Since the elements are unboxed, a `PrimArray` is strict in its elements. This differs from the behavior of `Array`, which is lazy in its elements.

#### Instances

Instances details

Contiguous PrimArray # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Mutable PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable PrimArray = MutablePrimArray
type Element PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Element PrimArray = Prim
type Sliced PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced PrimArray = Slice PrimArray
type MutableSliced PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced PrimArray = MutableSlice PrimArray
Methods new :: (PrimMonad m, Element PrimArray b) => Int -> m (Mutable PrimArray (PrimState m) b) # replicateMut :: (PrimMonad m, Element PrimArray b) => Int -> b -> m (Mutable PrimArray (PrimState m) b) # shrink :: (PrimMonad m, Element PrimArray a) => Mutable PrimArray (PrimState m) a -> Int -> m (Mutable PrimArray (PrimState m) a) # empty :: PrimArray a # singleton :: Element PrimArray a => a -> PrimArray a # doubleton :: Element PrimArray a => a -> a -> PrimArray a # tripleton :: Element PrimArray a => a -> a -> a -> PrimArray a # quadrupleton :: Element PrimArray a => a -> a -> a -> a -> PrimArray a # quintupleton :: Element PrimArray a => a -> a -> a -> a -> a -> PrimArray a # sextupleton :: Element PrimArray a => a -> a -> a -> a -> a -> a -> PrimArray a # index :: Element PrimArray b => PrimArray b -> Int -> b # index# :: Element PrimArray b => PrimArray b -> Int -> (# b #) # indexM :: (Element PrimArray b, Monad m) => PrimArray b -> Int -> m b # read :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> m b # write :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> b -> m () # null :: PrimArray b -> Bool # size :: Element PrimArray b => PrimArray b -> Int # sizeMut :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> m Int # equals :: (Element PrimArray b, Eq b) => PrimArray b -> PrimArray b -> Bool # equalsMut :: Mutable PrimArray s a -> Mutable PrimArray s a -> Bool # slice :: Element PrimArray a => PrimArray a -> Int -> Int -> Sliced PrimArray a # sliceMut :: Element PrimArray a => Mutable PrimArray s a -> Int -> Int -> MutableSliced PrimArray s a # toSlice :: Element PrimArray a => PrimArray a -> Sliced PrimArray a # toSliceMut :: (PrimMonad m, Element PrimArray a) => Mutable PrimArray (PrimState m) a -> m (MutableSliced PrimArray (PrimState m) a) # clone :: Element PrimArray b => Sliced PrimArray b -> PrimArray b # clone_ :: Element PrimArray a => PrimArray a -> Int -> Int -> PrimArray a # cloneMut :: (PrimMonad m, Element PrimArray b) => MutableSliced PrimArray (PrimState m) b -> m (Mutable PrimArray (PrimState m) b) # cloneMut_ :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> Int -> m (Mutable PrimArray (PrimState m) b) # freeze :: (PrimMonad m, Element PrimArray a) => MutableSliced PrimArray (PrimState m) a -> m (PrimArray a) # freeze_ :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> Int -> m (PrimArray b) # unsafeFreeze :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> m (PrimArray b) # unsafeShrinkAndFreeze :: (PrimMonad m, Element PrimArray a) => Mutable PrimArray (PrimState m) a -> Int -> m (PrimArray a) # thaw :: (PrimMonad m, Element PrimArray b) => Sliced PrimArray b -> m (Mutable PrimArray (PrimState m) b) # thaw_ :: (PrimMonad m, Element PrimArray b) => PrimArray b -> Int -> Int -> m (Mutable PrimArray (PrimState m) b) # copy :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> Sliced PrimArray b -> m () # copy_ :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> PrimArray b -> Int -> Int -> m () # copyMut :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> MutableSliced PrimArray (PrimState m) b -> m () # copyMut_ :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> Mutable PrimArray (PrimState m) b -> Int -> Int -> m () # insertAt :: Element PrimArray b => PrimArray b -> Int -> b -> PrimArray b # rnf :: (NFData a, Element PrimArray a) => PrimArray a -> () # run :: (forall s. ST s (PrimArray a)) -> PrimArray a #
ContiguousU PrimArray # |
Instance details Defined in Data.Primitive.Contiguous.Class Associated Types
type Unlifted PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type Unlifted PrimArray
type UnliftedMut PrimArray |
Instance details Defined in Data.Primitive.Contiguous.Class type UnliftedMut PrimArray
Methods resize :: (PrimMonad m, Element PrimArray b) => Mutable PrimArray (PrimState m) b -> Int -> m (Mutable PrimArray (PrimState m) b) # unlift :: PrimArray b -> Unlifted PrimArray b # unliftMut :: Mutable PrimArray s b -> UnliftedMut PrimArray s b # lift :: Unlifted PrimArray b -> PrimArray b # liftMut :: UnliftedMut PrimArray s b -> Mutable PrimArray s b #
Lift (PrimArray a :: Type) |
Instance details Defined in Data.Primitive.PrimArray Methods lift :: Quote m => PrimArray a -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => PrimArray a -> Code m (PrimArray a) #
NFData (PrimArray a) |
Instance details Defined in Data.Primitive.PrimArray Methods rnf :: PrimArray a -> () #
Monoid (PrimArray a) | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.PrimArray Methods mempty :: PrimArray a # mappend :: PrimArray a -> PrimArray a -> PrimArray a # mconcat :: [PrimArray a] -> PrimArray a #
Semigroup (PrimArray a) | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.PrimArray Methods (<>) :: PrimArray a -> PrimArray a -> PrimArray a # sconcat :: NonEmpty (PrimArray a) -> PrimArray a # stimes :: Integral b => b -> PrimArray a -> PrimArray a #
Prim a => IsList (PrimArray a) | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.PrimArray Associated Types
type Item (PrimArray a) |
Instance details Defined in Data.Primitive.PrimArray type Item (PrimArray a) = a
Methods fromList :: [Item (PrimArray a)] -> PrimArray a # fromListN :: Int -> [Item (PrimArray a)] -> PrimArray a # toList :: PrimArray a -> [Item (PrimArray a)] #
(Show a, Prim a) => Show (PrimArray a) | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.PrimArray Methods showsPrec :: Int -> PrimArray a -> ShowS # show :: PrimArray a -> String # showList :: [PrimArray a] -> ShowS #
(Eq a, Prim a) => Eq (PrimArray a) | Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.PrimArray Methods (==) :: PrimArray a -> PrimArray a -> Bool # (/=) :: PrimArray a -> PrimArray a -> Bool #
(Ord a, Prim a) => Ord (PrimArray a) | Lexicographic ordering. Subject to change between major versions. Since: primitive-0.6.4.0
Instance details Defined in Data.Primitive.PrimArray Methods compare :: PrimArray a -> PrimArray a -> Ordering # (<) :: PrimArray a -> PrimArray a -> Bool # (<=) :: PrimArray a -> PrimArray a -> Bool # (>) :: PrimArray a -> PrimArray a -> Bool # (>=) :: PrimArray a -> PrimArray a -> Bool # max :: PrimArray a -> PrimArray a -> PrimArray a # min :: PrimArray a -> PrimArray a -> PrimArray a #
PrimUnlifted (PrimArray a) |
Instance details Defined in Data.Primitive.Unlifted.Class Associated Types
type Unlifted (PrimArray a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (PrimArray a) = ByteArray#
Methods toUnlifted# :: PrimArray a -> Unlifted (PrimArray a) # fromUnlifted# :: Unlifted (PrimArray a) -> PrimArray a #
type Element PrimArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type Element PrimArray = Prim
type Mutable PrimArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type Mutable PrimArray = MutablePrimArray
type MutableSliced PrimArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type MutableSliced PrimArray = MutableSlice PrimArray
type Sliced PrimArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type Sliced PrimArray = Slice PrimArray
type Unlifted PrimArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type Unlifted PrimArray
type UnliftedMut PrimArray # |
Instance details Defined in Data.Primitive.Contiguous.Class type UnliftedMut PrimArray
type Item (PrimArray a) |
Instance details Defined in Data.Primitive.PrimArray type Item (PrimArray a) = a
type Unlifted (PrimArray a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (PrimArray a) = ByteArray#

data MutablePrimArray s a #

Mutable primitive arrays associated with a primitive state token. These can be written to and read from in a monadic context that supports sequencing, such as `IO` or `ST`. Typically, a mutable primitive array will be built and then converted to an immutable primitive array using `unsafeFreezePrimArray`. However, it is also acceptable to simply discard a mutable primitive array since it lives in managed memory and will be garbage collected when no longer referenced.

#### Instances

Instances details

NFData (MutablePrimArray s a) |
Instance details Defined in Data.Primitive.PrimArray Methods rnf :: MutablePrimArray s a -> () #
Eq (MutablePrimArray s a) |
Instance details Defined in Data.Primitive.PrimArray Methods (==) :: MutablePrimArray s a -> MutablePrimArray s a -> Bool # (/=) :: MutablePrimArray s a -> MutablePrimArray s a -> Bool #
PrimUnlifted (MutablePrimArray s a) |
Instance details Defined in Data.Primitive.Unlifted.Class Associated Types
type Unlifted (MutablePrimArray s a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (MutablePrimArray s a) = MutableByteArray# s
Methods toUnlifted# :: MutablePrimArray s a -> Unlifted (MutablePrimArray s a) # fromUnlifted# :: Unlifted (MutablePrimArray s a) -> MutablePrimArray s a #
type Unlifted (MutablePrimArray s a) |
Instance details Defined in Data.Primitive.Unlifted.Class type Unlifted (MutablePrimArray s a) = MutableByteArray# s

type UnliftedArray a = UnliftedArray_ (Unlifted a) a #

A type synonym for an `UnliftedArray_` containing lifted values of a particular type. As a general rule, this type synonym should not be used in class instances—use `UnliftedArray_` with an equality constraint instead. It also should not be used when defining newtypes or datatypes, unless those will have restrictive type roles regardless—use `UnliftedArray_` instead.

type MutableUnliftedArray s a = MutableUnliftedArray_ (Unlifted a) s a #

A mutable version of `MutableUnliftedArray`.