-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Efficient Arrays
--
-- An efficient implementation of Int-indexed arrays with a powerful loop
-- fusion framework.
--
-- This code is highly experimental and for the most part untested. Use
-- at your own risk!
@package vector
@version 0.1
-- | Primitives for manipulating unboxed arrays
module Data.Vector.Unboxed.Unbox
-- | Class of types which can be stored in unboxed arrays
class Unbox a
size# :: (Unbox a) => a -> Int# -> Int#
at# :: (Unbox a) => ByteArray# -> Int# -> a
read# :: (Unbox a) => MutableByteArray# s -> Int# -> State# s -> (# State# s, a #)
write# :: (Unbox a) => MutableByteArray# s -> Int# -> a -> State# s -> State# s
instance Unbox Double
instance Unbox Float
instance Unbox Int
-- | Size hints
module Data.Vector.Stream.Size
-- | Size hint
data Size
-- | Exact size
Exact :: Int -> Size
-- | Upper bound on the size
Max :: Int -> Size
-- | Unknown size
Unknown :: Size
-- | Minimum of two size hints
smaller :: Size -> Size -> Size
-- | Maximum of two size hints
larger :: Size -> Size -> Size
-- | Convert a size hint to an upper bound
toMax :: Size -> Size
-- | Compute the maximum size from a size hint if possible
upperBound :: Size -> Maybe Int
instance Eq Size
instance Show Size
instance Num Size
-- | Fusible streams
module Data.Vector.Stream
data Step s a
Yield :: a -> s -> Step s a
Skip :: s -> Step s a
Done :: Step s a
-- | The type of fusible streams
data Stream a
Stream :: (s -> Step s a) -> s -> Size -> Stream a
-- | Size hint of a Stream
size :: Stream a -> Size
-- | Attach a Size hint to a Stream
sized :: Stream a -> Size -> Stream a
-- | Length of a Stream
length :: Stream a -> Int
-- | Check if a Stream is empty
null :: Stream a -> Bool
-- | Empty Stream
empty :: Stream a
-- | Singleton Stream
singleton :: a -> Stream a
-- | Prepend an element
cons :: a -> Stream a -> Stream a
-- | Append an element
snoc :: Stream a -> a -> Stream a
-- | Replicate a value to a given length
replicate :: Int -> a -> Stream a
-- | Concatenate two Streams
(++) :: Stream a -> Stream a -> Stream a
-- | First element of the Stream or error if empty
head :: Stream a -> a
-- | Last element of the Stream or error if empty
last :: Stream a -> a
-- | Element at the given position
(!!) :: Stream a -> Int -> a
-- | Extract a substream of the given length starting at the given
-- position.
extract :: Stream a -> Int -> Int -> Stream a
-- | All but the last element
init :: Stream a -> Stream a
-- | All but the first element
tail :: Stream a -> Stream a
-- | The first n elements
take :: Int -> Stream a -> Stream a
-- | All but the first n elements
drop :: Int -> Stream a -> Stream a
-- | Map a function over a Stream
map :: (a -> b) -> Stream a -> Stream b
-- | Zip two Streams with the given function
zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c
-- | Drop elements which do not satisfy the predicate
filter :: (a -> Bool) -> Stream a -> Stream a
-- | Longest prefix of elements that satisfy the predicate
takeWhile :: (a -> Bool) -> Stream a -> Stream a
-- | Drop the longest prefix of elements that satisfy the predicate
dropWhile :: (a -> Bool) -> Stream a -> Stream a
-- | Check whether the Stream contains an element
elem :: (Eq a) => a -> Stream a -> Bool
-- | Inverse of elem
notElem :: (Eq a) => a -> Stream a -> Bool
-- | Yield Just the first element matching the predicate or
-- Nothing if no such element exists.
find :: (a -> Bool) -> Stream a -> Maybe a
-- | Yield Just the index of the first element matching the
-- predicate or Nothing if no such element exists.
findIndex :: (a -> Bool) -> Stream a -> Maybe Int
-- | Left fold
foldl :: (a -> b -> a) -> a -> Stream b -> a
-- | Left fold on non-empty Streams
foldl1 :: (a -> a -> a) -> Stream a -> a
-- | Left fold with strict accumulator
foldl' :: (a -> b -> a) -> a -> Stream b -> a
-- | Left fold on non-empty Streams with strict accumulator
foldl1' :: (a -> a -> a) -> Stream a -> a
-- | Right fold
foldr :: (a -> b -> b) -> b -> Stream a -> b
-- | Right fold on non-empty Streams
foldr1 :: (a -> a -> a) -> Stream a -> a
-- | Unfold
unfold :: (s -> Maybe (a, s)) -> s -> Stream a
-- | Convert a Stream to a list
toList :: Stream a -> [a]
-- | Create a Stream from a list
fromList :: [a] -> Stream a
-- | Apply a monadic action to each element of the stream
mapM_ :: (Monad m) => (a -> m ()) -> Stream a -> m ()
-- | Monadic fold
foldM :: (Monad m) => (a -> b -> m a) -> a -> Stream b -> m a
instance (Ord a) => Ord (Stream a)
instance (Eq a) => Eq (Stream a)
instance Functor Stream
-- | Generic interface to mutable vectors
module Data.Vector.MVector
-- | Basic pure functions on mutable vectors
class MVectorPure v a
length :: (MVectorPure v a) => v a -> Int
unsafeSlice :: (MVectorPure v a) => v a -> Int -> Int -> v a
overlaps :: (MVectorPure v a) => v a -> v a -> Bool
-- | Class of mutable vectors. The type m is the monad in which
-- the mutable vector can be transformed and a is the type of
-- elements.
class (Monad m, MVectorPure v a) => MVector v m a
unsafeNew :: (MVector v m a) => Int -> m (v a)
unsafeNewWith :: (MVector v m a) => Int -> a -> m (v a)
unsafeRead :: (MVector v m a) => v a -> Int -> m a
unsafeWrite :: (MVector v m a) => v a -> Int -> a -> m ()
clear :: (MVector v m a) => v a -> m ()
set :: (MVector v m a) => v a -> a -> m ()
unsafeCopy :: (MVector v m a) => v a -> v a -> m ()
unsafeGrow :: (MVector v m a) => v a -> Int -> m (v a)
-- | Yield a part of the mutable vector without copying it. Safer version
-- of unsafeSlice.
slice :: (MVectorPure v a) => v a -> Int -> Int -> v a
-- | Create a mutable vector of the given length. Safer version of
-- unsafeNew.
new :: (MVector v m a) => Int -> m (v a)
-- | Create a mutable vector of the given length and fill it with an
-- initial value. Safer version of unsafeNewWith.
newWith :: (MVector v m a) => Int -> a -> m (v a)
-- | Yield the element at the given position. Safer version of
-- unsafeRead.
read :: (MVector v m a) => v a -> Int -> m a
-- | Replace the element at the given position. Safer version of
-- unsafeWrite.
write :: (MVector v m a) => v a -> Int -> a -> m ()
-- | Copy a vector. The two vectors may not overlap. Safer version of
-- unsafeCopy.
copy :: (MVector v m a) => v a -> v a -> m ()
-- | Grow a vector by the given number of elements. Safer version of
-- unsafeGrow.
grow :: (MVector v m a) => v a -> Int -> m (v a)
-- | Create a new mutable vector and fill it with elements from the
-- Stream. The vector will grow logarithmically if the Size
-- hint of the Stream is inexact.
unstream :: (MVector v m a) => Stream a -> m (v a)
update :: (MVector v m a) => v a -> Stream (Int, a) -> m ()
reverse :: (MVector v m a) => v a -> m ()
map :: (MVector v m a) => (a -> a) -> v a -> m ()
-- | Mutable unboxed vectors based on Unbox.
module Data.Vector.Unboxed.Mutable
-- | Mutable unboxed vectors. They live in the ST monad.
data Vector s a
Vector :: !!Int -> !!Int -> (MutableByteArray# s) -> Vector s a
instance (Unbox a) => MVector (Vector s) (ST s) a
instance (Unbox a) => MVectorPure (Vector s) a
-- | Mutable boxed vectors.
module Data.Vector.Mutable
-- | Mutable boxed vectors. They live in the ST monad.
data Vector s a
Vector :: !!Int -> !!Int -> (MutableArray# s a) -> Vector s a
instance MVector (Vector s) (ST s) a
instance MVectorPure (Vector s) a
module Data.Vector.MVector.Mut
data Mut a
Mut :: (forall m mv. (MVector mv m a) => m (mv a)) -> Mut a
run :: (MVector mv m a) => Mut a -> m (mv a)
unstream :: Stream a -> Mut a
update :: Mut a -> Stream (Int, a) -> Mut a
reverse :: Mut a -> Mut a
map :: (a -> a) -> Mut a -> Mut a
-- | Generic interface to pure vectors
module Data.Vector.IVector
-- | Class of immutable vectors.
class IVector v a
vnew :: (IVector v a) => (forall mv m. (MVector mv m a) => m (mv a)) -> v a
vlength :: (IVector v a) => v a -> Int
unsafeSlice :: (IVector v a) => v a -> Int -> Int -> v a
unsafeIndex :: (IVector v a) => v a -> Int -> (a -> b) -> b
length :: (IVector v a) => v a -> Int
-- | Empty vector
empty :: (IVector v a) => v a
-- | Vector with exaclty one element
singleton :: (IVector v a) => a -> v a
-- | Prepend an element
cons :: (IVector v a) => a -> v a -> v a
-- | Append an element
snoc :: (IVector v a) => v a -> a -> v a
-- | Vector of the given length with the given value in each position
replicate :: (IVector v a) => Int -> a -> v a
-- | Concatenate two vectors
(++) :: (IVector v a) => v a -> v a -> v a
-- | Indexing
(!) :: (IVector v a) => v a -> Int -> a
-- | First element
head :: (IVector v a) => v a -> a
-- | Last element
last :: (IVector v a) => v a -> a
-- | Yield a part of the vector without copying it. Safer version of
-- unsafeSlice.
slice :: (IVector v a) => v a -> Int -> Int -> v a
-- | Copy n elements starting at the given position to a new
-- vector.
extract :: (IVector v a) => v a -> Int -> Int -> v a
-- | Yield the first n elements without copying.
takeSlice :: (IVector v a) => Int -> v a -> v a
-- | Copy the first n elements to a new vector.
take :: (IVector v a) => Int -> v a -> v a
-- | Yield all but the first n elements without copying.
dropSlice :: (IVector v a) => Int -> v a -> v a
-- | Copy all but the first n elements to a new vectors.
drop :: (IVector v a) => Int -> v a -> v a
(//) :: (IVector v a) => v a -> [(Int, a)] -> v a
-- | Map a function over a vector
map :: (IVector v a, IVector v b) => (a -> b) -> v a -> v b
-- | Zip two vectors with the given function.
zipWith :: (IVector v a, IVector v b, IVector v c) => (a -> b -> c) -> v a -> v b -> v c
eq :: (IVector v a, Eq a) => v a -> v a -> Bool
cmp :: (IVector v a, Ord a) => v a -> v a -> Ordering
-- | Drop elements which do not satisfy the predicate
filter :: (IVector v a) => (a -> Bool) -> v a -> v a
-- | Yield the longest prefix of elements satisfying the predicate without
-- copying.
takeWhileSlice :: (IVector v a) => (a -> Bool) -> v a -> v a
-- | Copy the longest prefix of elements satisfying the predicate to a new
-- vector
takeWhile :: (IVector v a) => (a -> Bool) -> v a -> v a
-- | Drop the longest prefix of elements that satisfy the predicate without
-- copying
dropWhileSlice :: (IVector v a) => (a -> Bool) -> v a -> v a
-- | Drop the longest prefix of elements that satisfy the predicate and
-- copy the rest to a new vector.
dropWhile :: (IVector v a) => (a -> Bool) -> v a -> v a
-- | Check whether the vector contains an element
elem :: (IVector v a, Eq a) => a -> v a -> Bool
-- | Inverse of elem
notElem :: (IVector v a, Eq a) => a -> v a -> Bool
-- | Yield Just the first element matching the predicate or
-- Nothing if no such element exists.
find :: (IVector v a) => (a -> Bool) -> v a -> Maybe a
-- | Yield Just the index of the first element matching the
-- predicate or Nothing if no such element exists.
findIndex :: (IVector v a) => (a -> Bool) -> v a -> Maybe Int
-- | Left fold
foldl :: (IVector v b) => (a -> b -> a) -> a -> v b -> a
-- | Lefgt fold on non-empty vectors
foldl1 :: (IVector v a) => (a -> a -> a) -> v a -> a
-- | Left fold with strict accumulator
foldl' :: (IVector v b) => (a -> b -> a) -> a -> v b -> a
-- | Left fold on non-empty vectors with strict accumulator
foldl1' :: (IVector v a) => (a -> a -> a) -> v a -> a
-- | Right fold
foldr :: (IVector v a) => (a -> b -> b) -> b -> v a -> b
-- | Right fold on non-empty vectors
foldr1 :: (IVector v a) => (a -> a -> a) -> v a -> a
-- | Convert a vector to a list
toList :: (IVector v a) => v a -> [a]
-- | Convert a list to a vector
fromList :: (IVector v a) => [a] -> v a
-- | Convert a vector to a Stream
stream :: (IVector v a) => v a -> Stream a
-- | Create a vector from a Stream
unstream :: (IVector v a) => Stream a -> v a
-- | Construct a pure vector from a monadic initialiser
new :: (IVector v a) => Mut a -> v a
-- | Boxed vectors
module Data.Vector
data Vector a
Vector :: !!Int -> !!Int -> (Array# a) -> Vector a
instance (Ord a) => Ord (Vector a)
instance (Eq a) => Eq (Vector a)
instance IVector Vector a
-- | Unboxed vectors based on Unbox.
module Data.Vector.Unboxed
data Vector a
Vector :: !!Int -> !!Int -> ByteArray# -> Vector a
instance (Unbox a, Ord a) => Ord (Vector a)
instance (Unbox a, Eq a) => Eq (Vector a)
instance (Unbox a) => IVector Vector a