-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Fast persistent vectors -- -- An persistent vector is an efficient sequence data structure. It -- supports fast indexing, iteration, and snocing. @package pvector @version 0.1.1 module Data.Vector.Persistent.Internal.Array type Array = SmallArray type MArray = SmallMutableArray nullSmallArray :: SmallArray a -> Bool lastSmallArray# :: SmallArray a -> (# a #) singletonSmallArray :: a -> Array a twoSmallArray :: a -> a -> Array a updateSmallArray :: Array a -> Int -> a -> Array a modifySmallArray :: Array a -> Int -> (a -> a) -> Array a modifySmallArrayF :: Functor f => Array a -> Int -> (a -> f a) -> f (Array a) modifySmallArray' :: Array a -> Int -> (a -> a) -> Array a updateResizeSmallArray :: Array a -> Int -> a -> Array a popSmallArray :: Array a -> Array a undefinedElem :: forall a. a ifoldrStepSmallArray :: Int -> Int -> (Int -> a -> b -> b) -> b -> SmallArray a -> b ifoldlStepSmallArray :: Int -> Int -> (Int -> b -> a -> b) -> b -> SmallArray a -> b ifoldrStepSmallArray' :: Int -> Int -> (Int -> a -> b -> b) -> b -> SmallArray a -> b ifoldlStepSmallArray' :: Int -> Int -> (Int -> b -> a -> b) -> b -> SmallArray a -> b imapStepSmallArray :: Int -> Int -> (Int -> a -> b) -> SmallArray a -> SmallArray b imapStepSmallArray' :: Int -> (a -> Int) -> (Int -> a -> b) -> SmallArray a -> SmallArray b itraverseStepSmallArray :: Applicative f => Int -> Int -> (Int -> a -> f b) -> SmallArray a -> f (SmallArray b) modifySmallArray# :: Array a -> Int -> (a -> (# a #)) -> Array a mapSmallArray# :: (a -> (# b #)) -> SmallArray a -> SmallArray b -- | Used to support older ghcs. shrinkSmallMutableArray_ :: PrimMonad m => MArray (PrimState m) a -> Int -> m (MArray (PrimState m) a) snocSmallArray :: Array a -> a -> Array a unsnocSmallArray :: SmallArray a -> Maybe (SmallArray a, a) module Data.Vector.Persistent.Internal.Buffer data Buffer s a Buffer :: !Int -> !SmallMutableArray s a -> Buffer s a [$sel:offset:Buffer] :: Buffer s a -> !Int [$sel:marr:Buffer] :: Buffer s a -> !SmallMutableArray s a new :: (PrimMonad m, s ~ PrimState m) => m (Buffer s a) newWithCapacity :: (PrimMonad m, s ~ PrimState m) => Int -> m (Buffer s a) push :: (PrimMonad m, s ~ PrimState m) => a -> Buffer s a -> m (Buffer s a) read :: (PrimMonad m, s ~ PrimState m) => Int -> Buffer s a -> m a write :: (PrimMonad m, s ~ PrimState m) => Int -> a -> Buffer s a -> m () clear :: Buffer s a -> Buffer s a shrink :: Int -> Buffer s a -> Buffer s a unsafeShrink :: (PrimMonad m, s ~ PrimState m) => Int -> Buffer s a -> m (Buffer s a) capacity :: Buffer s a -> Int null :: Buffer s a -> Bool length :: Buffer s a -> Int undefinedElem :: forall a. a resize :: (PrimMonad m, s ~ PrimState m) => Buffer s a -> m (Buffer s a) grow :: (PrimMonad m, s ~ PrimState m) => Int -> Buffer s a -> m (Buffer s a) freeze :: (PrimMonad m, s ~ PrimState m) => Buffer s a -> m (SmallArray a) unsafeFreeze :: (PrimMonad m, s ~ PrimState m) => Buffer s a -> m (SmallArray a) module Data.Vector.Persistent.Internal.CoercibleUtils -- | Coercive left-composition. -- --
-- >>> (All #. not) True
-- All {getAll = False}
--
--
-- The semantics with respect to bottoms are:
--
-- -- p #. ⊥ ≡ ⊥ -- p #. f ≡ p . f --(#.) :: Coercible b c => (b -> c) -> (a -> b) -> a -> c infixr 9 #. -- | Coercive right-composition. -- --
-- >>> (stimes 2 .# Product) 3
-- Product {getProduct = 9}
--
--
-- The semantics with respect to bottoms are:
--
-- -- ⊥ .# p ≡ ⊥ -- f .# p ≡ p . f --(.#) :: Coercible a b => (b -> c) -> (a -> b) -> a -> c infixr 9 .# module Data.Vector.Persistent.Internal -- | A vector. -- -- The instances are based on those of Seqs, which are in turn -- based on those of lists. data Vector a -- | Invariants: The only time tail can be empty is when init is empty. -- Otherwise tailOffset will give the wrong value. RootNode :: !Int -> !Int -> !Array (Node a) -> !Array a -> Vector a [$sel:size:RootNode] :: Vector a -> !Int -- | 1 << $sel:shift:RootNode is the maximum that each child -- can contain [$sel:shift:RootNode] :: Vector a -> !Int [$sel:init:RootNode] :: Vector a -> !Array (Node a) [$sel:tail:RootNode] :: Vector a -> !Array a data Node a InternalNode :: !Array (Node a) -> Node a [$sel:getInternalNode:InternalNode] :: Node a -> !Array (Node a) DataNode :: !Array a -> Node a [$sel:getDataNode:InternalNode] :: Node a -> !Array a -- | <math> Lazy right fold. foldr :: (a -> b -> b) -> b -> Vector a -> b -- | <math> Strict right fold. foldr' :: (a -> b -> b) -> b -> Vector a -> b -- | <math> Lazy left fold. foldl :: (b -> a -> b) -> b -> Vector a -> b -- | <math> Strict left fold. foldl' :: (b -> a -> b) -> b -> Vector a -> b -- | <math> Indexed lazy right fold. ifoldr :: (Int -> a -> b -> b) -> b -> Vector a -> b -- | <math> Indexed lazy left fold. ifoldl :: (Int -> b -> a -> b) -> b -> Vector a -> b -- | <math> Indexed strict right fold. ifoldr' :: (Int -> a -> b -> b) -> b -> Vector a -> b -- | <math> Indexed strict left fold. ifoldl' :: (Int -> b -> a -> b) -> b -> Vector a -> b persistentVectorEq :: Eq a => Vector a -> Vector a -> Bool nodeEq :: Eq a => Node a -> Node a -> Bool persistentVectorCompare :: Ord a => Vector a -> Vector a -> Ordering nodeCompare :: Ord a => Node a -> Node a -> Ordering -- | <math>. A vector with a single element. singleton :: a -> Vector a -- | <math>. The empty vector. empty :: Vector a -- | <math> Return True if the vector is empty, False -- otherwise. null :: Vector a -> Bool -- | <math>. An alias for snoc Mnemonic: a triangle with the -- single element at the pointy end. (|>) :: Vector a -> a -> Vector a -- | <math>. A bidirectional pattern synonym viewing the rear of a -- non-empty sequence. pattern (:|>) :: Vector a -> a -> Vector a infixl 5 :|> -- | <math>. A bidirectional pattern synonym matching an empty -- sequence. pattern Empty :: Vector a -- | <math> Add an element to the end of the vector. snoc :: Vector a -> a -> Vector a unsafeSnoc :: Vector a -> a -> Vector a snocArr :: Vector a -> Int -> Array a -> Vector a snocTail :: Int -> Array a -> Int -> Array (Node a) -> Array (Node a) newPath :: Int -> Array a -> Node a unsafeIndex :: Vector a -> Int -> a unsafeIndex# :: Vector a -> Int -> (# a #) lookup# :: Int -> Vector a -> (# (# #) | a #) -- | <math>. The element at the index or Nothing if the index -- is out of range. lookup :: Int -> Vector a -> Maybe a -- | <math>. The element at the index. Calls error if the -- index is out of range. index :: HasCallStack => Int -> Vector a -> a -- | <math>. A flipped version of index. (!) :: HasCallStack => Vector a -> Int -> a -- | <math>. A flipped version of lookup. (!?) :: Vector a -> Int -> Maybe a -- | <math>. Adjust the element at the index by applying the function -- to it. If the index is out of range, the original vector is returned. adjust :: (a -> a) -> Int -> Vector a -> Vector a adjust# :: (a -> (# a #)) -> Int -> Vector a -> Vector a -- | <math>. Same as adjust but can have effects through -- Applicative adjustF :: Applicative f => (a -> f a) -> Int -> Vector a -> f (Vector a) -- | <math>. Replace the element at the specified position. If the -- position is out of range, the original sequence is returned. update :: Int -> a -> Vector a -> Vector a -- | <math>. Decompose a list into its head and tail. -- --
-- update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7> --(//) :: Vector a -> [(Int, a)] -> Vector a -- | <math>. Concatenate two vectors. (><) :: Vector a -> Vector a -> Vector a -- | Check the invariant of the vector invariant :: Vector a -> Bool -- | <math>. Create a vector from a list. fromList :: [a] -> Vector a keyBits :: Int nodeWidth :: Int keyMask :: Int (!<<.) :: Bits a => a -> Int -> a infixl 8 !<<. (!>>.) :: Bits a => a -> Int -> a infixl 8 !>>. unstream :: Stream Identity a -> Vector a streamToContents :: PrimMonad m => Stream Identity a -> m (Int, SmallArray a, [Node a]) streamL :: Monad m => Vector a -> Stream m a streamR :: Monad m => Vector a -> Stream m a istreamL :: Monad m => Vector a -> Stream m (Int, a) istreamR :: Monad m => Vector a -> Stream m (Int, a) instance GHC.Show.Show a => GHC.Show.Show (Data.Vector.Persistent.Internal.Node a) instance Data.Functor.Classes.Show1 Data.Vector.Persistent.Internal.Vector instance GHC.Show.Show a => GHC.Show.Show (Data.Vector.Persistent.Internal.Vector a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Vector.Persistent.Internal.Vector a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Vector.Persistent.Internal.Vector a) instance GHC.Base.Functor Data.Vector.Persistent.Internal.Vector instance Data.Foldable.Foldable Data.Vector.Persistent.Internal.Vector instance Data.Traversable.Traversable Data.Vector.Persistent.Internal.Vector instance GHC.Base.Semigroup (Data.Vector.Persistent.Internal.Vector a) instance GHC.Base.Monoid (Data.Vector.Persistent.Internal.Vector a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Vector.Persistent.Internal.Vector a) instance GHC.Base.Applicative Data.Vector.Persistent.Internal.Vector instance GHC.Base.Monad Data.Vector.Persistent.Internal.Vector instance Control.Monad.Fail.MonadFail Data.Vector.Persistent.Internal.Vector instance GHC.Base.Alternative Data.Vector.Persistent.Internal.Vector instance GHC.Base.MonadPlus Data.Vector.Persistent.Internal.Vector instance Control.DeepSeq.NFData1 Data.Vector.Persistent.Internal.Vector instance GHC.Exts.IsList (Data.Vector.Persistent.Internal.Vector a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Vector.Persistent.Internal.Node a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Vector.Persistent.Internal.Node a) -- | The Vector a type is an persistent vector of elements -- of type a. -- -- This module should be imported qualified, to avoid name clashes with -- the Prelude. -- -- Many operations have a average-case complexity of O(log n). The -- implementation uses a large base (i.e. 32) so in practice these -- operations are constant time. -- --
-- update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7> --(//) :: Vector a -> [(Int, a)] -> Vector a -- | <math>. Concatenate two vectors. (><) :: Vector a -> Vector a -> Vector a -- | <math>. Apply a function to all values in the vector. map :: (a -> b) -> Vector a -> Vector b traverse :: Applicative f => (a -> f b) -> Vector a -> f (Vector b) toList :: Vector a -> [a] -- | <math>. Create a vector from a list. fromList :: [a] -> Vector a -- | <math>. Decompose a list into its head and tail. -- -- unsnoc :: Vector a -> Maybe (Vector a, a) module Data.Vector.Persistent.Unsafe unsafeIndex :: Vector a -> Int -> a unsafeIndex# :: Vector a -> Int -> (# a #)