primitive-checked-0.6.3.0: 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.

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#

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

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

source

-> Int

offset

-> Int

length

-> m (UnliftedArray a) 

thawUnliftedArray Source #

Arguments

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

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

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

:: UnliftedArray a

source array

-> Int

offset into destination array

-> Int

number of elements to copy

-> UnliftedArray a 

cloneMutableUnliftedArray Source #

Arguments

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

source array

-> Int

offset into destination array

-> Int

number of elements to copy

-> m (MutableUnliftedArray (PrimState m) a)