stdio-0.2.0.0: A simple and high performance IO toolkit for Haskell

Copyright(c) Dong Han 2017-2019
LicenseBSD
Maintainerwinterland1989@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Std.Data.Array.Checked

Contents

Description

This module provides exactly the same API with Std.Data.Array, but will throw an IndexOutOfBounds ArrayException on bound check failure, it's useful when debugging array algorithms: just swap this module with Std.Data.Array, segmentation faults caused by out bound access will be turned into exceptions with more informations.

Synopsis

Arr typeclass re-export

class Arr (marr :: * -> * -> *) (arr :: * -> *) a | arr -> marr, marr -> arr Source #

A typeclass to unify box & unboxed, mutable & immutable array operations.

Most of these functions simply wrap their primitive counterpart, if there's no primitive ones, we polyfilled using other operations to get the same semantics.

One exception is that shrinkMutableArr only perform closure resizing on PrimArray because current RTS support only that, shrinkMutableArr will do nothing on other array type.

It's reasonable to trust GHC with specializing & inlining these polymorphric functions. They are used across this package and perform identical to their monomophric counterpart.

Instances
Prim a => Arr MutablePrimArray PrimArray a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr MutablePrimArray = (ar :: Type -> Type) Source #

type MArr PrimArray = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (MutablePrimArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (MutablePrimArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> Int -> a -> m () Source #

indexArr :: PrimArray a -> Int -> a Source #

indexArr' :: PrimArray a -> Int -> (#a#) Source #

indexArrM :: Monad m => PrimArray a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> Int -> m (PrimArray a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => PrimArray a -> Int -> Int -> m (MutablePrimArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> m (PrimArray a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => PrimArray a -> m (MutablePrimArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> PrimArray a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> MutablePrimArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> MutablePrimArray s a -> Int -> Int -> m () Source #

cloneArr :: PrimArray a -> Int -> Int -> PrimArray a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> Int -> m (MutablePrimArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> m (MutablePrimArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> m () Source #

sameMutableArr :: MutablePrimArray s a -> MutablePrimArray s a -> Bool Source #

sizeofArr :: PrimArray a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> m Int Source #

sameArr :: PrimArray a -> PrimArray a -> Bool Source #

Arr MutableArray Array a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr MutableArray = (ar :: Type -> Type) Source #

type MArr Array = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (MutableArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (MutableArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Int -> a -> m () Source #

indexArr :: Array a -> Int -> a Source #

indexArr' :: Array a -> Int -> (#a#) Source #

indexArrM :: Monad m => Array a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Int -> m (Array a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => Array a -> Int -> Int -> m (MutableArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> m (Array a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => Array a -> m (MutableArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Array a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> MutableArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> MutableArray s a -> Int -> Int -> m () Source #

cloneArr :: Array a -> Int -> Int -> Array a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Int -> m (MutableArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> m (MutableArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> m () Source #

sameMutableArr :: MutableArray s a -> MutableArray s a -> Bool Source #

sizeofArr :: Array a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> m Int Source #

sameArr :: Array a -> Array a -> Bool Source #

Arr SmallMutableArray SmallArray a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr SmallMutableArray = (ar :: Type -> Type) Source #

type MArr SmallArray = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (SmallMutableArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (SmallMutableArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> Int -> a -> m () Source #

indexArr :: SmallArray a -> Int -> a Source #

indexArr' :: SmallArray a -> Int -> (#a#) Source #

indexArrM :: Monad m => SmallArray a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> Int -> m (SmallArray a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => SmallArray a -> Int -> Int -> m (SmallMutableArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> m (SmallArray a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => SmallArray a -> m (SmallMutableArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> SmallArray a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> SmallMutableArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> SmallMutableArray s a -> Int -> Int -> m () Source #

cloneArr :: SmallArray a -> Int -> Int -> SmallArray a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> Int -> m (SmallMutableArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> m (SmallMutableArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> m () Source #

sameMutableArr :: SmallMutableArray s a -> SmallMutableArray s a -> Bool Source #

sizeofArr :: SmallArray a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> m Int Source #

sameArr :: SmallArray a -> SmallArray a -> Bool Source #

PrimUnlifted a => Arr MutableUnliftedArray UnliftedArray a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr MutableUnliftedArray = (ar :: Type -> Type) Source #

type MArr UnliftedArray = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (MutableUnliftedArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (MutableUnliftedArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> Int -> a -> m () Source #

indexArr :: UnliftedArray a -> Int -> a Source #

indexArr' :: UnliftedArray a -> Int -> (#a#) Source #

indexArrM :: Monad m => UnliftedArray a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> Int -> m (UnliftedArray a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => UnliftedArray a -> Int -> Int -> m (MutableUnliftedArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> m (UnliftedArray a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => UnliftedArray a -> m (MutableUnliftedArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> UnliftedArray a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> MutableUnliftedArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> MutableUnliftedArray s a -> Int -> Int -> m () Source #

cloneArr :: UnliftedArray a -> Int -> Int -> UnliftedArray a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> Int -> m (MutableUnliftedArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> m (MutableUnliftedArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> m () Source #

sameMutableArr :: MutableUnliftedArray s a -> MutableUnliftedArray s a -> Bool Source #

sizeofArr :: UnliftedArray a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> m Int Source #

sameArr :: UnliftedArray a -> UnliftedArray a -> Bool Source #

data RealWorld :: Type #

RealWorld is deeply magical. It is primitive, but it is not unlifted (hence ptrArg). We never manipulate values of type RealWorld; it's only used in the type system, to parameterise State#.

Bound checked array operations

newArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => Int -> m (marr s a) Source #

newArrWith :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => Int -> a -> m (marr s a) Source #

readArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => marr s a -> Int -> m a Source #

writeArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => marr s a -> Int -> a -> m () Source #

setArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => marr s a -> Int -> Int -> a -> m () Source #

indexArr :: (Arr marr arr a, HasCallStack) => arr a -> Int -> a Source #

indexArr' :: (Arr marr arr a, HasCallStack) => arr a -> Int -> (#a#) Source #

indexArrM :: (Arr marr arr a, Monad m, HasCallStack) => arr a -> Int -> m a Source #

freezeArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => marr s a -> Int -> Int -> m (arr a) Source #

thawArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => arr a -> Int -> Int -> m (marr s a) Source #

copyArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => marr s a -> Int -> arr a -> Int -> Int -> m () Source #

copyMutableArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => marr s a -> Int -> marr s a -> Int -> Int -> m () Source #

moveArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => marr s a -> Int -> marr s a -> Int -> Int -> m () Source #

cloneArr :: (Arr marr arr a, HasCallStack) => arr a -> Int -> Int -> arr a Source #

cloneMutableArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => marr s a -> Int -> Int -> m (marr s a) Source #

resizeMutableArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => marr s a -> Int -> m (marr s a) Source #

shrinkMutableArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => marr s a -> Int -> m () Source #

New size should be >= 0, and <= original size.

No bound checked operations

unsafeFreezeArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s) => marr s a -> m (arr a) Source #

In place freeze a mutable array, the original mutable array can not be used anymore.

unsafeThawArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s) => arr a -> m (marr s a) Source #

In place thaw a immutable array, the original immutable array can not be used anymore.

sameMutableArr :: Arr marr arr a => marr s a -> marr s a -> Bool Source #

Is two mutable array are reference equal.

sizeofArr :: Arr marr arr a => arr a -> Int Source #

Size of immutable array.

sizeofMutableArr :: (Arr marr arr a, PrimMonad m, PrimState m ~ s) => marr s a -> m Int Source #

Size of mutable array.

sameArr :: Arr marr arr a => arr a -> arr a -> Bool Source #

Is two immutable array are referencing the same one.

Note that sameArr 's result may change depending on compiler's optimizations, for example let arr = runST ... in arr sameArr arr may return false if compiler decides to inline it.

See https://ghc.haskell.org/trac/ghc/ticket/13908 for more background.

Boxed array type

data Array a #

Constructors

Array 

Fields

Instances
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 #

fail :: String -> Array a #

Functor Array 
Instance details

Defined in Data.Primitive.Array

Methods

fmap :: (a -> b) -> Array a -> Array b #

(<$) :: a -> Array b -> Array a #

MonadFix Array 
Instance details

Defined in Data.Primitive.Array

Methods

mfix :: (a -> 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 #

Foldable Array 
Instance details

Defined in Data.Primitive.Array

Methods

fold :: Monoid m => Array m -> 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) #

Eq1 Array 
Instance details

Defined in Data.Primitive.Array

Methods

liftEq :: (a -> b -> Bool) -> Array a -> Array b -> Bool #

Ord1 Array 
Instance details

Defined in Data.Primitive.Array

Methods

liftCompare :: (a -> b -> Ordering) -> Array a -> Array b -> Ordering #

Read1 Array 
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 
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 #

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) #

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] #

MonadPlus Array 
Instance details

Defined in Data.Primitive.Array

Methods

mzero :: Array a #

mplus :: Array a -> Array a -> Array a #

Arr MutableArray Array a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr MutableArray = (ar :: Type -> Type) Source #

type MArr Array = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (MutableArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (MutableArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Int -> a -> m () Source #

indexArr :: Array a -> Int -> a Source #

indexArr' :: Array a -> Int -> (#a#) Source #

indexArrM :: Monad m => Array a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Int -> m (Array a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => Array a -> Int -> Int -> m (MutableArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> m (Array a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => Array a -> m (MutableArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Array a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> MutableArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> MutableArray s a -> Int -> Int -> m () Source #

cloneArr :: Array a -> Int -> Int -> Array a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Int -> m (MutableArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> m (MutableArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> m () Source #

sameMutableArr :: MutableArray s a -> MutableArray s a -> Bool Source #

sizeofArr :: Array a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> m Int Source #

sameArr :: Array a -> Array a -> Bool Source #

IsList (Array a) 
Instance details

Defined in Data.Primitive.Array

Associated Types

type Item (Array a) :: Type #

Methods

fromList :: [Item (Array a)] -> Array a #

fromListN :: Int -> [Item (Array a)] -> Array a #

toList :: Array a -> [Item (Array a)] #

Eq a => Eq (Array a) 
Instance details

Defined in Data.Primitive.Array

Methods

(==) :: Array a -> Array a -> Bool #

(/=) :: Array a -> Array a -> Bool #

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 :: (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) #

Ord a => Ord (Array a) 
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 #

Read a => Read (Array a) 
Instance details

Defined in Data.Primitive.Array

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 #

Semigroup (Array a) 
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 #

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 #

PrimUnlifted (Array a) 
Instance details

Defined in Data.Primitive.UnliftedArray

type MArr Array Source # 
Instance details

Defined in Std.Data.Array

type Item (Array a) 
Instance details

Defined in Data.Primitive.Array

type Item (Array a) = a

data MutableArray s a #

Constructors

MutableArray 

Fields

Instances
Arr MutableArray Array a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr MutableArray = (ar :: Type -> Type) Source #

type MArr Array = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (MutableArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (MutableArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Int -> a -> m () Source #

indexArr :: Array a -> Int -> a Source #

indexArr' :: Array a -> Int -> (#a#) Source #

indexArrM :: Monad m => Array a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Int -> m (Array a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => Array a -> Int -> Int -> m (MutableArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> m (Array a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => Array a -> m (MutableArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Array a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> MutableArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> MutableArray s a -> Int -> Int -> m () Source #

cloneArr :: Array a -> Int -> Int -> Array a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> Int -> m (MutableArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> m (MutableArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> Int -> m () Source #

sameMutableArr :: MutableArray s a -> MutableArray s a -> Bool Source #

sizeofArr :: Array a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableArray s a -> m Int Source #

sameArr :: Array a -> Array a -> Bool Source #

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 #

(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 :: (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) #

PrimUnlifted (MutableArray s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

type IArr MutableArray Source # 
Instance details

Defined in Std.Data.Array

data SmallArray a #

Constructors

SmallArray (SmallArray# a) 
Instances
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 #

fail :: String -> SmallArray a #

Functor SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

Methods

fmap :: (a -> b) -> SmallArray a -> SmallArray b #

(<$) :: a -> SmallArray b -> SmallArray a #

MonadFix SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

Methods

mfix :: (a -> 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 #

Foldable SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

Methods

fold :: Monoid m => SmallArray m -> 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) #

Eq1 SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

Methods

liftEq :: (a -> b -> Bool) -> SmallArray a -> SmallArray b -> Bool #

Ord1 SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

Methods

liftCompare :: (a -> b -> Ordering) -> SmallArray a -> SmallArray b -> Ordering #

Read1 SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

Show1 SmallArray 
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 #

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) #

Alternative SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

MonadPlus SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

Arr SmallMutableArray SmallArray a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr SmallMutableArray = (ar :: Type -> Type) Source #

type MArr SmallArray = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (SmallMutableArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (SmallMutableArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> Int -> a -> m () Source #

indexArr :: SmallArray a -> Int -> a Source #

indexArr' :: SmallArray a -> Int -> (#a#) Source #

indexArrM :: Monad m => SmallArray a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> Int -> m (SmallArray a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => SmallArray a -> Int -> Int -> m (SmallMutableArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> m (SmallArray a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => SmallArray a -> m (SmallMutableArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> SmallArray a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> SmallMutableArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> SmallMutableArray s a -> Int -> Int -> m () Source #

cloneArr :: SmallArray a -> Int -> Int -> SmallArray a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> Int -> m (SmallMutableArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> m (SmallMutableArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> m () Source #

sameMutableArr :: SmallMutableArray s a -> SmallMutableArray s a -> Bool Source #

sizeofArr :: SmallArray a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> m Int Source #

sameArr :: SmallArray a -> SmallArray a -> Bool Source #

IsList (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

Associated Types

type Item (SmallArray a) :: Type #

Eq a => Eq (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

Methods

(==) :: SmallArray a -> SmallArray a -> Bool #

(/=) :: SmallArray a -> SmallArray a -> Bool #

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 :: (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) #

Ord a => Ord (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

Read a => Read (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

Show a => Show (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

Semigroup (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

Monoid (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

PrimUnlifted (SmallArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

type MArr SmallArray Source # 
Instance details

Defined in Std.Data.Array

type Item (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

type Item (SmallArray a) = a

data SmallMutableArray s a #

Instances
Arr SmallMutableArray SmallArray a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr SmallMutableArray = (ar :: Type -> Type) Source #

type MArr SmallArray = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (SmallMutableArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (SmallMutableArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> Int -> a -> m () Source #

indexArr :: SmallArray a -> Int -> a Source #

indexArr' :: SmallArray a -> Int -> (#a#) Source #

indexArrM :: Monad m => SmallArray a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> Int -> m (SmallArray a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => SmallArray a -> Int -> Int -> m (SmallMutableArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> m (SmallArray a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => SmallArray a -> m (SmallMutableArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> SmallArray a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> SmallMutableArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> SmallMutableArray s a -> Int -> Int -> m () Source #

cloneArr :: SmallArray a -> Int -> Int -> SmallArray a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> Int -> m (SmallMutableArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> m (SmallMutableArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> Int -> m () Source #

sameMutableArr :: SmallMutableArray s a -> SmallMutableArray s a -> Bool Source #

sizeofArr :: SmallArray a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => SmallMutableArray s a -> m Int Source #

sameArr :: SmallArray a -> SmallArray a -> Bool Source #

Eq (SmallMutableArray s a) 
Instance details

Defined in Data.Primitive.SmallArray

(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 :: (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) #

PrimUnlifted (SmallMutableArray s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

type IArr SmallMutableArray Source # 
Instance details

Defined in Std.Data.Array

uninitialized :: a Source #

Bottom value (throw (UndefinedElement "Data.Array.uninitialized")) for initialize new boxed array(Array, SmallArray..).

NOTE: These functions may segfault when used with indices which are out of bounds.

Primitive array type

data PrimArray a #

Constructors

PrimArray ByteArray# 
Instances
Prim a => Arr MutablePrimArray PrimArray a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr MutablePrimArray = (ar :: Type -> Type) Source #

type MArr PrimArray = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (MutablePrimArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (MutablePrimArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> Int -> a -> m () Source #

indexArr :: PrimArray a -> Int -> a Source #

indexArr' :: PrimArray a -> Int -> (#a#) Source #

indexArrM :: Monad m => PrimArray a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> Int -> m (PrimArray a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => PrimArray a -> Int -> Int -> m (MutablePrimArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> m (PrimArray a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => PrimArray a -> m (MutablePrimArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> PrimArray a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> MutablePrimArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> MutablePrimArray s a -> Int -> Int -> m () Source #

cloneArr :: PrimArray a -> Int -> Int -> PrimArray a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> Int -> m (MutablePrimArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> m (MutablePrimArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> m () Source #

sameMutableArr :: MutablePrimArray s a -> MutablePrimArray s a -> Bool Source #

sizeofArr :: PrimArray a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> m Int Source #

sameArr :: PrimArray a -> PrimArray a -> Bool Source #

Prim a => IsList (PrimArray a) 
Instance details

Defined in Data.Primitive.PrimArray

Associated Types

type Item (PrimArray a) :: Type #

Methods

fromList :: [Item (PrimArray a)] -> PrimArray a #

fromListN :: Int -> [Item (PrimArray a)] -> PrimArray a #

toList :: PrimArray a -> [Item (PrimArray a)] #

(Eq a, Prim a) => Eq (PrimArray a) 
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) 
Instance details

Defined in Data.Primitive.PrimArray

(Show a, Prim a) => Show (PrimArray a) 
Instance details

Defined in Data.Primitive.PrimArray

Semigroup (PrimArray a) 
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 #

Monoid (PrimArray a) 
Instance details

Defined in Data.Primitive.PrimArray

PrimUnlifted (PrimArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

type MArr PrimArray Source # 
Instance details

Defined in Std.Data.Array

type Item (PrimArray a) 
Instance details

Defined in Data.Primitive.PrimArray

type Item (PrimArray a) = a

data MutablePrimArray s a #

Instances
Prim a => Arr MutablePrimArray PrimArray a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr MutablePrimArray = (ar :: Type -> Type) Source #

type MArr PrimArray = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (MutablePrimArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (MutablePrimArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> Int -> a -> m () Source #

indexArr :: PrimArray a -> Int -> a Source #

indexArr' :: PrimArray a -> Int -> (#a#) Source #

indexArrM :: Monad m => PrimArray a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> Int -> m (PrimArray a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => PrimArray a -> Int -> Int -> m (MutablePrimArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> m (PrimArray a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => PrimArray a -> m (MutablePrimArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> PrimArray a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> MutablePrimArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> MutablePrimArray s a -> Int -> Int -> m () Source #

cloneArr :: PrimArray a -> Int -> Int -> PrimArray a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> Int -> m (MutablePrimArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> m (MutablePrimArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> Int -> m () Source #

sameMutableArr :: MutablePrimArray s a -> MutablePrimArray s a -> Bool Source #

sizeofArr :: PrimArray a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => MutablePrimArray s a -> m Int Source #

sameArr :: PrimArray a -> PrimArray a -> Bool Source #

PrimUnlifted (MutablePrimArray s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

type IArr MutablePrimArray Source # 
Instance details

Defined in Std.Data.Array

Bound checked primitive array operations

newPinnedPrimArray :: (PrimMonad m, Prim a, HasCallStack) => Int -> m (MutablePrimArray (PrimState m) a) Source #

Create a pinned byte array of the specified size, The garbage collector is guaranteed not to move it.

newAlignedPinnedPrimArray :: (PrimMonad m, Prim a, HasCallStack) => Int -> m (MutablePrimArray (PrimState m) a) Source #

Create a pinned primitive array of the specified size and respect given primitive type's alignment. The garbage collector is guaranteed not to move it.

copyPrimArrayToPtr :: (PrimMonad m, Prim a, HasCallStack) => Ptr a -> PrimArray a -> Int -> Int -> m () Source #

copyMutablePrimArrayToPtr :: (PrimMonad m, Prim a, HasCallStack) => Ptr a -> MutablePrimArray (PrimState m) a -> Int -> Int -> m () Source #

copyPtrToMutablePrimArray :: (PrimMonad m, Prim a, HasCallStack) => MutablePrimArray (PrimState m) a -> Int -> Ptr a -> Int -> m () Source #

No bound checked primitive array operations

primArrayContents :: PrimArray a -> Ptr a Source #

Yield a pointer to the array's data.

This operation is only safe on pinned primitive arrays allocated by newPinnedPrimArray or newAlignedPinnedPrimArray, and you have to make sure the PrimArray can outlive the Ptr.

mutablePrimArrayContents :: MutablePrimArray s a -> Ptr a Source #

Yield a pointer to the array's data.

This operation is only safe on pinned primitive arrays allocated by newPinnedPrimArray or newAlignedPinnedPrimArray. and you have to make sure the PrimArray can outlive the Ptr.

withPrimArrayContents :: PrimArray a -> (Ptr a -> IO b) -> IO b Source #

Yield a pointer to the array's data and do computation with it.

This operation is only safe on pinned primitive arrays allocated by newPinnedPrimArray or newAlignedPinnedPrimArray.

Don't pass a forever loop to this function, see #14346.

withMutablePrimArrayContents :: MutablePrimArray RealWorld a -> (Ptr a -> IO b) -> IO b Source #

Yield a pointer to the array's data and do computation with it.

This operation is only safe on pinned primitive arrays allocated by newPinnedPrimArray or newAlignedPinnedPrimArray.

Don't pass a forever loop to this function, see #14346.

isPrimArrayPinned :: PrimArray a -> Bool Source #

Check if a primitive array is pinned.

isMutablePrimArrayPinned :: MutablePrimArray s a -> Bool Source #

Check if a mutable primitive array is pinned.

Unlifted array type

data UnliftedArray e #

Instances
PrimUnlifted a => Arr MutableUnliftedArray UnliftedArray a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr MutableUnliftedArray = (ar :: Type -> Type) Source #

type MArr UnliftedArray = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (MutableUnliftedArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (MutableUnliftedArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> Int -> a -> m () Source #

indexArr :: UnliftedArray a -> Int -> a Source #

indexArr' :: UnliftedArray a -> Int -> (#a#) Source #

indexArrM :: Monad m => UnliftedArray a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> Int -> m (UnliftedArray a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => UnliftedArray a -> Int -> Int -> m (MutableUnliftedArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> m (UnliftedArray a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => UnliftedArray a -> m (MutableUnliftedArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> UnliftedArray a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> MutableUnliftedArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> MutableUnliftedArray s a -> Int -> Int -> m () Source #

cloneArr :: UnliftedArray a -> Int -> Int -> UnliftedArray a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> Int -> m (MutableUnliftedArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> m (MutableUnliftedArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> m () Source #

sameMutableArr :: MutableUnliftedArray s a -> MutableUnliftedArray s a -> Bool Source #

sizeofArr :: UnliftedArray a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> m Int Source #

sameArr :: UnliftedArray a -> UnliftedArray a -> Bool Source #

PrimUnlifted a => IsList (UnliftedArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

Associated Types

type Item (UnliftedArray a) :: Type #

(Eq a, PrimUnlifted a) => Eq (UnliftedArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

(Ord a, PrimUnlifted a) => Ord (UnliftedArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

(Show a, PrimUnlifted a) => Show (UnliftedArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted a => Semigroup (UnliftedArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted a => Monoid (UnliftedArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (UnliftedArray e) 
Instance details

Defined in Data.Primitive.UnliftedArray

type MArr UnliftedArray Source # 
Instance details

Defined in Std.Data.Array

type Item (UnliftedArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

type Item (UnliftedArray a) = a

data MutableUnliftedArray s e #

Instances
PrimUnlifted a => Arr MutableUnliftedArray UnliftedArray a Source # 
Instance details

Defined in Std.Data.Array

Associated Types

type IArr MutableUnliftedArray = (ar :: Type -> Type) Source #

type MArr UnliftedArray = (mar :: Type -> Type -> Type) Source #

Methods

newArr :: (PrimMonad m, PrimState m ~ s) => Int -> m (MutableUnliftedArray s a) Source #

newArrWith :: (PrimMonad m, PrimState m ~ s) => Int -> a -> m (MutableUnliftedArray s a) Source #

readArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> m a Source #

writeArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> a -> m () Source #

setArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> Int -> a -> m () Source #

indexArr :: UnliftedArray a -> Int -> a Source #

indexArr' :: UnliftedArray a -> Int -> (#a#) Source #

indexArrM :: Monad m => UnliftedArray a -> Int -> m a Source #

freezeArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> Int -> m (UnliftedArray a) Source #

thawArr :: (PrimMonad m, PrimState m ~ s) => UnliftedArray a -> Int -> Int -> m (MutableUnliftedArray s a) Source #

unsafeFreezeArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> m (UnliftedArray a) Source #

unsafeThawArr :: (PrimMonad m, PrimState m ~ s) => UnliftedArray a -> m (MutableUnliftedArray s a) Source #

copyArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> UnliftedArray a -> Int -> Int -> m () Source #

copyMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> MutableUnliftedArray s a -> Int -> Int -> m () Source #

moveArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> MutableUnliftedArray s a -> Int -> Int -> m () Source #

cloneArr :: UnliftedArray a -> Int -> Int -> UnliftedArray a Source #

cloneMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> Int -> m (MutableUnliftedArray s a) Source #

resizeMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> m (MutableUnliftedArray s a) Source #

shrinkMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> Int -> m () Source #

sameMutableArr :: MutableUnliftedArray s a -> MutableUnliftedArray s a -> Bool Source #

sizeofArr :: UnliftedArray a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => MutableUnliftedArray s a -> m Int Source #

sameArr :: UnliftedArray a -> UnliftedArray a -> Bool Source #

Eq (MutableUnliftedArray s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutableUnliftedArray s e) 
Instance details

Defined in Data.Primitive.UnliftedArray

type IArr MutableUnliftedArray Source # 
Instance details

Defined in Std.Data.Array

class PrimUnlifted a where #

Instances
PrimUnlifted ThreadId 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted ByteArray 
Instance details

Defined in Data.Primitive.UnliftedArray

Methods

toArrayArray# :: ByteArray -> ArrayArray# #

fromArrayArray# :: ArrayArray# -> ByteArray #

PrimUnlifted (StablePtr a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (TVar a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (Weak a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MVar a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutableByteArray s) 
Instance details

Defined in Data.Primitive.UnliftedArray

Methods

toArrayArray# :: MutableByteArray s -> ArrayArray# #

fromArrayArray# :: ArrayArray# -> MutableByteArray s #

PrimUnlifted (PrimArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (Array a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (SmallArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (UnliftedArray e) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutablePrimArray s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutableArray s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (SmallMutableArray s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutableUnliftedArray s e) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutVar s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

Methods

toArrayArray# :: MutVar s a -> ArrayArray# #

fromArrayArray# :: ArrayArray# -> MutVar s a #

The ArrayException type

data ArrayException #

Exceptions generated by array operations

Constructors

IndexOutOfBounds String

An attempt was made to index an array outside its declared bounds.

UndefinedElement String

An attempt was made to evaluate an element of an array that had not been initialized.