-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Efficient Arrays -- -- An efficient but highly experimental implementation of Int-indexed -- arrays with a powerful loop fusion framework. @package vector @version 0.3.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 instance Unbox Word -- | Size hints module Data.Vector.Fusion.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 -- | Monadic streams module Data.Vector.Fusion.Stream.Monadic -- | Monadic streams data Stream m a Stream :: (s -> m (Step s a)) -> s -> Size -> Stream m a -- | Result of taking a single step in a stream data Step s a -- | a new element and a new seed Yield :: a -> s -> Step s a -- | just a new seed Skip :: s -> Step s a -- | end of stream Done :: Step s a -- | Size hint of a Stream size :: Stream m a -> Size -- | Attach a Size hint to a Stream sized :: Stream m a -> Size -> Stream m a -- | Length of a Stream length :: (Monad m) => Stream m a -> m Int -- | Check if a Stream is empty null :: (Monad m) => Stream m a -> m Bool -- | Empty Stream empty :: (Monad m) => Stream m a -- | Singleton Stream singleton :: (Monad m) => a -> Stream m a -- | Prepend an element cons :: (Monad m) => a -> Stream m a -> Stream m a -- | Append an element snoc :: (Monad m) => Stream m a -> a -> Stream m a -- | Replicate a value to a given length replicate :: (Monad m) => Int -> a -> Stream m a -- | Concatenate two Streams (++) :: (Monad m) => Stream m a -> Stream m a -> Stream m a -- | First element of the Stream or error if empty head :: (Monad m) => Stream m a -> m a -- | Last element of the Stream or error if empty last :: (Monad m) => Stream m a -> m a -- | Element at the given position (!!) :: (Monad m) => Stream m a -> Int -> m a -- | Extract a substream of the given length starting at the given -- position. extract :: (Monad m) => Stream m a -> Int -> Int -> Stream m a -- | All but the last element init :: (Monad m) => Stream m a -> Stream m a -- | All but the first element tail :: (Monad m) => Stream m a -> Stream m a -- | The first n elements take :: (Monad m) => Int -> Stream m a -> Stream m a -- | All but the first n elements drop :: (Monad m) => Int -> Stream m a -> Stream m a -- | Map a function over a Stream map :: (Monad m) => (a -> b) -> Stream m a -> Stream m b -- | Map a monadic function over a Stream mapM :: (Monad m) => (a -> m b) -> Stream m a -> Stream m b -- | Execute a monadic action for each element of the Stream mapM_ :: (Monad m) => (a -> m b) -> Stream m a -> m () -- | Transform a Stream to use a different monad trans :: (Monad m, Monad m') => (forall a. m a -> m' a) -> Stream m a -> Stream m' a concatMap :: (Monad m) => (a -> Stream m b) -> Stream m a -> Stream m b -- | Zip two Streams with the given function zipWith :: (Monad m) => (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c -- | Zip two Streams with the given monadic function zipWithM :: (Monad m) => (a -> b -> m c) -> Stream m a -> Stream m b -> Stream m c -- | Zip three Streams with the given function zipWith3 :: (Monad m) => (a -> b -> c -> d) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -- | Zip three Streams with the given monadic function zipWith3M :: (Monad m) => (a -> b -> c -> m d) -> Stream m a -> Stream m b -> Stream m c -> Stream m d -- | Drop elements which do not satisfy the predicate filter :: (Monad m) => (a -> Bool) -> Stream m a -> Stream m a -- | Drop elements which do not satisfy the monadic predicate filterM :: (Monad m) => (a -> m Bool) -> Stream m a -> Stream m a -- | Longest prefix of elements that satisfy the predicate takeWhile :: (Monad m) => (a -> Bool) -> Stream m a -> Stream m a -- | Longest prefix of elements that satisfy the monadic predicate takeWhileM :: (Monad m) => (a -> m Bool) -> Stream m a -> Stream m a -- | Drop the longest prefix of elements that satisfy the predicate dropWhile :: (Monad m) => (a -> Bool) -> Stream m a -> Stream m a -- | Drop the longest prefix of elements that satisfy the monadic predicate dropWhileM :: (Monad m) => (a -> m Bool) -> Stream m a -> Stream m a -- | Check whether the Stream contains an element elem :: (Monad m, Eq a) => a -> Stream m a -> m Bool -- | Inverse of elem notElem :: (Monad m, Eq a) => a -> Stream m a -> m Bool -- | Yield Just the first element that satisfies the predicate or -- Nothing if no such element exists. find :: (Monad m) => (a -> Bool) -> Stream m a -> m (Maybe a) -- | Yield Just the first element that satisfies the monadic -- predicate or Nothing if no such element exists. findM :: (Monad m) => (a -> m Bool) -> Stream m a -> m (Maybe a) -- | Yield Just the index of the first element that satisfies the -- predicate or Nothing if no such element exists. findIndex :: (Monad m) => (a -> Bool) -> Stream m a -> m (Maybe Int) -- | Yield Just the index of the first element that satisfies the -- monadic predicate or Nothing if no such element exists. findIndexM :: (Monad m) => (a -> m Bool) -> Stream m a -> m (Maybe Int) -- | Left fold foldl :: (Monad m) => (a -> b -> a) -> a -> Stream m b -> m a -- | Left fold with a monadic operator foldlM :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> m a -- | Same as foldlM foldM :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> m a -- | Left fold over a non-empty Stream foldl1 :: (Monad m) => (a -> a -> a) -> Stream m a -> m a -- | Left fold over a non-empty Stream with a monadic operator foldl1M :: (Monad m) => (a -> a -> m a) -> Stream m a -> m a -- | Left fold with a strict accumulator foldl' :: (Monad m) => (a -> b -> a) -> a -> Stream m b -> m a -- | Left fold with a strict accumulator and a monadic operator foldlM' :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> m a -- | Left fold over a non-empty Stream with a strict accumulator foldl1' :: (Monad m) => (a -> a -> a) -> Stream m a -> m a -- | Left fold over a non-empty Stream with a strict accumulator and -- a monadic operator foldl1M' :: (Monad m) => (a -> a -> m a) -> Stream m a -> m a -- | Right fold foldr :: (Monad m) => (a -> b -> b) -> b -> Stream m a -> m b -- | Right fold with a monadic operator foldrM :: (Monad m) => (a -> b -> m b) -> b -> Stream m a -> m b -- | Right fold over a non-empty stream foldr1 :: (Monad m) => (a -> a -> a) -> Stream m a -> m a -- | Right fold over a non-empty stream with a monadic operator foldr1M :: (Monad m) => (a -> a -> m a) -> Stream m a -> m a and :: (Monad m) => Stream m Bool -> m Bool or :: (Monad m) => Stream m Bool -> m Bool concatMapM :: (Monad m) => (a -> m (Stream m b)) -> Stream m a -> Stream m b -- | Unfold unfoldr :: (Monad m) => (s -> Maybe (a, s)) -> s -> Stream m a -- | Unfold with a monadic function unfoldrM :: (Monad m) => (s -> m (Maybe (a, s))) -> s -> Stream m a -- | Prefix scan prescanl :: (Monad m) => (a -> b -> a) -> a -> Stream m b -> Stream m a -- | Prefix scan with a monadic operator prescanlM :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> Stream m a -- | Prefix scan with strict accumulator prescanl' :: (Monad m) => (a -> b -> a) -> a -> Stream m b -> Stream m a -- | Prefix scan with strict accumulator and a monadic operator prescanlM' :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> Stream m a -- | Convert a Stream to a list toList :: (Monad m) => Stream m a -> m [a] -- | Convert a list to a Stream fromList :: (Monad m) => [a] -> Stream m a instance (Monad m) => Functor (Stream m) -- | Fusion-related utility types module Data.Vector.Fusion.Util -- | Identity monad newtype Id a Id :: a -> Id a unId :: Id a -> a -- | Box monad data Box a Box :: a -> Box a unBox :: Box a -> a instance Monad Box instance Functor Box instance Monad Id instance Functor Id -- | Streams for stream fusion module Data.Vector.Fusion.Stream -- | Result of taking a single step in a stream data Step s a -- | a new element and a new seed Yield :: a -> s -> Step s a -- | just a new seed Skip :: s -> Step s a -- | end of stream Done :: Step s a -- | The type of pure streams type Stream = Stream Id -- | Alternative name for monadic streams type MStream = Stream -- | 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 concatMap :: (a -> Stream b) -> Stream a -> Stream b -- | Zip two Streams with the given function zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c -- | Zip three Streams with the given function zipWith3 :: (a -> b -> c -> d) -> Stream a -> Stream b -> Stream c -> Stream d -- | 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 and :: Stream Bool -> Bool or :: Stream Bool -> Bool -- | Unfold unfoldr :: (s -> Maybe (a, s)) -> s -> Stream a -- | Prefix scan prescanl :: (a -> b -> a) -> a -> Stream b -> Stream a -- | Prefix scan with strict accumulator prescanl' :: (a -> b -> a) -> a -> Stream b -> Stream a -- | Convert a Stream to a list toList :: Stream a -> [a] -- | Create a Stream from a list fromList :: [a] -> Stream a -- | Convert a pure stream to a monadic stream liftStream :: (Monad m) => Stream a -> Stream m 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 Id a) instance (Eq a) => Eq (Stream Id a) -- | 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) transform :: (MVector v m a) => (MStream m a -> MStream m a) -> v a -> m (v a) accum :: (MVector v m a) => (a -> b -> a) -> v a -> Stream (Int, b) -> m () update :: (MVector v m a) => v a -> Stream (Int, a) -> m () reverse :: (MVector v m a) => v a -> m () -- | Mutable unboxed vectors based on Unbox in the ST monad. module Data.Vector.Unboxed.Mutable.ST -- | 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 unboxed vectors in the IO monad. module Data.Vector.Unboxed.Mutable.IO -- | IO-based mutable vectors newtype Vector a Vector :: (Vector RealWorld a) -> Vector a instance (Unbox a) => MVector Vector IO a instance (Unbox a) => MVectorPure Vector a -- | Mutable boxed vectors in the ST monad. module Data.Vector.Mutable.ST -- | 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 -- | Mutable boxed vectors in the IO monad. module Data.Vector.Mutable.IO -- | IO-based mutable vectors newtype Vector a Vector :: (Vector RealWorld a) -> Vector a instance MVector Vector IO a instance MVectorPure Vector a module Data.Vector.MVector.New newtype New a New :: (forall m mv. (MVector mv m a) => m (mv a)) -> New a run :: (MVector mv m a) => New a -> m (mv a) unstream :: Stream a -> New a transform :: (forall m. (Monad m) => MStream m a -> MStream m a) -> New a -> New a accum :: (a -> b -> a) -> New a -> Stream (Int, b) -> New a update :: New a -> Stream (Int, a) -> New a reverse :: New a -> New a slice :: New a -> Int -> Int -> New a init :: New a -> New a tail :: New a -> New a take :: Int -> New a -> New a drop :: Int -> New a -> New 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 unsafeIndexM :: (IVector v a, Monad m) => v a -> Int -> m a length :: (IVector v a) => v a -> Int null :: (IVector v a) => v a -> Bool -- | 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 -- | Create a copy of a vector. Useful when dealing with slices. copy :: (IVector 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 -- | Monadic indexing which can be strict in the vector while remaining -- lazy in the element. indexM :: (IVector v a, Monad m) => v a -> Int -> m a headM :: (IVector v a, Monad m) => v a -> m a lastM :: (IVector v a, Monad m) => v a -> m a -- | Yield a part of the vector without copying it. Safer version of -- unsafeSlice. slice :: (IVector v a) => v a -> Int -> Int -> v a -- | Yield all but the last element without copying. init :: (IVector v a) => v a -> v a -- | All but the first element (without copying). tail :: (IVector v a) => v a -> v a -- | Yield the first n elements without copying. take :: (IVector v a) => Int -> v a -> v a -- | Yield all but the first n elements without copying. drop :: (IVector v a) => Int -> v a -> v a accum :: (IVector v a) => (a -> b -> a) -> v a -> [(Int, b)] -> v a (//) :: (IVector v a) => v a -> [(Int, a)] -> v a update :: (IVector v a, IVector v (Int, a)) => v a -> v (Int, a) -> v a backpermute :: (IVector v a, IVector v Int) => v a -> v Int -> v a reverse :: (IVector v a) => v a -> v a -- | Map a function over a vector map :: (IVector v a, IVector v b) => (a -> b) -> v a -> v b concatMap :: (IVector v a, IVector v b) => (a -> v 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 -- | Zip three vectors with the given function. zipWith3 :: (IVector v a, IVector v b, IVector v c, IVector v d) => (a -> b -> c -> d) -> v a -> v b -> v c -> v d zip :: (IVector v a, IVector v b, IVector v (a, b)) => v a -> v b -> v (a, b) zip3 :: (IVector v a, IVector v b, IVector v c, IVector v (a, b, c)) => v a -> v b -> v c -> v (a, b, c) unzip :: (IVector v a, IVector v b, IVector v (a, b)) => v (a, b) -> (v a, v b) unzip3 :: (IVector v a, IVector v b, IVector v c, IVector v (a, b, c)) => v (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. takeWhile :: (IVector v a) => (a -> Bool) -> v a -> v a -- | Drop the longest prefix of elements that satisfy the predicate. 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 and :: (IVector v Bool) => v Bool -> Bool or :: (IVector v Bool) => v Bool -> Bool sum :: (IVector v a, Num a) => v a -> a product :: (IVector v a, Num a) => v a -> a maximum :: (IVector v a, Ord a) => v a -> a minimum :: (IVector v a, Ord a) => v a -> a unfoldr :: (IVector v a) => (b -> Maybe (a, b)) -> b -> v a -- | Prefix scan prescanl :: (IVector v a, IVector v b) => (a -> b -> a) -> a -> v b -> v a -- | Prefix scan with strict accumulator prescanl' :: (IVector v a, IVector v b) => (a -> b -> a) -> a -> v b -> v a enumFromTo :: (IVector v a, Enum a) => a -> a -> v a enumFromThenTo :: (IVector v a, Enum a) => a -> a -> a -> v 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) => New a -> v a -- | Boxed vectors module Data.Vector data Vector a length :: Vector a -> Int null :: Vector a -> Bool -- | Empty vector empty :: Vector a -- | Vector with exaclty one element singleton :: a -> Vector a -- | Prepend an element cons :: a -> Vector a -> Vector a -- | Append an element snoc :: Vector a -> a -> Vector a -- | Vector of the given length with the given value in each position replicate :: Int -> a -> Vector a -- | Concatenate two vectors (++) :: Vector a -> Vector a -> Vector a -- | Create a copy of a vector. Useful when dealing with slices. copy :: Vector a -> Vector a -- | Indexing (!) :: Vector a -> Int -> a -- | First element head :: Vector a -> a -- | Last element last :: Vector a -> a -- | Monadic indexing which can be strict in the vector while remaining -- lazy in the element indexM :: (Monad m) => Vector a -> Int -> m a headM :: (Monad m) => Vector a -> m a lastM :: (Monad m) => Vector a -> m a -- | Yield a part of the vector without copying it. Safer version of -- unsafeSlice. slice :: Vector a -> Int -> Int -> Vector a -- | Yield all but the last element without copying. init :: Vector a -> Vector a -- | All but the first element (without copying). tail :: Vector a -> Vector a -- | Yield the first n elements without copying. take :: Int -> Vector a -> Vector a -- | Yield all but the first n elements without copying. drop :: Int -> Vector a -> Vector a accum :: (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a (//) :: Vector a -> [(Int, a)] -> Vector a update :: Vector a -> Vector (Int, a) -> Vector a backpermute :: Vector a -> Vector Int -> Vector a reverse :: Vector a -> Vector a -- | Map a function over a vector map :: (a -> b) -> Vector a -> Vector b concatMap :: (a -> Vector b) -> Vector a -> Vector b -- | Zip two vectors with the given function. zipWith :: (a -> b -> c) -> Vector a -> Vector b -> Vector c -- | Zip three vectors with the given function. zipWith3 :: (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d zip :: Vector a -> Vector b -> Vector (a, b) zip3 :: Vector a -> Vector b -> Vector c -> Vector (a, b, c) unzip :: Vector (a, b) -> (Vector a, Vector b) unzip3 :: Vector (a, b, c) -> (Vector a, Vector b, Vector c) -- | Drop elements which do not satisfy the predicate filter :: (a -> Bool) -> Vector a -> Vector a -- | Yield the longest prefix of elements satisfying the predicate. takeWhile :: (a -> Bool) -> Vector a -> Vector a -- | Drop the longest prefix of elements that satisfy the predicate. dropWhile :: (a -> Bool) -> Vector a -> Vector a -- | Check whether the vector contains an element elem :: (Eq a) => a -> Vector a -> Bool -- | Inverse of elem notElem :: (Eq a) => a -> Vector a -> Bool -- | Yield Just the first element matching the predicate or -- Nothing if no such element exists. find :: (a -> Bool) -> Vector a -> Maybe a -- | Yield Just the index of the first element matching the -- predicate or Nothing if no such element exists. findIndex :: (a -> Bool) -> Vector a -> Maybe Int -- | Left fold foldl :: (a -> b -> a) -> a -> Vector b -> a -- | Lefgt fold on non-empty vectors foldl1 :: (a -> a -> a) -> Vector a -> a -- | Left fold with strict accumulator foldl' :: (a -> b -> a) -> a -> Vector b -> a -- | Left fold on non-empty vectors with strict accumulator foldl1' :: (a -> a -> a) -> Vector a -> a -- | Right fold foldr :: (a -> b -> b) -> b -> Vector a -> b -- | Right fold on non-empty vectors foldr1 :: (a -> a -> a) -> Vector a -> a and :: Vector Bool -> Bool or :: Vector Bool -> Bool sum :: (Num a) => Vector a -> a product :: (Num a) => Vector a -> a maximum :: (Ord a) => Vector a -> a minimum :: (Ord a) => Vector a -> a unfoldr :: (b -> Maybe (a, b)) -> b -> Vector a -- | Prefix scan prescanl :: (a -> b -> a) -> a -> Vector b -> Vector a -- | Prefix scan with strict accumulator prescanl' :: (a -> b -> a) -> a -> Vector b -> Vector a enumFromTo :: (Enum a) => a -> a -> Vector a enumFromThenTo :: (Enum a) => a -> a -> a -> Vector a -- | Convert a vector to a list toList :: Vector a -> [a] -- | Convert a list to a vector fromList :: [a] -> Vector a instance (Ord a) => Ord (Vector a) instance (Eq a) => Eq (Vector a) instance IVector Vector a instance (Show a) => Show (Vector a) -- | Unboxed vectors based on Unbox. module Data.Vector.Unboxed -- | Unboxed vectors data Vector a length :: (Unbox a) => Vector a -> Int null :: (Unbox a) => Vector a -> Bool -- | Empty vector empty :: (Unbox a) => Vector a -- | Vector with exaclty one element singleton :: (Unbox a) => a -> Vector a -- | Prepend an element cons :: (Unbox a) => a -> Vector a -> Vector a -- | Append an element snoc :: (Unbox a) => Vector a -> a -> Vector a -- | Vector of the given length with the given value in each position replicate :: (Unbox a) => Int -> a -> Vector a -- | Concatenate two vectors (++) :: (Unbox a) => Vector a -> Vector a -> Vector a -- | Create a copy of a vector. Useful when dealing with slices. copy :: (Unbox a) => Vector a -> Vector a -- | Indexing (!) :: (Unbox a) => Vector a -> Int -> a -- | First element head :: (Unbox a) => Vector a -> a -- | Last element last :: (Unbox a) => Vector a -> a -- | Yield a part of the vector without copying it. Safer version of -- unsafeSlice. slice :: (Unbox a) => Vector a -> Int -> Int -> Vector a -- | Yield all but the last element without copying. init :: (Unbox a) => Vector a -> Vector a -- | All but the first element (without copying). tail :: (Unbox a) => Vector a -> Vector a -- | Yield the first n elements without copying. take :: (Unbox a) => Int -> Vector a -> Vector a -- | Yield all but the first n elements without copying. drop :: (Unbox a) => Int -> Vector a -> Vector a accum :: (Unbox a) => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a (//) :: (Unbox a) => Vector a -> [(Int, a)] -> Vector a backpermute :: (Unbox a) => Vector a -> Vector Int -> Vector a reverse :: (Unbox a) => Vector a -> Vector a -- | Map a function over a vector map :: (Unbox a, Unbox b) => (a -> b) -> Vector a -> Vector b concatMap :: (Unbox a, Unbox b) => (a -> Vector b) -> Vector a -> Vector b -- | Zip two vectors with the given function. zipWith :: (Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c -- | Zip three vectors with the given function. zipWith3 :: (Unbox a, Unbox b, Unbox c, Unbox d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d -- | Drop elements which do not satisfy the predicate filter :: (Unbox a) => (a -> Bool) -> Vector a -> Vector a -- | Yield the longest prefix of elements satisfying the predicate. takeWhile :: (Unbox a) => (a -> Bool) -> Vector a -> Vector a -- | Drop the longest prefix of elements that satisfy the predicate. dropWhile :: (Unbox a) => (a -> Bool) -> Vector a -> Vector a -- | Check whether the vector contains an element elem :: (Unbox a, Eq a) => a -> Vector a -> Bool -- | Inverse of elem notElem :: (Unbox a, Eq a) => a -> Vector a -> Bool -- | Yield Just the first element matching the predicate or -- Nothing if no such element exists. find :: (Unbox a) => (a -> Bool) -> Vector a -> Maybe a -- | Yield Just the index of the first element matching the -- predicate or Nothing if no such element exists. findIndex :: (Unbox a) => (a -> Bool) -> Vector a -> Maybe Int -- | Left fold foldl :: (Unbox b) => (a -> b -> a) -> a -> Vector b -> a -- | Lefgt fold on non-empty vectors foldl1 :: (Unbox a) => (a -> a -> a) -> Vector a -> a -- | Left fold with strict accumulator foldl' :: (Unbox b) => (a -> b -> a) -> a -> Vector b -> a -- | Left fold on non-empty vectors with strict accumulator foldl1' :: (Unbox a) => (a -> a -> a) -> Vector a -> a -- | Right fold foldr :: (Unbox a) => (a -> b -> b) -> b -> Vector a -> b -- | Right fold on non-empty vectors foldr1 :: (Unbox a) => (a -> a -> a) -> Vector a -> a sum :: (Unbox a, Num a) => Vector a -> a product :: (Unbox a, Num a) => Vector a -> a maximum :: (Unbox a, Ord a) => Vector a -> a minimum :: (Unbox a, Ord a) => Vector a -> a unfoldr :: (Unbox a) => (b -> Maybe (a, b)) -> b -> Vector a -- | Prefix scan prescanl :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Prefix scan with strict accumulator prescanl' :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a enumFromTo :: (Unbox a, Enum a) => a -> a -> Vector a enumFromThenTo :: (Unbox a, Enum a) => a -> a -> a -> Vector a -- | Convert a vector to a list toList :: (Unbox a) => Vector a -> [a] -- | Convert a list to a vector fromList :: (Unbox a) => [a] -> Vector a instance (Unbox a, Ord a) => Ord (Vector a) instance (Unbox a, Eq a) => Eq (Vector a) instance (Unbox a) => IVector Vector a instance (Show a, Unbox a) => Show (Vector a)