Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Chunks a
- = ChunksCons !(SmallArray a) !(Chunks a)
- | ChunksNil
- reverse :: Chunks a -> Chunks a
- reverseOnto :: Chunks a -> Chunks a -> Chunks a
- copy :: SmallMutableArray s a -> Int -> Chunks a -> ST s Int
- copyReverse :: SmallMutableArray s a -> Int -> Chunks a -> ST s Int
- concat :: Chunks a -> SmallArray a
- concatReverse :: Chunks a -> SmallArray a
Documentation
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.
ChunksCons !(SmallArray a) !(Chunks a) | |
ChunksNil |
Instances
Foldable Chunks Source # | |
Defined in Data.Chunks fold :: Monoid m => Chunks m -> m # foldMap :: Monoid m => (a -> m) -> Chunks a -> m # foldr :: (a -> b -> b) -> b -> Chunks a -> b # foldr' :: (a -> b -> b) -> b -> Chunks a -> b # foldl :: (b -> a -> b) -> b -> Chunks a -> b # foldl' :: (b -> a -> b) -> b -> Chunks a -> b # foldr1 :: (a -> a -> a) -> Chunks a -> a # foldl1 :: (a -> a -> a) -> Chunks a -> a # elem :: Eq a => a -> Chunks a -> Bool # maximum :: Ord a => Chunks a -> a # minimum :: Ord a => Chunks a -> a # | |
IsList (Chunks a) Source # | |
Eq a => Eq (Chunks a) Source # | |
Show a => Show (Chunks a) Source # | |
Semigroup (Chunks a) Source # | |
Monoid (Chunks a) Source # | |
type Item (Chunks a) Source # | |
Defined in Data.Chunks |
reverse :: Chunks a -> Chunks a Source #
Reverse chunks but not the elements within each chunk.
>>>
reverse [[42,17,94],[6,12],[3,14]]
[[3,14],[6,12],[42,17,94]]
reverseOnto :: Chunks a -> Chunks a -> Chunks a Source #
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]]
:: SmallMutableArray s a | Destination |
-> Int | Destination offset |
-> Chunks a | Source |
-> ST s Int | Returns the next index into the destination after the payload |
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]
:: SmallMutableArray s a | Destination |
-> Int | Destination range successor |
-> Chunks a | Source |
-> ST s Int | Returns the next index into the destination after the payload |
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]
concat :: Chunks a -> SmallArray a Source #
concatReverse :: Chunks a -> SmallArray a Source #