-- 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. -- -- It is structured as follows: -- -- @package vector @version 0.4.1 -- | Ugly internal utility functions for implementing Storable-based -- vectors. module Data.Vector.Storable.Internal inlinePerformIO :: IO a -> a -- | 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 -- | 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 -- | Same as foldlM foldM :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> m a -- | Same as foldl1M fold1M :: (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 -- | Same as foldlM' foldM' :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> m a -- | Same as foldl1M' fold1M' :: (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 -- | Suffix scan postscanl :: (Monad m) => (a -> b -> a) -> a -> Stream m b -> Stream m a -- | Suffix scan with a monadic operator postscanlM :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> Stream m a -- | Suffix scan with strict accumulator postscanl' :: (Monad m) => (a -> b -> a) -> a -> Stream m b -> Stream m a -- | Suffix scan with strict acccumulator and a monadic operator postscanlM' :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> Stream m a -- | Haskell-style scan scanl :: (Monad m) => (a -> b -> a) -> a -> Stream m b -> Stream m a -- | Haskell-style scan with a monadic operator scanlM :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> Stream m a -- | Haskell-style scan with strict accumulator scanl' :: (Monad m) => (a -> b -> a) -> a -> Stream m b -> Stream m a -- | Haskell-style scan with strict accumulator and a monadic operator scanlM' :: (Monad m) => (a -> b -> m a) -> a -> Stream m b -> Stream m a -- | Scan over a non-empty Stream scanl1 :: (Monad m) => (a -> a -> a) -> Stream m a -> Stream m a -- | Scan over a non-empty Stream with a monadic operator scanl1M :: (Monad m) => (a -> a -> m a) -> Stream m a -> Stream m a -- | Scan over a non-empty Stream with a strict accumulator scanl1' :: (Monad m) => (a -> a -> a) -> Stream m a -> Stream m a -- | Scan over a non-empty Stream with a strict accumulator and a -- monadic operator scanl1M' :: (Monad m) => (a -> a -> m a) -> Stream m a -> 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 inplace :: (forall m. (Monad m) => Stream m a -> Stream m a) -> Stream a -> Stream a inplace' :: (forall m. (Monad m) => Stream m a -> Stream m b) -> Stream a -> Stream b -- | 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 -- | Suffix scan postscanl :: (a -> b -> a) -> a -> Stream b -> Stream a -- | Suffix scan with strict accumulator postscanl' :: (a -> b -> a) -> a -> Stream b -> Stream a -- | Haskell-style scan scanl :: (a -> b -> a) -> a -> Stream b -> Stream a -- | Haskell-style scan with strict accumulator scanl' :: (a -> b -> a) -> a -> Stream b -> Stream a -- | Scan over a non-empty Stream scanl1 :: (a -> a -> a) -> Stream a -> Stream a -- | Scan over a non-empty Stream with a strict accumulator scanl1' :: (a -> a -> a) -> Stream a -> 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 -- | Monadic fold over non-empty stream fold1M :: (Monad m) => (a -> a -> m a) -> Stream a -> m a -- | Monadic fold with strict accumulator foldM' :: (Monad m) => (a -> b -> m a) -> a -> Stream b -> m a -- | Monad fold over non-empty stream with strict accumulator fold1M' :: (Monad m) => (a -> a -> m a) -> Stream a -> m a instance (Ord a) => Ord (Stream Id a) instance (Eq a) => Eq (Stream Id a) -- | Generic interface to mutable vectors module Data.Vector.Generic.Mutable -- | 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 primitive vectors. module Data.Vector.Primitive.Mutable -- | Mutable unboxed vectors. They live in the ST monad. data MVector m a MVector :: !!Int -> !!Int -> !!MutableByteArray m -> MVector m a type IOVector = MVector IO type STVector s = MVector (ST s) instance (Prim a, PrimMonad m) => MVector (MVector m) m a instance (Prim a) => MVectorPure (MVector m) a -- | Mutable vectors based on Storable. module Data.Vector.Storable.Mutable -- | Mutable Storable-based vectors in the IO monad. data MVector a MVector :: !!Int -> !!Int -> !!ForeignPtr a -> MVector a instance (Storable a) => MVector MVector IO a instance MVectorPure MVector a -- | Mutable boxed vectors. module Data.Vector.Mutable -- | Mutable boxed vectors keyed on the monad they live in (IO or -- ST s). data MVector m a MVector :: !!Int -> !!Int -> !!MutableArray m a -> MVector m a type IOVector = MVector IO type STVector s = MVector (ST s) instance (PrimMonad m) => MVector (MVector m) m a instance MVectorPure (MVector m) a -- | Purely functional interface to initialisation of mutable vectors module Data.Vector.Generic.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.Generic -- | Class of immutable vectors. class Vector v a vnew :: (Vector v a) => (forall mv m. (MVector mv m a) => m (mv a)) -> v a vlength :: (Vector v a) => v a -> Int unsafeSlice :: (Vector v a) => v a -> Int -> Int -> v a unsafeIndexM :: (Vector v a, Monad m) => v a -> Int -> m a length :: (Vector v a) => v a -> Int null :: (Vector v a) => v a -> Bool -- | Empty vector empty :: (Vector v a) => v a -- | Vector with exaclty one element singleton :: (Vector v a) => a -> v a -- | Prepend an element cons :: (Vector v a) => a -> v a -> v a -- | Append an element snoc :: (Vector v a) => v a -> a -> v a -- | Vector of the given length with the given value in each position replicate :: (Vector v a) => Int -> a -> v a -- | Concatenate two vectors (++) :: (Vector v a) => v a -> v a -> v a -- | Create a copy of a vector. Useful when dealing with slices. copy :: (Vector v a) => v a -> v a -- | Indexing (!) :: (Vector v a) => v a -> Int -> a -- | First element head :: (Vector v a) => v a -> a -- | Last element last :: (Vector v a) => v a -> a -- | Monadic indexing which can be strict in the vector while remaining -- lazy in the element. indexM :: (Vector v a, Monad m) => v a -> Int -> m a headM :: (Vector v a, Monad m) => v a -> m a lastM :: (Vector v a, Monad m) => v a -> m a -- | Yield a part of the vector without copying it. Safer version of -- unsafeSlice. slice :: (Vector v a) => v a -> Int -> Int -> v a -- | Yield all but the last element without copying. init :: (Vector v a) => v a -> v a -- | All but the first element (without copying). tail :: (Vector v a) => v a -> v a -- | Yield the first n elements without copying. take :: (Vector v a) => Int -> v a -> v a -- | Yield all but the first n elements without copying. drop :: (Vector v a) => Int -> v a -> v a accum :: (Vector v a) => (a -> b -> a) -> v a -> [(Int, b)] -> v a (//) :: (Vector v a) => v a -> [(Int, a)] -> v a update :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a) -> v a backpermute :: (Vector v a, Vector v Int) => v a -> v Int -> v a reverse :: (Vector v a) => v a -> v a -- | Map a function over a vector map :: (Vector v a, Vector v b) => (a -> b) -> v a -> v b concatMap :: (Vector v a, Vector v b) => (a -> v b) -> v a -> v b -- | Zip two vectors with the given function. zipWith :: (Vector v a, Vector v b, Vector v c) => (a -> b -> c) -> v a -> v b -> v c -- | Zip three vectors with the given function. zipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (a -> b -> c -> d) -> v a -> v b -> v c -> v d zip :: (Vector v a, Vector v b, Vector v (a, b)) => v a -> v b -> v (a, b) zip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => v a -> v b -> v c -> v (a, b, c) unzip :: (Vector v a, Vector v b, Vector v (a, b)) => v (a, b) -> (v a, v b) unzip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => v (a, b, c) -> (v a, v b, v c) eq :: (Vector v a, Eq a) => v a -> v a -> Bool cmp :: (Vector v a, Ord a) => v a -> v a -> Ordering -- | Drop elements which do not satisfy the predicate filter :: (Vector v a) => (a -> Bool) -> v a -> v a -- | Yield the longest prefix of elements satisfying the predicate. takeWhile :: (Vector v a) => (a -> Bool) -> v a -> v a -- | Drop the longest prefix of elements that satisfy the predicate. dropWhile :: (Vector v a) => (a -> Bool) -> v a -> v a -- | Check whether the vector contains an element elem :: (Vector v a, Eq a) => a -> v a -> Bool -- | Inverse of elem notElem :: (Vector v a, Eq a) => a -> v a -> Bool -- | Yield Just the first element matching the predicate or -- Nothing if no such element exists. find :: (Vector 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 :: (Vector v a) => (a -> Bool) -> v a -> Maybe Int -- | Left fold foldl :: (Vector v b) => (a -> b -> a) -> a -> v b -> a -- | Lefgt fold on non-empty vectors foldl1 :: (Vector v a) => (a -> a -> a) -> v a -> a -- | Left fold with strict accumulator foldl' :: (Vector v b) => (a -> b -> a) -> a -> v b -> a -- | Left fold on non-empty vectors with strict accumulator foldl1' :: (Vector v a) => (a -> a -> a) -> v a -> a -- | Right fold foldr :: (Vector v a) => (a -> b -> b) -> b -> v a -> b -- | Right fold on non-empty vectors foldr1 :: (Vector v a) => (a -> a -> a) -> v a -> a and :: (Vector v Bool) => v Bool -> Bool or :: (Vector v Bool) => v Bool -> Bool sum :: (Vector v a, Num a) => v a -> a product :: (Vector v a, Num a) => v a -> a maximum :: (Vector v a, Ord a) => v a -> a minimum :: (Vector v a, Ord a) => v a -> a unfoldr :: (Vector v a) => (b -> Maybe (a, b)) -> b -> v a -- | Prefix scan prescanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a -- | Prefix scan with strict accumulator prescanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a -- | Suffix scan postscanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a -- | Suffix scan with strict accumulator postscanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a -- | Haskell-style scan scanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a -- | Haskell-style scan with strict accumulator scanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a -- | Scan over a non-empty vector scanl1 :: (Vector v a) => (a -> a -> a) -> v a -> v a -- | Scan over a non-empty vector with a strict accumulator scanl1' :: (Vector v a) => (a -> a -> a) -> v a -> v a enumFromTo :: (Vector v a, Enum a) => a -> a -> v a enumFromThenTo :: (Vector v a, Enum a) => a -> a -> a -> v a -- | Convert a vector to a list toList :: (Vector v a) => v a -> [a] -- | Convert a list to a vector fromList :: (Vector v a) => [a] -> v a -- | Convert a vector to a Stream stream :: (Vector v a) => v a -> Stream a -- | Create a vector from a Stream unstream :: (Vector v a) => Stream a -> v a -- | Construct a pure vector from a monadic initialiser new :: (Vector v a) => New a -> v a -- | Boxed vectors module Data.Vector data Vector a -- | Mutable boxed vectors keyed on the monad they live in (IO or -- ST s). data MVector m 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 -- | Suffix scan postscanl :: (a -> b -> a) -> a -> Vector b -> Vector a -- | Suffix scan with strict accumulator postscanl' :: (a -> b -> a) -> a -> Vector b -> Vector a -- | Haskell-style scan scanl :: (a -> b -> a) -> a -> Vector b -> Vector a -- | Haskell-style scan with strict accumulator scanl' :: (a -> b -> a) -> a -> Vector b -> Vector a -- | Scan over a non-empty Vector scanl1 :: (a -> a -> a) -> Vector a -> Vector a -- | Scan over a non-empty Vector with a strict accumulator scanl1' :: (a -> a -> a) -> Vector a -> 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 Vector Vector a instance (Show a) => Show (Vector a) -- | Unboxed vectors of primitive types. module Data.Vector.Primitive -- | Unboxed vectors of primitive types data Vector a -- | Mutable unboxed vectors. They live in the ST monad. data MVector m a MVector :: !!Int -> !!Int -> !!MutableByteArray m -> MVector m a length :: (Prim a) => Vector a -> Int null :: (Prim a) => Vector a -> Bool -- | Empty vector empty :: (Prim a) => Vector a -- | Vector with exaclty one element singleton :: (Prim a) => a -> Vector a -- | Prepend an element cons :: (Prim a) => a -> Vector a -> Vector a -- | Append an element snoc :: (Prim a) => Vector a -> a -> Vector a -- | Vector of the given length with the given value in each position replicate :: (Prim a) => Int -> a -> Vector a -- | Concatenate two vectors (++) :: (Prim a) => Vector a -> Vector a -> Vector a -- | Create a copy of a vector. Useful when dealing with slices. copy :: (Prim a) => Vector a -> Vector a -- | Indexing (!) :: (Prim a) => Vector a -> Int -> a -- | First element head :: (Prim a) => Vector a -> a -- | Last element last :: (Prim a) => Vector a -> a -- | Yield a part of the vector without copying it. Safer version of -- unsafeSlice. slice :: (Prim a) => Vector a -> Int -> Int -> Vector a -- | Yield all but the last element without copying. init :: (Prim a) => Vector a -> Vector a -- | All but the first element (without copying). tail :: (Prim a) => Vector a -> Vector a -- | Yield the first n elements without copying. take :: (Prim a) => Int -> Vector a -> Vector a -- | Yield all but the first n elements without copying. drop :: (Prim a) => Int -> Vector a -> Vector a accum :: (Prim a) => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a (//) :: (Prim a) => Vector a -> [(Int, a)] -> Vector a backpermute :: (Prim a) => Vector a -> Vector Int -> Vector a reverse :: (Prim a) => Vector a -> Vector a -- | Map a function over a vector map :: (Prim a, Prim b) => (a -> b) -> Vector a -> Vector b concatMap :: (Prim a, Prim b) => (a -> Vector b) -> Vector a -> Vector b -- | Zip two vectors with the given function. zipWith :: (Prim a, Prim b, Prim c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c -- | Zip three vectors with the given function. zipWith3 :: (Prim a, Prim b, Prim c, Prim d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d -- | Drop elements which do not satisfy the predicate filter :: (Prim a) => (a -> Bool) -> Vector a -> Vector a -- | Yield the longest prefix of elements satisfying the predicate. takeWhile :: (Prim a) => (a -> Bool) -> Vector a -> Vector a -- | Drop the longest prefix of elements that satisfy the predicate. dropWhile :: (Prim a) => (a -> Bool) -> Vector a -> Vector a -- | Check whether the vector contains an element elem :: (Prim a, Eq a) => a -> Vector a -> Bool -- | Inverse of elem notElem :: (Prim a, Eq a) => a -> Vector a -> Bool -- | Yield Just the first element matching the predicate or -- Nothing if no such element exists. find :: (Prim 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 :: (Prim a) => (a -> Bool) -> Vector a -> Maybe Int -- | Left fold foldl :: (Prim b) => (a -> b -> a) -> a -> Vector b -> a -- | Lefgt fold on non-empty vectors foldl1 :: (Prim a) => (a -> a -> a) -> Vector a -> a -- | Left fold with strict accumulator foldl' :: (Prim b) => (a -> b -> a) -> a -> Vector b -> a -- | Left fold on non-empty vectors with strict accumulator foldl1' :: (Prim a) => (a -> a -> a) -> Vector a -> a -- | Right fold foldr :: (Prim a) => (a -> b -> b) -> b -> Vector a -> b -- | Right fold on non-empty vectors foldr1 :: (Prim a) => (a -> a -> a) -> Vector a -> a sum :: (Prim a, Num a) => Vector a -> a product :: (Prim a, Num a) => Vector a -> a maximum :: (Prim a, Ord a) => Vector a -> a minimum :: (Prim a, Ord a) => Vector a -> a unfoldr :: (Prim a) => (b -> Maybe (a, b)) -> b -> Vector a -- | Prefix scan prescanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Prefix scan with strict accumulator prescanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Suffix scan postscanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Suffix scan with strict accumulator postscanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Haskell-style scan scanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Haskell-style scan with strict accumulator scanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Scan over a non-empty Vector scanl1 :: (Prim a) => (a -> a -> a) -> Vector a -> Vector a -- | Scan over a non-empty Vector with a strict accumulator scanl1' :: (Prim a) => (a -> a -> a) -> Vector a -> Vector a enumFromTo :: (Prim a, Enum a) => a -> a -> Vector a enumFromThenTo :: (Prim a, Enum a) => a -> a -> a -> Vector a -- | Convert a vector to a list toList :: (Prim a) => Vector a -> [a] -- | Convert a list to a vector fromList :: (Prim a) => [a] -> Vector a instance (Prim a, Ord a) => Ord (Vector a) instance (Prim a, Eq a) => Eq (Vector a) instance (Prim a) => Vector Vector a instance (Show a, Prim a) => Show (Vector a) -- | Storable-based vectors. module Data.Vector.Storable -- | Storable-based vectors data Vector a -- | Mutable Storable-based vectors in the IO monad. data MVector a MVector :: !!Int -> !!Int -> !!ForeignPtr a -> MVector a length :: (Storable a) => Vector a -> Int null :: (Storable a) => Vector a -> Bool -- | Empty vector empty :: (Storable a) => Vector a -- | Vector with exaclty one element singleton :: (Storable a) => a -> Vector a -- | Prepend an element cons :: (Storable a) => a -> Vector a -> Vector a -- | Append an element snoc :: (Storable a) => Vector a -> a -> Vector a -- | Vector of the given length with the given value in each position replicate :: (Storable a) => Int -> a -> Vector a -- | Concatenate two vectors (++) :: (Storable a) => Vector a -> Vector a -> Vector a -- | Create a copy of a vector. Useful when dealing with slices. copy :: (Storable a) => Vector a -> Vector a -- | Indexing (!) :: (Storable a) => Vector a -> Int -> a -- | First element head :: (Storable a) => Vector a -> a -- | Last element last :: (Storable a) => Vector a -> a -- | Yield a part of the vector without copying it. Safer version of -- unsafeSlice. slice :: (Storable a) => Vector a -> Int -> Int -> Vector a -- | Yield all but the last element without copying. init :: (Storable a) => Vector a -> Vector a -- | All but the first element (without copying). tail :: (Storable a) => Vector a -> Vector a -- | Yield the first n elements without copying. take :: (Storable a) => Int -> Vector a -> Vector a -- | Yield all but the first n elements without copying. drop :: (Storable a) => Int -> Vector a -> Vector a accum :: (Storable a) => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a (//) :: (Storable a) => Vector a -> [(Int, a)] -> Vector a backpermute :: (Storable a) => Vector a -> Vector Int -> Vector a reverse :: (Storable a) => Vector a -> Vector a -- | Map a function over a vector map :: (Storable a, Storable b) => (a -> b) -> Vector a -> Vector b concatMap :: (Storable a, Storable b) => (a -> Vector b) -> Vector a -> Vector b -- | Zip two vectors with the given function. zipWith :: (Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c -- | Zip three vectors with the given function. zipWith3 :: (Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d -- | Drop elements which do not satisfy the predicate filter :: (Storable a) => (a -> Bool) -> Vector a -> Vector a -- | Yield the longest prefix of elements satisfying the predicate. takeWhile :: (Storable a) => (a -> Bool) -> Vector a -> Vector a -- | Drop the longest prefix of elements that satisfy the predicate. dropWhile :: (Storable a) => (a -> Bool) -> Vector a -> Vector a -- | Check whether the vector contains an element elem :: (Storable a, Eq a) => a -> Vector a -> Bool -- | Inverse of elem notElem :: (Storable a, Eq a) => a -> Vector a -> Bool -- | Yield Just the first element matching the predicate or -- Nothing if no such element exists. find :: (Storable 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 :: (Storable a) => (a -> Bool) -> Vector a -> Maybe Int -- | Left fold foldl :: (Storable b) => (a -> b -> a) -> a -> Vector b -> a -- | Lefgt fold on non-empty vectors foldl1 :: (Storable a) => (a -> a -> a) -> Vector a -> a -- | Left fold with strict accumulator foldl' :: (Storable b) => (a -> b -> a) -> a -> Vector b -> a -- | Left fold on non-empty vectors with strict accumulator foldl1' :: (Storable a) => (a -> a -> a) -> Vector a -> a -- | Right fold foldr :: (Storable a) => (a -> b -> b) -> b -> Vector a -> b -- | Right fold on non-empty vectors foldr1 :: (Storable a) => (a -> a -> a) -> Vector a -> a and :: Vector Bool -> Bool or :: Vector Bool -> Bool sum :: (Storable a, Num a) => Vector a -> a product :: (Storable a, Num a) => Vector a -> a maximum :: (Storable a, Ord a) => Vector a -> a minimum :: (Storable a, Ord a) => Vector a -> a unfoldr :: (Storable a) => (b -> Maybe (a, b)) -> b -> Vector a -- | Prefix scan prescanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Prefix scan with strict accumulator prescanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Suffix scan postscanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Suffix scan with strict accumulator postscanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Haskell-style scan scanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Haskell-style scan with strict accumulator scanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a -- | Scan over a non-empty Vector scanl1 :: (Storable a) => (a -> a -> a) -> Vector a -> Vector a -- | Scan over a non-empty Vector with a strict accumulator scanl1' :: (Storable a) => (a -> a -> a) -> Vector a -> Vector a enumFromTo :: (Storable a, Enum a) => a -> a -> Vector a enumFromThenTo :: (Storable a, Enum a) => a -> a -> a -> Vector a -- | Convert a vector to a list toList :: (Storable a) => Vector a -> [a] -- | Convert a list to a vector fromList :: (Storable a) => [a] -> Vector a instance (Storable a, Ord a) => Ord (Vector a) instance (Storable a, Eq a) => Eq (Vector a) instance (Storable a) => Vector Vector a instance (Show a, Storable a) => Show (Vector a)