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

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

Std.Data.Array

Contents

Description

Unified unboxed and boxed array operations using functional dependencies.

All operations are NOT bound checked, if you need checked operations please use Std.Data.Array.Checked. It exports exactly same APIs so that you can switch between without pain.

Some mnemonics:

Synopsis

Arr typeclass

class Arr (marr :: * -> * -> *) (arr :: * -> *) a | arr -> marr, marr -> arr where 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.

Methods

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

Make a new array with given size.

For boxed array, all elements are uninitialized which shall not be accessed. For primitive array, elements are just random garbage.

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

Make a new array and fill it with an initial value.

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

Index mutable array in a primitive monad.

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

Write mutable array in a primitive monad.

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

Fill mutable array with a given value.

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

Index immutable array, which is a pure operation. This operation often result in an indexing thunk for lifted arrays, use 'indexArr\'' or indexArrM if that's not desired.

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

Index immutable array, pattern match on the unboxed unit tuple to force indexing (without forcing the element).

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

Index immutable array in a primitive monad, this helps in situations that you want your indexing result is not a thunk referencing whole array.

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

Safely freeze mutable array by make a immutable copy of its slice.

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

Safely thaw immutable array by make a mutable copy of its slice.

unsafeFreezeArr :: (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 :: (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.

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

Copy a slice of immutable array to mutable array at given offset.

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

Copy a slice of mutable array to mutable array at given offset. The two mutable arrays shall no be the same one.

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

Copy a slice of mutable array to mutable array at given offset. The two mutable arrays may be the same one.

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

Create immutable copy.

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

Create mutable copy.

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

Resize mutable array to given size.

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

Shrink mutable array to given size. This operation only works on primitive arrays. For boxed array, this is a no-op, e.g. sizeOfMutableArr will not change.

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

Is two mutable array are reference equal.

sizeofArr :: arr a -> Int Source #

Size of immutable array.

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

Size of mutable array.

sameArr :: 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.

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

Defined in Std.Data.Array

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

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

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

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

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

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

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

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

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

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

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

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

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

class Prim a where #

Methods

sizeOf# :: a -> Int# #

alignment# :: a -> Int# #

indexByteArray# :: ByteArray# -> Int# -> a #

readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, a#) #

writeByteArray# :: MutableByteArray# s -> Int# -> a -> State# s -> State# s #

setByteArray# :: MutableByteArray# s -> Int# -> Int# -> a -> State# s -> State# s #

indexOffAddr# :: Addr# -> Int# -> a #

readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, a#) #

writeOffAddr# :: Addr# -> Int# -> a -> State# s -> State# s #

setOffAddr# :: Addr# -> Int# -> Int# -> a -> State# s -> State# s #

Instances
Prim Char 
Instance details

Defined in Data.Primitive.Types

Prim Double 
Instance details

Defined in Data.Primitive.Types

Prim Float 
Instance details

Defined in Data.Primitive.Types

Prim Int 
Instance details

Defined in Data.Primitive.Types

Prim Int8 
Instance details

Defined in Data.Primitive.Types

Prim Int16 
Instance details

Defined in Data.Primitive.Types

Prim Int32 
Instance details

Defined in Data.Primitive.Types

Prim Int64 
Instance details

Defined in Data.Primitive.Types

Prim Word 
Instance details

Defined in Data.Primitive.Types

Prim Word8 
Instance details

Defined in Data.Primitive.Types

Prim Word16 
Instance details

Defined in Data.Primitive.Types

Prim Word32 
Instance details

Defined in Data.Primitive.Types

Prim Word64 
Instance details

Defined in Data.Primitive.Types

Prim CDev 
Instance details

Defined in Data.Primitive.Types

Prim CIno 
Instance details

Defined in Data.Primitive.Types

Prim CMode 
Instance details

Defined in Data.Primitive.Types

Prim COff 
Instance details

Defined in Data.Primitive.Types

Prim CPid 
Instance details

Defined in Data.Primitive.Types

Prim CSsize 
Instance details

Defined in Data.Primitive.Types

Prim CGid 
Instance details

Defined in Data.Primitive.Types

Prim CNlink 
Instance details

Defined in Data.Primitive.Types

Prim CUid 
Instance details

Defined in Data.Primitive.Types

Prim CCc 
Instance details

Defined in Data.Primitive.Types

Prim CSpeed 
Instance details

Defined in Data.Primitive.Types

Prim CTcflag 
Instance details

Defined in Data.Primitive.Types

Prim CRLim 
Instance details

Defined in Data.Primitive.Types

Prim CBlkSize 
Instance details

Defined in Data.Primitive.Types

Prim CBlkCnt 
Instance details

Defined in Data.Primitive.Types

Prim CClockId 
Instance details

Defined in Data.Primitive.Types

Prim CFsBlkCnt 
Instance details

Defined in Data.Primitive.Types

Prim CFsFilCnt 
Instance details

Defined in Data.Primitive.Types

Prim CId 
Instance details

Defined in Data.Primitive.Types

Prim CKey 
Instance details

Defined in Data.Primitive.Types

Prim CTimer 
Instance details

Defined in Data.Primitive.Types

Prim Fd 
Instance details

Defined in Data.Primitive.Types

Prim CChar 
Instance details

Defined in Data.Primitive.Types

Prim CSChar 
Instance details

Defined in Data.Primitive.Types

Prim CUChar 
Instance details

Defined in Data.Primitive.Types

Prim CShort 
Instance details

Defined in Data.Primitive.Types

Prim CUShort 
Instance details

Defined in Data.Primitive.Types

Prim CInt 
Instance details

Defined in Data.Primitive.Types

Prim CUInt 
Instance details

Defined in Data.Primitive.Types

Prim CLong 
Instance details

Defined in Data.Primitive.Types

Prim CULong 
Instance details

Defined in Data.Primitive.Types

Prim CLLong 
Instance details

Defined in Data.Primitive.Types

Prim CULLong 
Instance details

Defined in Data.Primitive.Types

Prim CBool 
Instance details

Defined in Data.Primitive.Types

Prim CFloat 
Instance details

Defined in Data.Primitive.Types

Prim CDouble 
Instance details

Defined in Data.Primitive.Types

Prim CPtrdiff 
Instance details

Defined in Data.Primitive.Types

Prim CSize 
Instance details

Defined in Data.Primitive.Types

Prim CWchar 
Instance details

Defined in Data.Primitive.Types

Prim CSigAtomic 
Instance details

Defined in Data.Primitive.Types

Prim CClock 
Instance details

Defined in Data.Primitive.Types

Prim CTime 
Instance details

Defined in Data.Primitive.Types

Prim CUSeconds 
Instance details

Defined in Data.Primitive.Types

Prim CSUSeconds 
Instance details

Defined in Data.Primitive.Types

Prim CIntPtr 
Instance details

Defined in Data.Primitive.Types

Prim CUIntPtr 
Instance details

Defined in Data.Primitive.Types

Prim CIntMax 
Instance details

Defined in Data.Primitive.Types

Prim CUIntMax 
Instance details

Defined in Data.Primitive.Types

Prim Addr 
Instance details

Defined in Data.Primitive.Types

Methods

sizeOf# :: Addr -> Int# #

alignment# :: Addr -> Int# #

indexByteArray# :: ByteArray# -> Int# -> Addr #

readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, Addr#) #

writeByteArray# :: MutableByteArray# s -> Int# -> Addr -> State# s -> State# s #

setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Addr -> State# s -> State# s #

indexOffAddr# :: Addr# -> Int# -> Addr #

readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, Addr#) #

writeOffAddr# :: Addr# -> Int# -> Addr -> State# s -> State# s #

setOffAddr# :: Addr# -> Int# -> Int# -> Addr -> State# s -> State# s #

Prim (Ptr a) 
Instance details

Defined in Data.Primitive.Types

Prim (FunPtr a) 
Instance details

Defined in Data.Primitive.Types

Prim a => Prim (RadixDown a) Source # 
Instance details

Defined in Std.Data.Vector.Sort

newPinnedPrimArray :: forall m a. (PrimMonad m, Prim a) => 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 :: forall m a. (PrimMonad m, Prim a) => 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) => Ptr a -> PrimArray a -> Int -> Int -> m () #

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

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

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

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

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

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.

Cast between primitive arrays

castArray :: (Arr marr arr a, Cast a b) => arr a -> arr b Source #

Cast between arrays

castMutableArray :: (Arr marr arr a, Cast a b) => marr s a -> marr s b Source #