Safe Haskell | None |
---|---|
Language | Haskell98 |
Like Data.StorableVector.Lazy
but the maximum chunk size is encoded in a type parameter.
This way, you do not need to pass a chunk size parameter at various places.
The API becomes more like the one for lists and ByteString
s.
- data Vector size a
- type DefaultVector = Vector DefaultChunkSize
- class Size size where
- data ChunkSize size
- chunkSize :: Size size => ChunkSize size
- lazyChunkSize :: ChunkSize size -> ChunkSize
- type DefaultChunkSize = Size1024
- data Size1024
- empty :: Storable a => Vector size a
- singleton :: Storable a => a -> Vector size a
- toVectorLazy :: Vector size a -> Vector a
- fromVectorLazy :: (Size size, Storable a) => Vector a -> Vector size a
- chunks :: Vector size a -> [Vector a]
- fromChunks :: (Size size, Storable a) => [Vector a] -> Vector size a
- pack :: (Size size, Storable a) => [a] -> Vector size a
- unpack :: Storable a => Vector size a -> [a]
- unfoldr :: (Size size, Storable b) => (a -> Maybe (b, a)) -> a -> Vector size b
- unfoldrResult :: (Size size, Storable b) => (a -> Either c (b, a)) -> a -> (Vector size b, c)
- sample :: (Size size, Storable a) => (Int -> a) -> Vector size a
- sampleN :: (Size size, Storable a) => Int -> (Int -> a) -> Vector size a
- iterate :: (Size size, Storable a) => (a -> a) -> a -> Vector size a
- repeat :: (Size size, Storable a) => a -> Vector size a
- cycle :: (Size size, Storable a) => Vector size a -> Vector size a
- replicate :: (Size size, Storable a) => Int -> a -> Vector size a
- null :: (Size size, Storable a) => Vector size a -> Bool
- length :: Vector size a -> Int
- equal :: (Size size, Storable a, Eq a) => Vector size a -> Vector size a -> Bool
- index :: (Size size, Storable a) => Vector size a -> Int -> a
- cons :: (Size size, Storable a) => a -> Vector size a -> Vector size a
- append :: (Size size, Storable a) => Vector size a -> Vector size a -> Vector size a
- extendL :: (Size size, Storable a) => Vector a -> Vector size a -> Vector size a
- concat :: (Size size, Storable a) => [Vector size a] -> Vector size a
- sliceVertical :: (Size size, Storable a) => Int -> Vector size a -> [Vector size a]
- snoc :: (Size size, Storable a) => Vector size a -> a -> Vector size a
- map :: (Size size, Storable x, Storable y) => (x -> y) -> Vector size x -> Vector size y
- reverse :: (Size size, Storable a) => Vector size a -> Vector size a
- foldl :: (Size size, Storable b) => (a -> b -> a) -> a -> Vector size b -> a
- foldl' :: (Size size, Storable b) => (a -> b -> a) -> a -> Vector size b -> a
- foldr :: (Size size, Storable b) => (b -> a -> a) -> a -> Vector size b -> a
- foldMap :: (Size size, Storable a, Monoid m) => (a -> m) -> Vector size a -> m
- any :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> Bool
- all :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> Bool
- maximum :: (Size size, Storable a, Ord a) => Vector size a -> a
- minimum :: (Size size, Storable a, Ord a) => Vector size a -> a
- viewL :: (Size size, Storable a) => Vector size a -> Maybe (a, Vector size a)
- viewR :: (Size size, Storable a) => Vector size a -> Maybe (Vector size a, a)
- switchL :: (Size size, Storable a) => b -> (a -> Vector size a -> b) -> Vector size a -> b
- switchR :: (Size size, Storable a) => b -> (Vector size a -> a -> b) -> Vector size a -> b
- scanl :: (Size size, Storable a, Storable b) => (a -> b -> a) -> a -> Vector size b -> Vector size a
- mapAccumL :: (Size size, Storable a, Storable b) => (acc -> a -> (acc, b)) -> acc -> Vector size a -> (acc, Vector size b)
- mapAccumR :: (Size size, Storable a, Storable b) => (acc -> a -> (acc, b)) -> acc -> Vector size a -> (acc, Vector size b)
- crochetL :: (Size size, Storable x, Storable y) => (x -> acc -> Maybe (y, acc)) -> acc -> Vector size x -> Vector size y
- take :: (Size size, Storable a) => Int -> Vector size a -> Vector size a
- takeEnd :: (Size size, Storable a) => Int -> Vector size a -> Vector size a
- drop :: (Size size, Storable a) => Int -> Vector size a -> Vector size a
- splitAt :: (Size size, Storable a) => Int -> Vector size a -> (Vector size a, Vector size a)
- dropMarginRem :: (Size size, Storable a) => Int -> Int -> Vector size a -> (Int, Vector size a)
- dropMargin :: (Size size, Storable a) => Int -> Int -> Vector size a -> Vector size a
- dropWhile :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> Vector size a
- takeWhile :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> Vector size a
- span :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> (Vector size a, Vector size a)
- filter :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> Vector size a
- zipWith :: (Size size, Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector size a -> Vector size b -> Vector size c
- zipWith3 :: (Size size, Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector size a -> Vector size b -> Vector size c -> Vector size d
- zipWith4 :: (Size size, Storable a, Storable b, Storable c, Storable d, Storable e) => (a -> b -> c -> d -> e) -> Vector size a -> Vector size b -> Vector size c -> Vector size d -> Vector size e
- zipWithAppend :: (Size size, Storable a) => (a -> a -> a) -> Vector size a -> Vector size a -> Vector size a
- zipWithLastPattern :: (Size size, Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector size a -> Vector size b -> Vector size c
- zipWithLastPattern3 :: (Size size, Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector size a -> Vector size b -> Vector size c -> Vector size d
- zipWithLastPattern4 :: (Size size, Storable a, Storable b, Storable c, Storable d, Storable e) => (a -> b -> c -> d -> e) -> Vector size a -> Vector size b -> Vector size c -> Vector size d -> Vector size e
- zipWithSize :: (Size size, Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector size a -> Vector size b -> Vector size c
- zipWithSize3 :: (Size size, Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector size a -> Vector size b -> Vector size c -> Vector size d
- zipWithSize4 :: (Size size, Storable a, Storable b, Storable c, Storable d, Storable e) => (a -> b -> c -> d -> e) -> Vector size a -> Vector size b -> Vector size c -> Vector size d -> Vector size e
- sieve :: (Size size, Storable a) => Int -> Vector size a -> Vector size a
- deinterleave :: (Size size, Storable a) => Int -> Vector size a -> [Vector size a]
- interleaveFirstPattern :: (Size size, Storable a) => [Vector size a] -> Vector size a
- pad :: (Size size, Storable a) => a -> Int -> Vector size a -> Vector size a
- hGetContentsAsync :: (Size size, Storable a) => Handle -> IO (IOError, Vector size a)
- hGetContentsSync :: (Size size, Storable a) => Handle -> IO (Vector size a)
- hPut :: (Size size, Storable a) => Handle -> Vector size a -> IO ()
- readFileAsync :: (Size size, Storable a) => FilePath -> IO (IOError, Vector size a)
- writeFile :: (Size size, Storable a) => FilePath -> Vector size a -> IO ()
- appendFile :: (Size size, Storable a) => FilePath -> Vector size a -> IO ()
- interact :: (Size size, Storable a) => (Vector size a -> Vector size a) -> IO ()
Documentation
A Vector size a
represents a chunky storable vector
with maximum chunk size expressed by type parameter size
.
(Size size, Storable a, Eq a) => Eq (Vector size a) Source # | |
(Size size, Storable a, Show a) => Show (Vector size a) Source # | |
(Size size, Storable a) => Semigroup (Vector size a) Source # | |
(Size size, Storable a) => Monoid (Vector size a) Source # | |
(Size size, Storable a, Arbitrary a) => Arbitrary (Vector size a) Source # | This generates chunks of maximum size. If you want to have chunks of varying size, use fromChunks <$> arbitrary instead. |
(Size size, Storable a) => NFData (Vector size a) Source # | |
type DefaultVector = Vector DefaultChunkSize Source #
lazyChunkSize :: ChunkSize size -> ChunkSize Source #
type DefaultChunkSize = Size1024 Source #
toVectorLazy :: Vector size a -> Vector a Source #
fromVectorLazy :: (Size size, Storable a) => Vector a -> Vector size a Source #
This will maintain all laziness breaks, but if chunks are too big, they will be split.
unfoldrResult :: (Size size, Storable b) => (a -> Either c (b, a)) -> a -> (Vector size b, c) Source #
append :: (Size size, Storable a) => Vector size a -> Vector size a -> Vector size a infixr 5 Source #
extendL :: (Size size, Storable a) => Vector a -> Vector size a -> Vector size a Source #
extendL x y
prepends the chunk x
and merges it with the first chunk of y
if the total size is at most size
.
This way you can prepend small chunks
while asserting a reasonable average size for chunks.
The prepended chunk must be smaller than the maximum chunk size in the Vector.
This is not checked.
scanl :: (Size size, Storable a, Storable b) => (a -> b -> a) -> a -> Vector size b -> Vector size a Source #
mapAccumL :: (Size size, Storable a, Storable b) => (acc -> a -> (acc, b)) -> acc -> Vector size a -> (acc, Vector size b) Source #
mapAccumR :: (Size size, Storable a, Storable b) => (acc -> a -> (acc, b)) -> acc -> Vector size a -> (acc, Vector size b) Source #
crochetL :: (Size size, Storable x, Storable y) => (x -> acc -> Maybe (y, acc)) -> acc -> Vector size x -> Vector size y Source #
splitAt :: (Size size, Storable a) => Int -> Vector size a -> (Vector size a, Vector size a) Source #
dropMarginRem :: (Size size, Storable a) => Int -> Int -> Vector size a -> (Int, Vector size a) Source #
span :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> (Vector size a, Vector size a) Source #
zipWith :: (Size size, Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector size a -> Vector size b -> Vector size c Source #
Generates laziness breaks wherever one of the input signals has a chunk boundary.
zipWith3 :: (Size size, Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector size a -> Vector size b -> Vector size c -> Vector size d Source #
zipWith4 :: (Size size, Storable a, Storable b, Storable c, Storable d, Storable e) => (a -> b -> c -> d -> e) -> Vector size a -> Vector size b -> Vector size c -> Vector size d -> Vector size e Source #
zipWithAppend :: (Size size, Storable a) => (a -> a -> a) -> Vector size a -> Vector size a -> Vector size a Source #
zipWithLastPattern :: (Size size, Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector size a -> Vector size b -> Vector size c Source #
Preserves chunk pattern of the last argument.
zipWithLastPattern3 :: (Size size, Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector size a -> Vector size b -> Vector size c -> Vector size d Source #
Preserves chunk pattern of the last argument.
zipWithLastPattern4 :: (Size size, Storable a, Storable b, Storable c, Storable d, Storable e) => (a -> b -> c -> d -> e) -> Vector size a -> Vector size b -> Vector size c -> Vector size d -> Vector size e Source #
Preserves chunk pattern of the last argument.
zipWithSize :: (Size size, Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector size a -> Vector size b -> Vector size c Source #
zipWithSize3 :: (Size size, Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector size a -> Vector size b -> Vector size c -> Vector size d Source #
zipWithSize4 :: (Size size, Storable a, Storable b, Storable c, Storable d, Storable e) => (a -> b -> c -> d -> e) -> Vector size a -> Vector size b -> Vector size c -> Vector size d -> Vector size e Source #
interleaveFirstPattern :: (Size size, Storable a) => [Vector size a] -> Vector size a Source #
Interleave lazy vectors while maintaining the chunk pattern of the first vector. All input vectors must have the same length.