Safe Haskell | None |
---|---|
Language | Haskell2010 |
This provides an interface to working with boxed arrays
with elements of type Maybe a
. That is:
SmallMaybeArray a ≅ SmallArray (Maybe a)
However, this type provided by this module is more efficient
than its naive SmallArray
counterpart. It consumes less
memory and has fewer heap indirections.
Synopsis
- data SmallMaybeArray a
- data SmallMutableMaybeArray s a
- indexSmallMaybeArray :: SmallMaybeArray a -> Int -> Maybe a
- newSmallMaybeArray :: PrimMonad m => Int -> Maybe a -> m (SmallMutableMaybeArray (PrimState m) a)
- readSmallMaybeArray :: PrimMonad m => SmallMutableMaybeArray (PrimState m) a -> Int -> m (Maybe a)
- writeSmallMaybeArray :: PrimMonad m => SmallMutableMaybeArray (PrimState m) a -> Int -> Maybe a -> m ()
- sequenceSmallMaybeArray :: SmallMaybeArray a -> Maybe (SmallArray a)
- unsafeFreezeSmallMaybeArray :: PrimMonad m => SmallMutableMaybeArray (PrimState m) a -> m (SmallMaybeArray a)
Documentation
data SmallMaybeArray a Source #
data SmallMutableMaybeArray s a Source #
indexSmallMaybeArray :: SmallMaybeArray a -> Int -> Maybe a Source #
newSmallMaybeArray :: PrimMonad m => Int -> Maybe a -> m (SmallMutableMaybeArray (PrimState m) a) Source #
readSmallMaybeArray :: PrimMonad m => SmallMutableMaybeArray (PrimState m) a -> Int -> m (Maybe a) Source #
writeSmallMaybeArray :: PrimMonad m => SmallMutableMaybeArray (PrimState m) a -> Int -> Maybe a -> m () Source #
sequenceSmallMaybeArray :: SmallMaybeArray a -> Maybe (SmallArray a) Source #
This is like calling sequence
on a SmallArray
. However, in
the event that all the values are Just
, it does not need
to allocate a new array since the array backing the SmallMaybeArray
can be reused.
unsafeFreezeSmallMaybeArray :: PrimMonad m => SmallMutableMaybeArray (PrimState m) a -> m (SmallMaybeArray a) Source #