hwsl2-bytevector-0.1.0.0: A hashed byte-vector based on algebraic hashes and finger trees

Data.Hash.SL2.ByteVector

Synopsis

# Documentation

data ByteVector Source

Instances

 Eq ByteVector Ord ByteVector Monoid ByteVector

# Construction

O(1) Creates a vector from a single chunk.

fromList :: [Chunk] -> ByteVector Source

O(n) Creates a vector from a list of chunks.

# Composition

O(1) The empty vector. Alias for `mempty`.

O(n) Concatenates two vectors together. Alias for `mappend`.

O(1) Adds a chunk to the left end of the vector.

O(1) Adds a chunk to the right end of the vector.

# Introspection

O(1) Is this the empty vector?

O(1) Returns the hash of the vector.

O(1) Returns the number of bytes in the vector.

# Deconstruction

data ViewL Source

Constructors

 EmptyL MostL Chunk ByteVector

Instances

 Eq ViewL Ord ViewL

O(1) Creates a view of the left end of the vector.

O(1) Creates a view of the left end of the vector. The single chunk is guaranteed to never be empty.

data ViewR Source

Constructors

 EmptyR MostR ByteVector Chunk

Instances

 Eq ViewR Ord ViewR

O(1) Creates a view of the right end of the vector.

O(1) Creates a view of the right end of the vector. The single chunk is guaranteed to never be empty.

O(log(min(i,n-i))) Splits the vector at the chunk where the accumulated length equals the provided integer i. The resulting left side has a length smaller i.

O(log(min(i,n-i))) Splits the vector at the byte where the accumulated length equals the provided integer i. The resulting left side has a length of min(i,n).

This is potentially less efficient than `splitBefore` because it has to re-hash parts of the vector.

# Transformation

O(n) Reverses the vector.

map :: (Chunk -> Chunk) -> ByteVector -> ByteVector Source

O(n) Applies a function to every chunk in the vector.

# Reduction

foldl :: (a -> Chunk -> a) -> a -> ByteVector -> a Source

O(n) Folds the vector from left to right.

foldr :: (Chunk -> a -> a) -> a -> ByteVector -> a Source

O(n) Folds the vector from right to left.

foldl' :: (a -> Chunk -> a) -> a -> ByteVector -> a Source

O(n) Folds the vector from left to right, with strict application.

foldr' :: (Chunk -> a -> a) -> a -> ByteVector -> a Source

O(n) Folds the vector from right to left, with strict application.