Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data UnliftedArray e = UnliftedArray ArrayArray#
- data MutableUnliftedArray s e = MutableUnliftedArray (MutableArrayArray# s)
- class PrimUnlifted a where
- unsafeNewUnliftedArray :: (HasCallStack, PrimMonad m) => Int -> m (MutableUnliftedArray (PrimState m) a)
- newUnliftedArray :: (HasCallStack, PrimMonad m, PrimUnlifted a) => Int -> a -> m (MutableUnliftedArray (PrimState m) a)
- setUnliftedArray :: (PrimMonad m, PrimUnlifted a) => MutableUnliftedArray (PrimState m) a -> a -> m ()
- sizeofUnliftedArray :: UnliftedArray e -> Int
- sizeofMutableUnliftedArray :: MutableUnliftedArray s e -> Int
- readUnliftedArray :: (HasCallStack, PrimMonad m, PrimUnlifted a) => MutableUnliftedArray (PrimState m) a -> Int -> m a
- writeUnliftedArray :: (HasCallStack, PrimMonad m, PrimUnlifted a) => MutableUnliftedArray (PrimState m) a -> Int -> a -> m ()
- indexUnliftedArray :: (HasCallStack, PrimUnlifted a) => UnliftedArray a -> Int -> a
- indexUnliftedArrayM :: (HasCallStack, Monad m, PrimUnlifted a) => UnliftedArray a -> Int -> m a
- unsafeFreezeUnliftedArray :: PrimMonad m => MutableUnliftedArray (PrimState m) a -> m (UnliftedArray a)
- freezeUnliftedArray :: (HasCallStack, PrimMonad m) => MutableUnliftedArray (PrimState m) a -> Int -> Int -> m (UnliftedArray a)
- thawUnliftedArray :: (HasCallStack, PrimMonad m) => UnliftedArray a -> Int -> Int -> m (MutableUnliftedArray (PrimState m) a)
- sameMutableUnliftedArray :: MutableUnliftedArray s a -> MutableUnliftedArray s a -> Bool
- copyUnliftedArray :: (HasCallStack, PrimMonad m) => MutableUnliftedArray (PrimState m) a -> Int -> UnliftedArray a -> Int -> Int -> m ()
- copyMutableUnliftedArray :: (HasCallStack, PrimMonad m) => MutableUnliftedArray (PrimState m) a -> Int -> MutableUnliftedArray (PrimState m) a -> Int -> Int -> m ()
- cloneUnliftedArray :: HasCallStack => UnliftedArray a -> Int -> Int -> UnliftedArray a
- cloneMutableUnliftedArray :: (HasCallStack, PrimMonad m) => MutableUnliftedArray (PrimState m) a -> Int -> Int -> m (MutableUnliftedArray (PrimState m) a)
- mapUnliftedArray :: (PrimUnlifted a, PrimUnlifted b) => (a -> b) -> UnliftedArray a -> UnliftedArray b
- foldrUnliftedArray :: PrimUnlifted a => (a -> b -> b) -> b -> UnliftedArray a -> b
- foldlUnliftedArray :: PrimUnlifted a => (b -> a -> b) -> b -> UnliftedArray a -> b
- foldrUnliftedArray' :: PrimUnlifted a => (a -> b -> b) -> b -> UnliftedArray a -> b
- foldlUnliftedArray' :: PrimUnlifted a => (b -> a -> b) -> b -> UnliftedArray a -> b
- unliftedArrayFromList :: PrimUnlifted a => [a] -> UnliftedArray a
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
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.
Instances
Eq (MutableUnliftedArray s a) | |
Defined in Data.Primitive.UnliftedArray (==) :: MutableUnliftedArray s a -> MutableUnliftedArray s a -> Bool # (/=) :: MutableUnliftedArray s a -> MutableUnliftedArray s a -> Bool # | |
PrimUnlifted (MutableUnliftedArray s e) | |
Defined in Data.Primitive.UnliftedArray toArrayArray# :: MutableUnliftedArray s e -> ArrayArray# # fromArrayArray# :: ArrayArray# -> MutableUnliftedArray s e # |
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#
.
toArrayArray# :: a -> ArrayArray# #
fromArrayArray# :: ArrayArray# -> a #
Instances
unsafeNewUnliftedArray :: (HasCallStack, PrimMonad m) => Int -> m (MutableUnliftedArray (PrimState m) a) Source #
newUnliftedArray :: (HasCallStack, PrimMonad m, PrimUnlifted a) => Int -> a -> m (MutableUnliftedArray (PrimState m) a) Source #
:: (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
.
sizeofMutableUnliftedArray :: MutableUnliftedArray s e -> Int #
Yields the length of a MutableUnliftedArray
.
readUnliftedArray :: (HasCallStack, PrimMonad m, PrimUnlifted a) => MutableUnliftedArray (PrimState m) a -> Int -> m a Source #
writeUnliftedArray :: (HasCallStack, PrimMonad m, PrimUnlifted a) => MutableUnliftedArray (PrimState m) a -> Int -> a -> m () Source #
indexUnliftedArray :: (HasCallStack, PrimUnlifted a) => UnliftedArray a -> Int -> a Source #
indexUnliftedArrayM :: (HasCallStack, Monad m, PrimUnlifted a) => UnliftedArray a -> Int -> m a Source #
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.
:: (HasCallStack, PrimMonad m) | |
=> MutableUnliftedArray (PrimState m) a | source |
-> Int | offset |
-> Int | length |
-> m (UnliftedArray a) |
:: (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.
:: (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 #
:: (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 () |
:: HasCallStack | |
=> UnliftedArray a | source array |
-> Int | offset into destination array |
-> Int | number of elements to copy |
-> UnliftedArray a |
cloneMutableUnliftedArray Source #
:: (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
.
unliftedArrayFromList :: PrimUnlifted a => [a] -> UnliftedArray a #