Z-Data-0.1.6.0: Array, vector and text

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

Z.Data.Array.Checked

Contents

Description

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

Synopsis

Arr typeclass re-export

class Arr (arr :: * -> *) a 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 PrimArray a Source # 
Instance details

Defined in Z.Data.Array

Associated Types

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

Methods

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

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

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

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

setArr :: (PrimMonad m, PrimState m ~ s) => MArr PrimArray 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) => MArr PrimArray s a -> Int -> Int -> m (PrimArray a) Source #

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

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

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

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

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

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

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

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

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

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

sameMutableArr :: MArr PrimArray s a -> MArr PrimArray s a -> Bool Source #

sizeofArr :: PrimArray a -> Int Source #

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

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

Arr SmallArray a Source # 
Instance details

Defined in Z.Data.Array

Associated Types

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

Methods

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

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

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

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

setArr :: (PrimMonad m, PrimState m ~ s) => MArr SmallArray 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) => MArr SmallArray s a -> Int -> Int -> m (SmallArray a) Source #

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

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

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

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

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

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

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

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

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

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

sameMutableArr :: MArr SmallArray s a -> MArr SmallArray s a -> Bool Source #

sizeofArr :: SmallArray a -> Int Source #

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

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

Arr Array a Source # 
Instance details

Defined in Z.Data.Array

Associated Types

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

Methods

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

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

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

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

setArr :: (PrimMonad m, PrimState m ~ s) => MArr Array 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) => MArr Array s a -> Int -> Int -> m (Array a) Source #

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

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

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

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

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

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

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

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

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

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

sameMutableArr :: MArr Array s a -> MArr Array s a -> Bool Source #

sizeofArr :: Array a -> Int Source #

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

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

PrimUnlifted a => Arr (UnliftedArray :: Type -> Type) a Source # 
Instance details

Defined in Z.Data.Array

Associated Types

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

Methods

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

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

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

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

setArr :: (PrimMonad m, PrimState m ~ s) => MArr UnliftedArray 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) => MArr UnliftedArray s a -> Int -> Int -> m (UnliftedArray a) Source #

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

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

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

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

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

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

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

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

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

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

sameMutableArr :: MArr UnliftedArray s a -> MArr UnliftedArray s a -> Bool Source #

sizeofArr :: UnliftedArray a -> Int Source #

sizeofMutableArr :: (PrimMonad m, PrimState m ~ s) => MArr UnliftedArray 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 arr a, PrimMonad m, PrimState m ~ s, HasCallStack) => Int -> m (MArr arr s a) Source #

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

No bound checked operations

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

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

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

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

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

Is two mutable array are reference equal.

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

Size of immutable array.

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

Size of mutable array.

sameArr :: Arr 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 #

Boxed arrays

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 #

MonadFail Array 
Instance details

Defined in Data.Primitive.Array

Methods

fail :: String -> 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

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 #

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 #

NFData1 Array 
Instance details

Defined in Data.Primitive.Array

Methods

liftRnf :: (a -> ()) -> Array a -> () #

Arr Array a Source # 
Instance details

Defined in Z.Data.Array

Associated Types

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

Methods

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

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

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

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

setArr :: (PrimMonad m, PrimState m ~ s) => MArr Array 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) => MArr Array s a -> Int -> Int -> m (Array a) Source #

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

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

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

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

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

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

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

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

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

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

sameMutableArr :: MArr Array s a -> MArr Array s a -> Bool Source #

sizeofArr :: Array a -> Int Source #

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

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

Vec Array a Source # 
Instance details

Defined in Z.Data.Vector.Base

Associated Types

type IArray Array :: Type -> Type Source #

Methods

toArr :: Array a -> (IArray Array a, Int, Int) Source #

fromArr :: IArray Array a -> Int -> Int -> Array a 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)

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 #

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)

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 #

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 #

NFData a => NFData (Array a) 
Instance details

Defined in Data.Primitive.Array

Methods

rnf :: Array a -> () #

ShowT a => ShowT (Array a) Source # 
Instance details

Defined in Z.Data.Text.ShowT

Methods

toTextBuilder :: Int -> Array a -> TextBuilder () Source #

type MArr Array Source # 
Instance details

Defined in Z.Data.Array

type IArray Array Source # 
Instance details

Defined in Z.Data.Vector.Base

type Item (Array a) 
Instance details

Defined in Data.Primitive.Array

type Item (Array a) = a

data MutableArray s a #

Mutable boxed arrays associated with a primitive state token.

Constructors

MutableArray 

Fields

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

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 #

MonadFail SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

Methods

fail :: String -> 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

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

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 #

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

NFData1 SmallArray 
Instance details

Defined in Data.Primitive.SmallArray

Methods

liftRnf :: (a -> ()) -> SmallArray a -> () #

Arr SmallArray a Source # 
Instance details

Defined in Z.Data.Array

Associated Types

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

Methods

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

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

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

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

setArr :: (PrimMonad m, PrimState m ~ s) => MArr SmallArray 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) => MArr SmallArray s a -> Int -> Int -> m (SmallArray a) Source #

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

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

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

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

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

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

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

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

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

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

sameMutableArr :: MArr SmallArray s a -> MArr SmallArray s a -> Bool Source #

sizeofArr :: SmallArray a -> Int Source #

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

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

Vec SmallArray a Source # 
Instance details

Defined in Z.Data.Vector.Base

Associated Types

type IArray SmallArray :: Type -> Type 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)

Lexicographic ordering. Subject to change between major versions.

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)

Since: primitive-0.6.3.0

Instance details

Defined in Data.Primitive.SmallArray

Monoid (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

NFData a => NFData (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

Methods

rnf :: SmallArray a -> () #

ShowT a => ShowT (SmallArray a) Source # 
Instance details

Defined in Z.Data.Text.ShowT

type MArr SmallArray Source # 
Instance details

Defined in Z.Data.Array

type IArray SmallArray Source # 
Instance details

Defined in Z.Data.Vector.Base

type Item (SmallArray a) 
Instance details

Defined in Data.Primitive.SmallArray

type Item (SmallArray a) = a

data SmallMutableArray s a #

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

uninitialized :: a Source #

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

Primitive array type

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.

Constructors

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

Defined in Z.Data.Array

Associated Types

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

Methods

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

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

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

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

setArr :: (PrimMonad m, PrimState m ~ s) => MArr PrimArray 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) => MArr PrimArray s a -> Int -> Int -> m (PrimArray a) Source #

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

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

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

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

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

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

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

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

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

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

sameMutableArr :: MArr PrimArray s a -> MArr PrimArray s a -> Bool Source #

sizeofArr :: PrimArray a -> Int Source #

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

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

Prim a => Vec PrimArray a Source # 
Instance details

Defined in Z.Data.Vector.Base

Associated Types

type IArray PrimArray :: Type -> Type Source #

Prim a => IsList (PrimArray a)

Since: primitive-0.6.4.0

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)

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

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

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.PrimArray

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 #

Monoid (PrimArray a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.PrimArray

NFData (PrimArray a) 
Instance details

Defined in Data.Primitive.PrimArray

Methods

rnf :: PrimArray a -> () #

PrimUnlifted (PrimArray a) Source # 
Instance details

Defined in Z.Data.Array.UnliftedArray

(Prim a, ShowT a) => ShowT (PrimArray a) Source # 
Instance details

Defined in Z.Data.Text.ShowT

type MArr PrimArray Source # 
Instance details

Defined in Z.Data.Array

type IArray PrimArray Source # 
Instance details

Defined in Z.Data.Vector.Base

type Item (PrimArray a) 
Instance details

Defined in Data.Primitive.PrimArray

type Item (PrimArray a) = a

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 convert 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.

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.

No bound checked primitive array operations

primArrayContents :: PrimArray a -> Ptr a #

Yield a pointer to the array's data. This operation is only safe on pinned prim arrays allocated by newPinnedByteArray or newAlignedPinnedByteArray.

Since: primitive-0.7.1.0

mutablePrimArrayContents :: MutablePrimArray s a -> Ptr a #

Yield a pointer to the array's data. This operation is only safe on pinned byte arrays allocated by newPinnedByteArray or newAlignedPinnedByteArray.

Since: primitive-0.7.1.0

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 #

Check whether or not the byte array is pinned. Pinned primitive arrays cannot be moved by the garbage collector. It is safe to use primArrayContents on such byte arrays. This function is only available when compiling with GHC 8.2 or newer.

Since: primitive-0.7.1.0

isMutablePrimArrayPinned :: MutablePrimArray s a -> Bool #

Check whether or not the mutable primitive array is pinned. This function is only available when compiling with GHC 8.2 or newer.

Since: primitive-0.7.1.0

Unlifted array type

data UnliftedArray a Source #

Instances
PrimUnlifted a => Arr (UnliftedArray :: Type -> Type) a Source # 
Instance details

Defined in Z.Data.Array

Associated Types

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

Methods

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

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

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

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

setArr :: (PrimMonad m, PrimState m ~ s) => MArr UnliftedArray 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) => MArr UnliftedArray s a -> Int -> Int -> m (UnliftedArray a) Source #

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

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

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

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

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

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

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

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

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

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

sameMutableArr :: MArr UnliftedArray s a -> MArr UnliftedArray s a -> Bool Source #

sizeofArr :: UnliftedArray a -> Int Source #

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

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

PrimUnlifted a => Vec (UnliftedArray :: Type -> Type) a Source # 
Instance details

Defined in Z.Data.Vector.Base

Associated Types

type IArray UnliftedArray :: Type -> Type Source #

(PrimUnlifted a, ShowT a) => ShowT (UnliftedArray a) Source # 
Instance details

Defined in Z.Data.Text.ShowT

type MArr (UnliftedArray :: Type -> Type) Source # 
Instance details

Defined in Z.Data.Array

type IArray (UnliftedArray :: Type -> Type) Source # 
Instance details

Defined in Z.Data.Vector.Base

class PrimUnlifted a where Source #

Instances
PrimUnlifted ByteArray Source # 
Instance details

Defined in Z.Data.Array.UnliftedArray

PrimUnlifted (IORef a) Source # 
Instance details

Defined in Z.Data.Array.UnliftedArray

PrimUnlifted (MVar a) Source # 
Instance details

Defined in Z.Data.Array.UnliftedArray

PrimUnlifted (PrimArray a) Source # 
Instance details

Defined in Z.Data.Array.UnliftedArray

PrimUnlifted (MutableByteArray s) Source # 
Instance details

Defined in Z.Data.Array.UnliftedArray

PrimUnlifted (STRef s a) Source # 
Instance details

Defined in Z.Data.Array.UnliftedArray

PrimUnlifted (MutablePrimArray s a) Source # 
Instance details

Defined in Z.Data.Array.UnliftedArray

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.