PrimitiveExtras.SmallArray

primitive-extras-0.10.2.1: Extras for the "primitive" library

Safe Haskell | None
Language | Haskell2010

PrimitiveExtras.SmallArray

Synopsis

- newEmptySmallArray :: PrimMonad m => Int -> m (SmallMutableArray (PrimState m) a)
- list :: [a] -> SmallArray a
- unset :: Int -> SmallArray a -> SmallArray a
- set :: Int -> a -> SmallArray a -> SmallArray a
- insert :: Int -> a -> SmallArray a -> SmallArray a
- adjust :: (a -> a) -> Int -> SmallArray a -> SmallArray a
- unsafeAdjust :: (a -> a) -> Int -> SmallArray a -> SmallArray a
- unsafeAdjustWithSize :: (a -> a) -> Int -> Int -> SmallArray a -> SmallArray a
- cons :: a -> SmallArray a -> SmallArray a
- orderedPair :: Int -> e -> Int -> e -> SmallArray e
- findAndReplace :: (a -> Maybe a) -> SmallArray a -> SmallArray a
- findAndMap :: (a -> Maybe b) -> SmallArray a -> Maybe b
- find :: (a -> Bool) -> SmallArray a -> Maybe a
- findWithIndex :: (a -> Bool) -> SmallArray a -> Maybe (Int, a)
- elementsUnfoldlM :: forall (m :: Type -> Type) e. Monad m => SmallArray e -> UnfoldlM m e
- elementsListT :: forall (m :: Type -> Type) a. Monad m => SmallArray a -> ListT m a
- onFoundElementFocus :: forall (m :: Type -> Type) a b. Monad m => (a -> Bool) -> (a -> Bool) -> Focus a m b -> Focus (SmallArray a) m b
- focusOnFoundElement :: Monad m => Focus a m b -> (a -> Bool) -> (a -> Bool) -> SmallArray a -> m (b, SmallArray a)
- toList :: SmallArray a -> [a]

# Documentation

newEmptySmallArray :: PrimMonad m => Int -> m (SmallMutableArray (PrimState m) a) #

A workaround for the weird forcing of `undefined` values int `newSmallArray`

list :: [a] -> SmallArray a #

unset :: Int -> SmallArray a -> SmallArray a #

Remove an element.

set :: Int -> a -> SmallArray a -> SmallArray a #

insert :: Int -> a -> SmallArray a -> SmallArray a #

adjust :: (a -> a) -> Int -> SmallArray a -> SmallArray a #

unsafeAdjust :: (a -> a) -> Int -> SmallArray a -> SmallArray a #

unsafeAdjustWithSize :: (a -> a) -> Int -> Int -> SmallArray a -> SmallArray a #

cons :: a -> SmallArray a -> SmallArray a #

orderedPair :: Int -> e -> Int -> e -> SmallArray e #

findAndReplace :: (a -> Maybe a) -> SmallArray a -> SmallArray a #

findAndMap :: (a -> Maybe b) -> SmallArray a -> Maybe b #

find :: (a -> Bool) -> SmallArray a -> Maybe a #

findWithIndex :: (a -> Bool) -> SmallArray a -> Maybe (Int, a) #

elementsUnfoldlM :: forall (m :: Type -> Type) e. Monad m => SmallArray e -> UnfoldlM m e #

elementsListT :: forall (m :: Type -> Type) a. Monad m => SmallArray a -> ListT m a #

onFoundElementFocus :: forall (m :: Type -> Type) a b. Monad m => (a -> Bool) -> (a -> Bool) -> Focus a m b -> Focus (SmallArray a) m b #

focusOnFoundElement :: Monad m => Focus a m b -> (a -> Bool) -> (a -> Bool) -> SmallArray a -> m (b, SmallArray a) #

toList :: SmallArray a -> [a] #