storablevector-0.2.12.1: Fast, packed, strict storable arrays with a list interface like ByteString

Safe HaskellNone
LanguageHaskell98

Data.StorableVector.Lazy.Typed

Description

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 ByteStrings.

Synopsis

Documentation

data Vector size a Source #

A Vector size a represents a chunky storable vector with maximum chunk size expressed by type parameter size.

Instances

(Size size, Storable a, Eq a) => Eq (Vector size a) Source # 

Methods

(==) :: Vector size a -> Vector size a -> Bool #

(/=) :: Vector size a -> Vector size a -> Bool #

(Size size, Storable a, Show a) => Show (Vector size a) Source # 

Methods

showsPrec :: Int -> Vector size a -> ShowS #

show :: Vector size a -> String #

showList :: [Vector size a] -> ShowS #

(Size size, Storable a) => Monoid (Vector size a) Source # 

Methods

mempty :: Vector size a #

mappend :: Vector size a -> Vector size a -> Vector size a #

mconcat :: [Vector size a] -> Vector size a #

(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.

Methods

arbitrary :: Gen (Vector size a) #

shrink :: Vector size a -> [Vector size a] #

(Size size, Storable a) => NFData (Vector size a) Source # 

Methods

rnf :: Vector size a -> () #

class Size size where Source #

Minimal complete definition

chunkSize

Methods

chunkSize :: ChunkSize size Source #

data ChunkSize size Source #

chunkSize :: Size size => ChunkSize size Source #

empty :: Storable a => Vector size a Source #

singleton :: Storable a => a -> Vector size 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.

chunks :: Vector size a -> [Vector a] Source #

fromChunks :: (Size size, Storable a) => [Vector a] -> Vector size a Source #

pack :: (Size size, Storable a) => [a] -> Vector size a Source #

unpack :: Storable a => Vector size a -> [a] Source #

unfoldr :: (Size size, Storable b) => (a -> Maybe (b, a)) -> a -> Vector size b Source #

unfoldrResult :: (Size size, Storable b) => (a -> Either c (b, a)) -> a -> (Vector size b, c) Source #

sample :: (Size size, Storable a) => (Int -> a) -> Vector size a Source #

sampleN :: (Size size, Storable a) => Int -> (Int -> a) -> Vector size a Source #

iterate :: (Size size, Storable a) => (a -> a) -> a -> Vector size a Source #

repeat :: (Size size, Storable a) => a -> Vector size a Source #

cycle :: (Size size, Storable a) => Vector size a -> Vector size a Source #

replicate :: (Size size, Storable a) => Int -> a -> Vector size a Source #

null :: (Size size, Storable a) => Vector size a -> Bool Source #

length :: Vector size a -> Int Source #

equal :: (Size size, Storable a, Eq a) => Vector size a -> Vector size a -> Bool Source #

index :: (Size size, Storable a) => Vector size a -> Int -> a Source #

cons :: (Size size, Storable a) => a -> Vector size a -> Vector size a 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.

concat :: (Size size, Storable a) => [Vector size a] -> Vector size a Source #

sliceVertical :: (Size size, Storable a) => Int -> Vector size a -> [Vector size a] Source #

snoc :: (Size size, Storable a) => Vector size a -> a -> Vector size a Source #

map :: (Size size, Storable x, Storable y) => (x -> y) -> Vector size x -> Vector size y Source #

reverse :: (Size size, Storable a) => Vector size a -> Vector size a Source #

foldl :: (Size size, Storable b) => (a -> b -> a) -> a -> Vector size b -> a Source #

foldl' :: (Size size, Storable b) => (a -> b -> a) -> a -> Vector size b -> a Source #

foldr :: (Size size, Storable b) => (b -> a -> a) -> a -> Vector size b -> a Source #

foldMap :: (Size size, Storable a, Monoid m) => (a -> m) -> Vector size a -> m Source #

any :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> Bool Source #

all :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> Bool Source #

maximum :: (Size size, Storable a, Ord a) => Vector size a -> a Source #

minimum :: (Size size, Storable a, Ord a) => Vector size a -> a Source #

viewL :: (Size size, Storable a) => Vector size a -> Maybe (a, Vector size a) Source #

viewR :: (Size size, Storable a) => Vector size a -> Maybe (Vector size a, a) Source #

switchL :: (Size size, Storable a) => b -> (a -> Vector size a -> b) -> Vector size a -> b Source #

switchR :: (Size size, Storable a) => b -> (Vector size a -> a -> b) -> Vector size a -> b Source #

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 #

take :: (Size size, Storable a) => Int -> Vector size a -> Vector size a Source #

takeEnd :: (Size size, Storable a) => Int -> Vector size a -> Vector size a Source #

drop :: (Size size, Storable a) => Int -> Vector size a -> Vector size a 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 #

dropMargin :: (Size size, Storable a) => Int -> Int -> Vector size a -> Vector size a Source #

dropWhile :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> Vector size a Source #

takeWhile :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> Vector size a Source #

span :: (Size size, Storable a) => (a -> Bool) -> Vector size a -> (Vector size a, Vector size a) Source #

filter :: (Size size, Storable a) => (a -> Bool) -> 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 #

sieve :: (Size size, Storable a) => Int -> Vector size a -> Vector size a Source #

deinterleave :: (Size size, Storable a) => Int -> Vector size a -> [Vector size a] 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.

pad :: (Size size, Storable a) => a -> Int -> Vector size a -> Vector size a Source #

Ensure a minimal length of the list by appending pad values.

hGetContentsSync :: (Size size, Storable a) => Handle -> IO (Vector size a) Source #

hPut :: (Size size, Storable a) => Handle -> Vector size a -> IO () Source #

readFileAsync :: (Size size, Storable a) => FilePath -> IO (IOError, Vector size a) Source #

writeFile :: (Size size, Storable a) => FilePath -> Vector size a -> IO () Source #

appendFile :: (Size size, Storable a) => FilePath -> Vector size a -> IO () Source #

interact :: (Size size, Storable a) => (Vector size a -> Vector size a) -> IO () Source #