compact-sequences-0.2.0.0: Stacks, queues, and deques with compact representations.

Safe HaskellUnsafe
LanguageHaskell2010

Data.CompactSequence.Internal.Array

Synopsis

Documentation

newtype Array n a Source #

Constructors

Array (SmallArray a) 
Instances
Functor (Array n) Source # 
Instance details

Defined in Data.CompactSequence.Internal.Array

Methods

fmap :: (a -> b) -> Array n a -> Array n b #

(<$) :: a -> Array n b -> Array n a #

Foldable (Array n) Source # 
Instance details

Defined in Data.CompactSequence.Internal.Array

Methods

fold :: Monoid m => Array n m -> m #

foldMap :: Monoid m => (a -> m) -> Array n a -> m #

foldr :: (a -> b -> b) -> b -> Array n a -> b #

foldr' :: (a -> b -> b) -> b -> Array n a -> b #

foldl :: (b -> a -> b) -> b -> Array n a -> b #

foldl' :: (b -> a -> b) -> b -> Array n a -> b #

foldr1 :: (a -> a -> a) -> Array n a -> a #

foldl1 :: (a -> a -> a) -> Array n a -> a #

toList :: Array n a -> [a] #

null :: Array n a -> Bool #

length :: Array n a -> Int #

elem :: Eq a => a -> Array n a -> Bool #

maximum :: Ord a => Array n a -> a #

minimum :: Ord a => Array n a -> a #

sum :: Num a => Array n a -> a #

product :: Num a => Array n a -> a #

Traversable (Array n) Source # 
Instance details

Defined in Data.CompactSequence.Internal.Array

Methods

traverse :: Applicative f => (a -> f b) -> Array n a -> f (Array n b) #

sequenceA :: Applicative f => Array n (f a) -> f (Array n a) #

mapM :: Monad m => (a -> m b) -> Array n a -> m (Array n b) #

sequence :: Monad m => Array n (m a) -> m (Array n a) #

unsafeSmallArrayToArray :: SmallArray a -> Array n a Source #

Unsafely convert a SmallArray of size n to an Array n. This is genuinely unsafe: if n is greater than the true array size, then some operation will eventually violate memory safety.

splitArray :: Size n -> Array (Twice n) a -> (Array n a, Array n a) Source #

append :: Size n -> Array n a -> Array n a -> Array (Twice n) a Source #

Append two arrays of the same size. We take the size of the argument arrays so we can build the result array before loading the first argument array into cache. Is this the right approach? Not sure. We *certainly* don't want to just use <>, because

createSmallArray :: Int -> a -> (forall s. SmallMutableArray s a -> ST s ()) -> SmallArray a Source #

arraySplitListN :: Size n -> [a] -> (Array n a, [a]) Source #

fromList :: Size n -> [a] -> Array n a Source #