-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Lists of chunks -- -- Lists of chunks. This is similar to the Cons List provided by -- Data.List, but it is more useful as a target for a builder -- since the chunks are cache coherent. @package array-chunks @version 0.1.4.1 module Data.Chunks -- | A list of chunks. This is a foundation on top of which efficient -- builder-like abstractions can be implemented. There are no -- restrictions on the number of elements in each chunk, although -- extremely small chunks (singleton or doubleton chunks) may lead to -- poor performance. data Chunks a ChunksCons :: !SmallArray a -> !Chunks a -> Chunks a ChunksNil :: Chunks a -- | Are there any elements in the chunked list? null :: Chunks a -> Bool -- | Reverse chunks but not the elements within each chunk. -- --
-- >>> reverse [[42,17,94],[6,12],[3,14]] -- [[3,14],[6,12],[42,17,94]] --reverse :: Chunks a -> Chunks a -- | Variant of reverse that allows the caller to provide an initial -- list of chunks that the reversed chunks will be pushed onto. -- --
-- >>> reverseOnto [[15],[12,4]] [[42,17,94],[6,12],[3,14]] -- [[3,14],[6,12],[42,17,94],[15],[12,4]] --reverseOnto :: Chunks a -> Chunks a -> Chunks a -- | Copy the contents of the chunks into a mutable array. Precondition: -- The destination must have enough space to house the contents. This is -- not checked. -- --
-- dest (before): [x,x,x,x,x,x,x,x,x,x,x,x] -- copy dest 2 [[X,Y,Z],[A,B],[C,D]] (returns 9) -- dest (after): [x,x,X,Y,Z,A,B,C,D,x,x,x] --copy :: SmallMutableArray s a -> Int -> Chunks a -> ST s Int -- | Copy the contents of the chunks into a mutable array, reversing the -- order of the chunks. Precondition: The destination must have enough -- space to house the contents. This is not checked. -- --
-- dest (before): [x,x,x,x,x,x,x,x,x,x,x,x] -- copyReverse dest 10 [[X,Y,Z],[A,B],[C,D]] (returns 3) -- dest (after): [x,x,x,C,D,A,B,X,Y,Z,x,x] --copyReverse :: SmallMutableArray s a -> Int -> Chunks a -> ST s Int concat :: Chunks a -> SmallArray a concatReverse :: Chunks a -> SmallArray a -- | Indexing into the chunked list, returning Nothing if there -- are not enough elements. index :: Chunks a -> Int -> Maybe a -- | Mapping over chunks is a little unusual in that the result is just a -- SmallArray. map' :: (a -> b) -> Chunks a -> SmallArray b -- | Create chunks with 1 element. singleton :: a -> Chunks a -- | Create chunks with 2 elements. doubleton :: a -> a -> Chunks a -- | Create chunks with 3 elements. tripleton :: a -> a -> a -> Chunks a -- | Create chunks with 4 elements. quadrupleton :: a -> a -> a -> a -> Chunks a -- | Create chunks with 5 elements. quintupleton :: a -> a -> a -> a -> a -> Chunks a -- | Create chunks with 6 elements. sextupleton :: a -> a -> a -> a -> a -> a -> Chunks a -- | Create chunks with 7 elements. septupleton :: a -> a -> a -> a -> a -> a -> a -> Chunks a -- | Create chunks with 8 elements. octupleton :: a -> a -> a -> a -> a -> a -> a -> a -> Chunks a -- | Create chunks with 9 elements. nonupleton :: a -> a -> a -> a -> a -> a -> a -> a -> a -> Chunks a -- | Create chunks with 10 elements. decupleton :: a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> Chunks a -- | Create chunks with 11 elements. undecupleton :: a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> Chunks a -- | Create chunks with 12 elements. duodecupleton :: a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> Chunks a construct1 :: a -> Chunks a construct2 :: a -> a -> Chunks a construct3 :: a -> a -> a -> Chunks a construct4 :: a -> a -> a -> a -> Chunks a construct5 :: a -> a -> a -> a -> a -> Chunks a construct6 :: a -> a -> a -> a -> a -> a -> Chunks a construct7 :: a -> a -> a -> a -> a -> a -> a -> Chunks a construct8 :: a -> a -> a -> a -> a -> a -> a -> a -> Chunks a construct9 :: a -> a -> a -> a -> a -> a -> a -> a -> a -> Chunks a construct10 :: a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> Chunks a construct11 :: a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> Chunks a construct12 :: a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> Chunks a instance GHC.Show.Show a => GHC.Show.Show (Data.Chunks.Chunks a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Chunks.Chunks a) instance GHC.IsList.IsList (Data.Chunks.Chunks a) instance GHC.Base.Semigroup (Data.Chunks.Chunks a) instance GHC.Base.Monoid (Data.Chunks.Chunks a) instance Data.Foldable.Foldable Data.Chunks.Chunks