primitive-checked-0.6.4.1: primitive functions with bounds-checking

Safe HaskellNone
LanguageHaskell2010

Data.Primitive.UnliftedArray

Synopsis

Documentation

data UnliftedArray e #

Immutable arrays that efficiently store types that are simple wrappers around unlifted primitive types. The values of the unlifted type are stored directly, eliminating a layer of indirection.

Instances
PrimUnlifted a => IsList (UnliftedArray a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

Associated Types

type Item (UnliftedArray a) :: * #

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

Defined in Data.Primitive.UnliftedArray

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

Lexicographic ordering. Subject to change between major versions.

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

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

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted a => Semigroup (UnliftedArray a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted a => Monoid (UnliftedArray a)

Since: primitive-0.6.4.0

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 #

Mutable arrays that efficiently store types that are simple wrappers around unlifted primitive types. The values of the unlifted type are stored directly, eliminating a layer of indirection.

class PrimUnlifted a where #

Classifies the types that are able to be stored in UnliftedArray and MutableUnliftedArray. These should be types that are just liftings of the unlifted pointer types, so that their internal contents can be safely coerced into an ArrayArray#.

Minimal complete definition

toArrayArray#, fromArrayArray#

Instances
PrimUnlifted ThreadId

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted ByteArray 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (StablePtr a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (TVar a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (Weak a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MVar a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (UnliftedArray e) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (PrimArray a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutableByteArray s) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (SmallArray a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (Array a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutableUnliftedArray s e) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutablePrimArray s a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (SmallMutableArray s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutVar s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

PrimUnlifted (MutableArray s a) 
Instance details

Defined in Data.Primitive.UnliftedArray

setUnliftedArray #

Arguments

:: (PrimMonad m, PrimUnlifted a) 
=> MutableUnliftedArray (PrimState m) a

destination

-> a

value to fill with

-> m () 

Sets all the positions in an unlifted array to the designated value.

sizeofUnliftedArray :: UnliftedArray e -> Int #

Yields the length of an UnliftedArray.

unsafeFreezeUnliftedArray :: PrimMonad m => MutableUnliftedArray (PrimState m) a -> m (UnliftedArray a) #

Freezes a MutableUnliftedArray, yielding an UnliftedArray. This simply marks the array as frozen in place, so it should only be used when no further modifications to the mutable array will be performed.

freezeUnliftedArray Source #

Arguments

:: (HasCallStack, PrimMonad m) 
=> MutableUnliftedArray (PrimState m) a

source

-> Int

offset

-> Int

length

-> m (UnliftedArray a) 

thawUnliftedArray Source #

Arguments

:: (HasCallStack, PrimMonad m) 
=> UnliftedArray a

source

-> Int

offset

-> Int

length

-> m (MutableUnliftedArray (PrimState m) a) 

sameMutableUnliftedArray :: MutableUnliftedArray s a -> MutableUnliftedArray s a -> Bool #

Determines whether two MutableUnliftedArray values are the same. This is object/pointer identity, not based on the contents.

copyUnliftedArray Source #

Arguments

:: (HasCallStack, PrimMonad m) 
=> MutableUnliftedArray (PrimState m) a

destination array

-> Int

offset into destination array

-> UnliftedArray a

source array

-> Int

offset into source array

-> Int

number of elements to copy

-> m () 

copyMutableUnliftedArray Source #

Arguments

:: (HasCallStack, PrimMonad m) 
=> MutableUnliftedArray (PrimState m) a

destination array

-> Int

offset into destination array

-> MutableUnliftedArray (PrimState m) a

source array

-> Int

offset into source array

-> Int

number of elements to copy

-> m () 

cloneUnliftedArray Source #

Arguments

:: HasCallStack 
=> UnliftedArray a

source array

-> Int

offset into destination array

-> Int

number of elements to copy

-> UnliftedArray a 

cloneMutableUnliftedArray Source #

Arguments

:: (HasCallStack, PrimMonad m) 
=> MutableUnliftedArray (PrimState m) a

source array

-> Int

offset into destination array

-> Int

number of elements to copy

-> m (MutableUnliftedArray (PrimState m) a) 

mapUnliftedArray :: (PrimUnlifted a, PrimUnlifted b) => (a -> b) -> UnliftedArray a -> UnliftedArray b #

Map over the elements of an UnliftedArray.

foldrUnliftedArray :: PrimUnlifted a => (a -> b -> b) -> b -> UnliftedArray a -> b #

Lazy right-associated fold over the elements of an UnliftedArray.

foldlUnliftedArray :: PrimUnlifted a => (b -> a -> b) -> b -> UnliftedArray a -> b #

Lazy left-associated fold over the elements of an UnliftedArray.

foldrUnliftedArray' :: PrimUnlifted a => (a -> b -> b) -> b -> UnliftedArray a -> b #

Strict right-associated fold over the elements of an 'UnliftedArray.

foldlUnliftedArray' :: PrimUnlifted a => (b -> a -> b) -> b -> UnliftedArray a -> b #

Strict left-associated fold over the elements of an UnliftedArray.