E8V      !"#$%&'()*+,-./0123456789: ; < = > ? @ A B C D E FGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                                            !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone (c) Roman Leshchinskiy 2008-2011 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone<=DRCClass of mutable vectors parametrised with a primitive state token. NLength of the mutable vector. This method should not be called directly, use V instead. gYield a part of the mutable vector without copying it. This method should not be called directly, use  unsafeSlice instead. SCheck whether two vectors overlap. This method should not be called directly, use overlaps instead. ]Create a mutable vector of the given length. This method should not be called directly, use  unsafeNew instead. Initialize a vector to a standard value. This is intended to be called as part of the safe new operation (and similar operations), to properly blank the newly allocated memory if necessary.\Vectors that are necessarily initialized as part of creation may implement this as a no-op.Create a mutable vector of the given length and fill it with an initial value. This method should not be called directly, use W instead.YYield the element at the given position. This method should not be called directly, use  unsafeRead instead.[Replace the element at the given position. This method should not be called directly, use  unsafeWrite instead.Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors. This method should not be called directly, use clear instead.cSet all elements of the vector to the given value. This method should not be called directly, use set instead.`Copy a vector. The two vectors may not overlap. This method should not be called directly, use  unsafeCopy instead.lMove the contents of a vector. The two vectors may overlap. This method should not be called directly, use  unsafeMove instead._Grow a vector by the given number of elements. This method should not be called directly, use  unsafeGrow instead.     (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone :<=DORT gClass of immutable vectors. Every immutable vector is associated with its mutable version through the K type family. Methods of this class should not be used directly. Instead, Data.Vector.GenericB and other Data.Vector modules provide safe and fusible wrappers. Minimum complete implementation:Assumed complexity: O(1)Unsafely convert a mutable vector to its immutable version without copying. The mutable vector may not be used after this operation.Assumed complexity: O(1)Unsafely convert an immutable vector to its mutable version without copying. The immutable vector may not be used after this operation.Assumed complexity: O(1)Yield the length of the vector.Assumed complexity: O(1)OYield a slice of the vector without copying it. No range checks are performed.Assumed complexity: O(1)SYield the element at the given position in a monad. No range checks are performed.IThe monad allows us to be strict in the vector if we want. Suppose we had unsafeIndex :: v a -> Int -> aCinstead. Now, if we wanted to copy a vector, we'd do something like :copy mv v ... = ... unsafeWrite mv i (unsafeIndex v i) ...For lazy vectors, the indexing would not be evaluated which means that we would retain a reference to the original vector in each element we write. This is not what we want!With  , we can do gcopy mv v ... = ... case basicUnsafeIndexM v i of Box x -> unsafeWrite mv i x ...lwhich does not have this problem because indexing (but not the returned element!) is evaluated immediately.Assumed complexity: O(n)pCopy an immutable vector into a mutable one. The two vectors must have the same length but this is not checked. Instances of X should redefine this method if they wish to support an efficient block copy operation.%Default definition: copying basic on  and basicUnsafeWrite. Evaluate a2 as far as storing it in a vector would and yield b. The v a argument only fixes the type and is not touched. The method is only used for optimisation purposes. Thus, it is safe for instances of  to evaluate a^ less than it would be when stored in a vector although this might result in suboptimal code. 2elemseq v x y = (singleton x `asTypeOf` v) `seq` yDefault defintion: a is not evaluated at all Mutable v s a0 is the mutable version of the pure vector type v a with the state token s  (c) Roman Leshchinskiy 2009 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimentalportableSafe Box monad"Identity monad%FDelay inlining a function until late in the game (simplifier phase 0).&X inlined in phase 0 !"#$%&'()*+, !"#$%&"#$ !%&  !"#$%&'()*+, (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimentalportableSafe - Size hint. Exact size/Upper bound on the size0 Unknown size1;Subtract two sizes with clamping to 0, for drop-like things2Minimum of two size hints3Maximum of two size hints4%Convert a size hint to an upper bound5)Compute the minimum size from a size hint65Compute the maximum size from a size hint if possible -./0YZ1234567 -/.0123456 -./0123465 -./0YZ1234567 (c) Roman Leshchinskiy 2009 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNoneB:;<=[\]^_`>a?@bAcdBefCghD :=;<>?@ABCD :;<=>?@ABCD:;<=[\]^_`>a?@bAcdBefCghD\3]2 (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone%&9;<=ADOTWFMonadic streamsH*Result of taking a single step in a streamL Length of a FM Check if a F is emptyNEmpty FO Singleton FP#Replicate a value to a given lengthQYield a FO of values obtained by performing the monadic action the given number of timesS"Generate a stream from its indicesTPrepend an elementUAppend an elementVConcatenate two FsWFirst element of the F or error if emptyXLast element of the F or error if emptyYElement at the given positionZ!Element at the given position or i if out of bounds[GExtract a substream of the given length starting at the given position.\All but the last element]All but the first element^ The first n elements_All but the first n elements`Map a function over a FaMap a monadic function over a Fb1Execute a monadic action for each element of the Fc Transform a F to use a different monadePair each element in a F with its indexfPair each element in a F; with its index, starting from the right and counting downgZip two F!s with the given monadic functionw Check if two F s are equalxLexicographically compare two Fsy0Drop elements which do not satisfy the predicate{8Drop elements which do not satisfy the monadic predicate| Drop repeated adjacent elements.}5Longest prefix of elements that satisfy the predicate~=Longest prefix of elements that satisfy the monadic predicate>Drop the longest prefix of elements that satisfy the predicateFDrop the longest prefix of elements that satisfy the monadic predicateCheck whether the F contains an element Inverse of Yield j3 the first element that satisfies the predicate or i if no such element exists.Yield j< the first element that satisfies the monadic predicate or i if no such element exists.Yield jA the index of the first element that satisfies the predicate or i if no such element exists.Yield jI the index of the first element that satisfies the monadic predicate or i if no such element exists. Left fold!Left fold with a monadic operatorSame as Left fold over a non-empty FLeft fold over a non-empty F with a monadic operatorSame as #Left fold with a strict accumulator:Left fold with a strict accumulator and a monadic operatorSame as Left fold over a non-empty F with a strict accumulatorLeft fold over a non-empty F2 with a strict accumulator and a monadic operatorSame as  Right fold"Right fold with a monadic operator"Right fold over a non-empty stream:Right fold over a non-empty stream with a monadic operator Create a F of values from a F of streamable thingsUnfoldUnfold with a monadic functionUnfold at most n" elements with a monadic functionsJApply monadic function n times to value. Zeroth element is original value.BApply function n times to value. Zeroth element is original value. Prefix scan#Prefix scan with a monadic operator#Prefix scan with strict accumulator:Prefix scan with strict accumulator and a monadic operator Suffix scan#Suffix scan with a monadic operator#Suffix scan with strict accumulator;Suffix scan with strict acccumulator and a monadic operatorHaskell-style scan*Haskell-style scan with a monadic operator*Haskell-style scan with strict accumulatorAHaskell-style scan with strict accumulator and a monadic operatorScan over a non-empty FScan over a non-empty F with a monadic operatorScan over a non-empty F with a strict accumulatorScan over a non-empty F2 with a strict accumulator and a monadic operatorYield a F+ of the given length containing the values x, x+y, x+y+y etc.Enumerate valuesWARNING:B This operation can be very inefficient. If at all possible, use  instead.#Enumerate values with a given step.WARNING:> This operation is very inefficient. If at all possible, use  instead. Convert a F to a listConvert a list to a FConvert the first n elements of a list to a BundleklmnFGHIJKoLMNOPQRSTUVWXYZ[starting indexlength\]^_`apbcdefghijklmnopqrstuvwxyz{|}~qrstuvwuFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~uFGHIJKLMNOTUPQRSVWXYZ[\]^_`abcdefhgijklmnopqrstuvwxy{|z}~zklmnFGHIJKoLMNOPQRSTUVWXYZ[\]^_`apbcdefghijklmnopqrstuvwxyz{|}~qrstuvwV5Y9 Z9 44  (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone%&9;<=ADOTYMonadic streams- hint of a  Attach a - hint to a  Length of a  Check if a  is emptyEmpty  Singleton #Replicate a value to a given lengthYield a O of values obtained by performing the monadic action the given number of times"Generate a stream from its indicesPrepend an elementAppend an elementConcatenate two sFirst element of the  or error if emptyLast element of the  or error if emptyElement at the given position!Element at the given position or i if out of boundsGExtract a substream of the given length starting at the given position.All but the last elementAll but the first element The first n elementsAll but the first n elementsMap a function over a Map a monadic function over a 1Execute a monadic action for each element of the  Transform a  to use a different monadPair each element in a  with its indexPair each element in a ; with its index, starting from the right and counting downZip two !s with the given monadic function Check if two  s are equalLexicographically compare two s0Drop elements which do not satisfy the predicate8Drop elements which do not satisfy the monadic predicate5Longest prefix of elements that satisfy the predicate=Longest prefix of elements that satisfy the monadic predicate>Drop the longest prefix of elements that satisfy the predicateFDrop the longest prefix of elements that satisfy the monadic predicateCheck whether the  contains an element Inverse of Yield j3 the first element that satisfies the predicate or i if no such element exists.Yield j< the first element that satisfies the monadic predicate or i if no such element exists.Yield jA the index of the first element that satisfies the predicate or i if no such element exists.Yield jI the index of the first element that satisfies the monadic predicate or i if no such element exists. Left fold!Left fold with a monadic operatorSame as Left fold over a non-empty Left fold over a non-empty  with a monadic operatorSame as #Left fold with a strict accumulator:Left fold with a strict accumulator and a monadic operatorSame as  Left fold over a non-empty  with a strict accumulator Left fold over a non-empty 2 with a strict accumulator and a monadic operator Same as    Right fold "Right fold with a monadic operator"Right fold over a non-empty stream:Right fold over a non-empty stream with a monadic operator Create a  of values from a  of streamable thingsUnfoldUnfold with a monadic functionUnfold at most n elementsUnfold at most n" elements with a monadic functionsJApply monadic function n times to value. Zeroth element is original value.BApply function n times to value. Zeroth element is original value. Prefix scan#Prefix scan with a monadic operator#Prefix scan with strict accumulator:Prefix scan with strict accumulator and a monadic operator Suffix scan #Suffix scan with a monadic operator!#Suffix scan with strict accumulator";Suffix scan with strict acccumulator and a monadic operator#Haskell-style scan$*Haskell-style scan with a monadic operator%*Haskell-style scan with strict accumulator&AHaskell-style scan with strict accumulator and a monadic operator'Scan over a non-empty (Scan over a non-empty  with a monadic operator)Scan over a non-empty  with a strict accumulator*Scan over a non-empty 2 with a strict accumulator and a monadic operator+Yield a + of the given length containing the values x, x+y, x+y+y etc.,Enumerate valuesWARNING:B This operation can be very inefficient. If at all possible, use + instead.-#Enumerate values with a given step.WARNING:> This operation is very inefficient. If at all possible, use + instead.. Convert a  to a list/Convert a list to a 0Convert the first n elements of a list to a 1Convert a list to a  with the given - hint.starting indexlength      !"#$%&'()*+,xyz{|}~-./0123456|      !"#$%&'()*+,-./012345|      !"#$%&'()*+,-./012534~      !"#$%&'()*+,xyz{|}~-./012345659 9 44  (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone9;OTD7$Alternative name for monadic streams8The type of pure streams:)Convert a pure stream to a monadic stream;- hint of a 8< Attach a - hint to a 8= Length of a 8> Check if a 8 is empty?Empty 8@ Singleton 8A#Replicate a value to a given lengthB"Generate a stream from its indicesCPrepend an elementDAppend an elementEConcatenate two 8sFFirst element of the 8 or error if emptyGLast element of the 8 or error if emptyHElement at the given positionI!Element at the given position or i if out of boundsJGExtract a substream of the given length starting at the given position.KAll but the last elementLAll but the first elementM The first n elementsNAll but the first n elementsOMap a function over a 8RPair each element in a 8 with its indexSPair each element in a 8; with its index, starting from the right and counting downTZip two 8s with the given functionU Zip three 8s with the given function^0Drop elements which do not satisfy the predicate_5Longest prefix of elements that satisfy the predicate`>Drop the longest prefix of elements that satisfy the predicateaCheck whether the 8 contains an elementb Inverse of acYield j- the first element matching the predicate or i if no such element exists.dYield j; the index of the first element matching the predicate or i if no such element exists.e Left foldfLeft fold on non-empty 8sg!Left fold with strict accumulatorhLeft fold on non-empty 8s with strict accumulatori Right foldjRight fold on non-empty 8smUnfoldnUnfold at most n elementsoDApply function n-1 times to value. Zeroth element is original value.p Prefix scanq#Prefix scan with strict accumulatorr Suffix scans#Suffix scan with strict accumulatortHaskell-style scanu*Haskell-style scan with strict accumulatorvScan over a non-empty 8wScan over a non-empty 8 with a strict accumulatorx Check if two 8 s are equalzLexicographically compare two 8s|\Apply a monadic action to each element of the stream, producing a monadic stream of results}4Apply a monadic action to each element of the streamEYield a monadic stream of elements that satisfy the monadic predicate Monadic fold"Monadic fold over non-empty stream$Monadic fold with strict accumulator8Monad fold over non-empty stream with strict accumulatorYield a 8+ of the given length containing the values x, x+y, x+y+y etc.Enumerate valuesWARNING:C This operations can be very inefficient. If at all possible, use  instead.#Enumerate values with a given step.WARNING:? This operations is very inefficient. If at all possible, use  instead. Convert a 8 to a list Create a 8 from a list Create a 8 from the first n elements of a list %fromListN n xs = fromList (take n xs) Create a 8 of values from a 8 of streamable things_789:;<=>?@ABCDEFGHIJstarting indexlengthKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~`HIJK789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~`HIJK879;<=>?@CDABEFGHIJKLMNOQPRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw:|}~xzy{_789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~E5H9 I9 a4b4  (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone :<=DRT$?Create a new mutable vector and fill it with elements from the 8A. The vector will grow exponentially if the maximum size of the 8 is unknown.Create a new mutable vector and fill it with elements from the monadic stream. The vector will grow exponentially if the maximum size of the stream is unknown.?Create a new mutable vector and fill it with elements from the 8A. The vector will grow exponentially if the maximum size of the 8 is unknown.Create a new mutable vector and fill it with elements from the monadic stream. The vector will grow exponentially if the maximum size of the stream is unknown.?Create a new mutable vector and fill it with elements from the 8U from right to left. The vector will grow exponentially if the maximum size of the 8 is unknown.Create a new mutable vector and fill it with elements from the monadic stream from right to left. The vector will grow exponentially if the maximum size of the stream is unknown.Length of the mutable vector.!Check whether the vector is empty6Yield a part of the mutable vector without copying it.WYield a part of the mutable vector without copying it. No bounds checks are performed."Check whether two vectors overlap.,Create a mutable vector of the given length.KCreate a mutable vector of the given length. The memory is not initialized.mCreate a mutable vector of the given length (0 if the length is negative) and fill it with an initial value.Create a mutable vector of the given length (0 if the length is negative) and fill it with values produced by repeatedly executing the monadic action."Create a copy of a mutable vector.LGrow a vector by the given number of elements. The number must be positive.Grow a vector logarithmicallydGrow a vector by the given number of elements. The number must be positive but this is not checked.Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.(Yield the element at the given position.*Replace the element at the given position.)Modify the element at the given position.)Swap the elements at the given positions.DReplace the element at the give position and return the old element.HYield the element at the given position. No bounds checks are performed.JReplace the element at the given position. No bounds checks are performed.IModify the element at the given position. No bounds checks are performed.ISwap the elements at the given positions. No bounds checks are performed.eReplace the element at the give position and return the old element. No bounds checks are performed.2Set all elements of the vector to the given value.NCopy a vector. The two vectors must have the same length and may not overlap.JMove the contents of a vector. The two vectors must have the same length.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.cCopy a vector. The two vectors must have the same length and may not overlap. This is not checked.cMove the contents of a vector. The two vectors must have the same length, but this is not checked.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.~Compute the next (lexicographically) permutation of given vector in-place. Returns False when input is the last permtuationJstarting indexlength of the slicetargetsourcetargetsourcetargetsourceI I J  (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone:<=OT (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone09;<=T#Mutable vectors of primitive types.-offset, length, underlying mutable byte arrayLength of the mutable vector.!Check whether the vector is empty6Yield a part of the mutable vector without copying it.WYield a part of the mutable vector without copying it. No bounds checks are performed."Check whether two vectors overlap.,Create a mutable vector of the given length.KCreate a mutable vector of the given length. The memory is not initialized.mCreate a mutable vector of the given length (0 if the length is negative) and fill it with an initial value.Create a mutable vector of the given length (0 if the length is negative) and fill it with values produced by repeatedly executing the monadic action."Create a copy of a mutable vector.LGrow a vector by the given number of elements. The number must be positive.dGrow a vector by the given number of elements. The number must be positive but this is not checked.Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.(Yield the element at the given position.*Replace the element at the given position.)Modify the element at the given position.)Swap the elements at the given positions.HYield the element at the given position. No bounds checks are performed.JReplace the element at the given position. No bounds checks are performed.IModify the element at the given position. No bounds checks are performed.ISwap the elements at the given positions. No bounds checks are performed.2Set all elements of the vector to the given value.NCopy a vector. The two vectors must have the same length and may not overlap.cCopy a vector. The two vectors must have the same length and may not overlap. This is not checked. JMove the contents of a vector. The two vectors must have the same length.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector. cMove the contents of a vector. The two vectors must have the same length, but this is not checked.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector. ~Compute the next (lexicographically) permutation of given vector in-place. Returns False when input is the last permtuation*starting indexlength of the slicetargetsourcetargetsource  targetsource   )   )   )      (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone 09;<=BT!Mutable -based vectorsLength of the mutable vector.!Check whether the vector is empty6Yield a part of the mutable vector without copying it.WYield a part of the mutable vector without copying it. No bounds checks are performed."Check whether two vectors overlap. ,Create a mutable vector of the given length.!KCreate a mutable vector of the given length. The memory is not initialized."mCreate a mutable vector of the given length (0 if the length is negative) and fill it with an initial value.#Create a mutable vector of the given length (0 if the length is negative) and fill it with values produced by repeatedly executing the monadic action.$"Create a copy of a mutable vector.%LGrow a vector by the given number of elements. The number must be positive.&dGrow a vector by the given number of elements. The number must be positive but this is not checked.'Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.((Yield the element at the given position.)*Replace the element at the given position.*)Modify the element at the given position.+)Swap the elements at the given positions.,HYield the element at the given position. No bounds checks are performed.-JReplace the element at the given position. No bounds checks are performed..IModify the element at the given position. No bounds checks are performed./ISwap the elements at the given positions. No bounds checks are performed.02Set all elements of the vector to the given value.1NCopy a vector. The two vectors must have the same length and may not overlap.2cCopy a vector. The two vectors must have the same length and may not overlap. This is not checked.3JMove the contents of a vector. The two vectors must have the same length.:If the vectors do not overlap, then this is equivalent to 1. Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.4cMove the contents of a vector. The two vectors must have the same length, but this is not checked.:If the vectors do not overlap, then this is equivalent to 2. Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.5O(1) Unsafely cast a mutable vector from one element type to another. The operation just changes the type of the underlying pointer and does not modify the elements.\The resulting vector contains as many elements as can fit into the underlying memory block.6Create a mutable vector from a  with an offset and a length.Modifying data through the T afterwards is unsafe if the vector could have been frozen before the modification.0If your offset is 0 it is more efficient to use 7.7O(1) Create a mutable vector from a  and a length.HIt is assumed the pointer points directly to the data (no offset). Use 6" if you need to specify an offset.Modifying data through the T afterwards is unsafe if the vector could have been frozen before the modification.8Yield the underlying V together with the offset to the data and its length. Modifying the data through the D is unsafe if the vector could have frozen before the modification.9O(1) Yield the underlying  together with its length.CYou can assume the pointer points directly to the data (no offset).Modifying the data through the D is unsafe if the vector could have frozen before the modification.:Pass a pointer to the vector's data to the IO action. Modifying data through the pointer is unsafe if the vector could have been frozen before the modification.3starting indexlength of the slice !"#$%&'()*+,-./01targetsource2targetsource34targetsource56pointeroffsetlength7pointerlength89:;<. !"#$%&'()*+,-./0123456789:. !"#$%&'()*+,-./0132456789:2 !"#$%&'()*+,-./0123456789:;< (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone :<=DORT=O(1) Yield the length of the vector>O(1) Test whether a vector is empty? O(1) Indexing@O(1) Safe indexingAO(1) First elementBO(1) Last elementCO(1)( Unsafe indexing without bounds checkingDO(1)6 First element without checking if the vector is emptyEO(1)5 Last element without checking if the vector is emptyFO(1) Indexing in a monad.xThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i) would not be evaluated which means that mv, would unnecessarily retain a reference to v in each element written.With F/, copying can be implemented like this instead: Scopy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not% the elements) is evaluated eagerly.GO(1)+ First element of a vector in a monad. See F+ for an explanation of why this is useful.HO(1)* Last element of a vector in a monad. See F+ for an explanation of why this is useful.IO(1)0 Indexing in a monad without bounds checks. See F+ for an explanation of why this is useful.JO(1)C First element in a monad without checking for empty vectors. See F* for an explanation of why this is useful.KO(1)B Last element in a monad without checking for empty vectors. See F* for an explanation of why this is useful.LO(1)S Yield a slice of the vector without copying it. The vector must contain at least i+n elements.MO(1)N Yield all but the last element without copying. The vector may not be empty.NO(1)O Yield all but the first element without copying. The vector may not be empty.OO(1) Yield the first n= elements without copying. The vector may contain less than n1 elements in which case it is returned unchanged.PO(1) Yield all but the first n= elements without copying. The vector may contain less than n4 elements in which case an empty vector is returned.QO(1) Yield the first n4 elements paired with the remainder without copying. Note that Q n v is equivalent to (O n v, P n v) but slightly more efficient.RO(1)P Yield a slice of the vector without copying. The vector must contain at least i+n" elements but this is not checked.SO(1)f Yield all but the last element without copying. The vector may not be empty but this is not checked.TO(1)g Yield all but the first element without copying. The vector may not be empty but this is not checked.UO(1) Yield the first n= elements without copying. The vector must contain at least n" elements but this is not checked.VO(1) Yield all but the first n= elements without copying. The vector must contain at least n" elements but this is not checked.WO(1) Empty vectorXO(1) Vector with exactly one elementYO(n)@ Vector of the given length with the same value in each positionZO(n)O Construct a vector of the given length by applying the function to each index[O(n)C Apply function n times to value. Zeroth element is original value.\O(n)l Construct a vector by repeatedly applying the generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements. Uunfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1>]O(n)! Construct a vector with at most nb elements by repeatedly applying the generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements. -unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>^O(n)t Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements._O(n)t Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements.`O(n) Construct a vector with ng elements by repeatedly applying the generator function to the already constructed part of the vector. DconstructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>aO(n) Construct a vector with n{ elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. DconstructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>bO(n): Yield a vector of the given length containing the values x, x+15 etc. This operation is usually more efficient than d. enumFromN 5 3 = <5,6,7>cO(n): Yield a vector of the given length containing the values x, x+y, x+y+y5 etc. This operations is usually more efficient than e. +enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>dO(n) Enumerate values from x to y.WARNING:B This operation can be very inefficient. If at all possible, use b instead.eO(n) Enumerate values from x to y with a specific step z.WARNING:B This operation can be very inefficient. If at all possible, use c instead.fO(n) Prepend an elementgO(n) Append an elementhO(m+n) Concatenate two vectorsiO(n)$ Concatenate all vectors in the listjO(n). Concatenate all vectors in the non-empty listkO(n)Y Execute the monadic action the given number of times and store the results in a vector.lO(n)U Construct a vector of the given length by applying the monadic action to each indexmO(n)K Apply monadic function n times to value. Zeroth element is original value.n;Execute the monadic action and freeze the resulting vector. create (do { v <-  2;  v 0 'a';  v 1 'b'; return v }) = <a,b> o<Execute the monadic action and freeze the resulting vectors.pO(n)Y Yield the argument but force it not to retain any extra memory, possibly by copying it.@This is especially useful when dealing with slices. For example: force (slice 0 2 <huge vector>)Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.qO(m+n) For each pair (i,a)8 from the list, replace the vector element at position i by a. ,<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>rO(m+n) For each pair (i,a)O from the vector of index/value pairs, replace the vector element at position i by a. 0update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>sO(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value aO from the value vector, replace the element of the initial vector at position i by a. .update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>)This function is useful for instances of & that cannot store pairs. Otherwise, r is probably more convenient. update_ xs is ys = r xs ( is ys) t Same as (q) but without bounds checking.uSame as r but without bounds checking.vSame as s but without bounds checking.wO(m+n) For each pair (i,b), from the list, replace the vector element a at position i by f a b. ?accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>xO(m+n) For each pair (i,b)7 from the vector of pairs, replace the vector element a at position i by f a b. Daccumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>yO(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value bT from the the value vector, replace the element of the initial vector at position i by f a b. ?accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>)This function is useful for instances of & that cannot store pairs. Otherwise, x is probably more convenient: accumulate_ f as is bs = x f as ( is bs) zSame as w but without bounds checking.{Same as x but without bounds checking.|Same as y but without bounds checking.}O(n) Reverse a vector~O(n)5 Yield the vector obtained by replacing each element i of the index vector by xs?i. This is equivalent to  (xs?) is# but is often much more efficient. 3backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>Same as ~ but without bounds checking.Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise. modify (\v ->  v 0 'x') (Y 3 'a') = <'x','a','a'> O(n)- Pair each element in a vector with its indexO(n) Map a function over a vectorO(n)< Apply a function to every element of a vector and its index9Map a function over a vector and concatenate the results.O(n)V Apply the monadic action to all elements of the vector, yielding a vector of resultsO(n)c Apply the monadic action to every element of a vector and its index, yielding a vector of resultsO(n)M Apply the monadic action to all elements of a vector and ignore the resultsO(n)[ Apply the monadic action to every element of a vector and its index, ignoring the resultsO(n)f Apply the monadic action to all elements of the vector, yielding a vector of results. Equivalent to flip .O(n)] Apply the monadic action to all elements of a vector and ignore the results. Equivalent to flip . O(min(m,n))) Zip two vectors with the given function.*Zip three vectors with the given function. O(min(m,n))H Zip two vectors with a function that also takes the elements' indices. O(min(m,n)) Zip two vectors O(min(m,n))K Zip the two vectors with the monadic action and yield a vector of results O(min(m,n))k Zip the two vectors with a monadic action that also takes the element index and yield a vector of results O(min(m,n))D Zip the two vectors with the monadic action and ignore the results O(min(m,n))d Zip the two vectors with a monadic action that also takes the element index and ignore the results O(min(m,n)) Unzip a vector of pairs.O(n)0 Drop elements that do not satisfy the predicateO(n)^ Drop elements that do not satisfy the predicate which is applied to values and their indicesO(n)! Drop repeated adjacent elements.O(n)- Drop elements when predicate returns NothingO(n)J Drop elements when predicate, applied to index and value, returns NothingO(n)8 Drop elements that do not satisfy the monadic predicateO(n)P Yield the longest prefix of elements satisfying the predicate without copying.O(n)Q Drop the longest prefix of elements that satisfy the predicate without copying.O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The relative order of the elements is preserved at the cost of a sometimes reduced performance compared to .O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved but the operation is often faster than .O(n)o Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.O(n)v Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying.O(n)( Check if the vector contains an elementO(n)= Check if the vector does not contain an element (inverse of )O(n) Yield j- the first element matching the predicate or i if no such element exists.O(n) Yield j; the index of the first element matching the predicate or i if no such element exists.O(n)L Yield the indices of elements satisfying the predicate in ascending order.O(n) Yield j; the index of the first occurence of the given element or iO if the vector does not contain the element. This is a specialised version of .O(n)p Yield the indices of all occurences of the given element in ascending order. This is a specialised version of .O(n) Left foldO(n) Left fold on non-empty vectorsO(n)" Left fold with strict accumulatorO(n)7 Left fold on non-empty vectors with strict accumulatorO(n) Right foldO(n) Right fold on non-empty vectorsO(n)% Right fold with a strict accumulatorO(n)8 Right fold on non-empty vectors with strict accumulatorO(n); Left fold (function applied to each element and its index)O(n)T Left fold with strict accumulator (function applied to each element and its index)O(n)< Right fold (function applied to each element and its index)O(n)U Right fold with strict accumulator (function applied to each element and its index)O(n)- Check if all elements satisfy the predicate.O(n). Check if any element satisfies the predicate.O(n) Check if all elements are O(n) Check if any element is O(n) Compute the sum of the elementsO(n)$ Compute the produce of the elementsO(n)G Yield the maximum element of the vector. The vector may not be empty.O(n)r Yield the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)G Yield the minimum element of the vector. The vector may not be empty.O(n)r Yield the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the maximum element of the vector. The vector may not be empty.O(n) Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the minimum element of the vector. The vector may not be empty.O(n) Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n) Monadic foldO(n)< Monadic fold (action applied to each element and its index)O(n)$ Monadic fold over non-empty vectorsO(n)% Monadic fold with strict accumulatorO(n)U Monadic fold with strict accumulator (action applied to each element and its index)O(n)< Monadic fold over non-empty vectors with strict accumulatorO(n)& Monadic fold that discards the resultO(n)V Monadic fold that discards the result (action applied to each element and its index)O(n)= Monadic fold over non-empty vectors that discards the resultO(n)> Monadic fold with strict accumulator that discards the resultO(n)n Monadic fold with strict accumulator that discards the result (action applied to each element and its index)O(n)T Monad fold over non-empty vectors with strict accumulator that discards the result,Evaluate each action and collect the results,Evaluate each action and discard the resultsO(n) Prescan prescanl f z = M .  f z  Example: $prescanl (+) 0 <1,2,3,4> = <0,1,3,6>O(n) Prescan with strict accumulatorO(n) Scan postscanl f z = N .  f z  Example: &postscanl (+) 0 <1,2,3,4> = <1,3,6,10>O(n) Scan with strict accumulatorO(n) Haskell-style scan Sscanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) Example: $scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>O(n)+ Haskell-style scan with strict accumulatorO(n)" Scan over a vector with its indexO(n)- Scan over a vector (strictly) with its indexO(n) Scan over a non-empty vector Jscanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xiO(n)7 Scan over a non-empty vector with a strict accumulatorO(n) Right-to-left prescan prescanr f z = } .  (flip f) z . } O(n). Right-to-left prescan with strict accumulatorO(n) Right-to-left scanO(n)+ Right-to-left scan with strict accumulatorO(n)! Right-to-left Haskell-style scanO(n)9 Right-to-left Haskell-style scan with strict accumulatorO(n)0 Right-to-left scan over a vector with its indexO(n); Right-to-left scan over a vector (strictly) with its indexO(n)+ Right-to-left scan over a non-empty vectorO(n)F Right-to-left scan over a non-empty vector with a strict accumulatorO(n) Convert a vector to a listO(n) Convert a list to a vectorO(n) Convert the first n elements of a list to a vector fromListN n xs =  (O n xs) O(n) Convert different vector typesO(1) Unsafe convert a mutable vector to an immutable one without copying. The mutable vector may not be used after this operation.O(n)/ Yield an immutable copy of the mutable vector.O(1) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation.O(n). Yield a mutable copy of the immutable vector.O(n)Y Copy an immutable vector into a mutable one. The two vectors must have the same length.O(n)n Copy an immutable vector into a mutable one. The two vectors must have the same length. This is not checked.O(1) Convert a vector to a 8O(n) Construct a vector from a 8O(1) Convert a vector to a 8, proceeding from right to leftO(n) Construct a vector from a 8, proceeding from right to left.Construct a vector from a monadic initialiser.SConvert a vector to an initialiser which, when run, produces a copy of the vector.O(n)% Check if two vectors are equal. All " instances are also instances of h and it is usually more appropriate to use those. This function is primarily intended for implementing ! instances for new vector types.O(n)O(n), Compare two vectors lexicographically. All " instances are also instances of h and it is usually more appropriate to use those. This function is primarily intended for implementing ! instances for new vector types.O(n)Generic definition of Generic definition of  Note: uses  Generic definion of  that views a  as a list.=>?@ABCDEFGHIJKLi starting indexn lengthMNOPQRi starting indexn lengthSTUVWXYZ[\]^_`abcdefghijklmnopqinitial vector (of length m)%list of index/value pairs (of length n)rinitial vector (of length m)'vector of index/value pairs (of length n)sinitial vector (of length m)index vector (of length n1)value vector (of length n2)tuvwaccumulating function finitial vector (of length m)%list of index/value pairs (of length n)xaccumulating function finitial vector (of length m)'vector of index/value pairs (of length n)yaccumulating function finitial vector (of length m)index vector (of length n1)value vector (of length n2)z{|}~xs value vectoris index vector (of length n)    =>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    =>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[klmno\]^_`abcdefghijpqrstuvwxyz{|}~    =>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    ?9 @9 h544 (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone 09;<=DORT "Unboxed vectors of primitive types%offset, length, underlying byte arrayO(1) Yield the length of the vectorO(1) Test whether a vector is empty O(1) IndexingO(1) Safe indexingO(1) First elementO(1) Last elementO(1)( Unsafe indexing without bounds checkingO(1)6 First element without checking if the vector is emptyO(1)5 Last element without checking if the vector is emptyO(1) Indexing in a monad.xThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i) would not be evaluated which means that mv, would unnecessarily retain a reference to v in each element written.With /, copying can be implemented like this instead: Scopy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not% the elements) is evaluated eagerly.O(1)+ First element of a vector in a monad. See + for an explanation of why this is useful.O(1)* Last element of a vector in a monad. See + for an explanation of why this is useful.O(1)0 Indexing in a monad without bounds checks. See + for an explanation of why this is useful.O(1)C First element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)B Last element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)S Yield a slice of the vector without copying it. The vector must contain at least i+n elements.O(1)N Yield all but the last element without copying. The vector may not be empty. O(1)O Yield all but the first element without copying. The vector may not be empty.!O(1) Yield at the first n= elements without copying. The vector may contain less than n1 elements in which case it is returned unchanged."O(1) Yield all but the first n= elements without copying. The vector may contain less than n4 elements in which case an empty vector is returned.#O(1) Yield the first n4 elements paired with the remainder without copying. Note that # n v is equivalent to (! n v, " n v) but slightly more efficient.$O(1)P Yield a slice of the vector without copying. The vector must contain at least i+n" elements but this is not checked.%O(1)f Yield all but the last element without copying. The vector may not be empty but this is not checked.&O(1)g Yield all but the first element without copying. The vector may not be empty but this is not checked.'O(1) Yield the first n= elements without copying. The vector must contain at least n" elements but this is not checked.(O(1) Yield all but the first n= elements without copying. The vector must contain at least n" elements but this is not checked.)O(1) Empty vector*O(1) Vector with exactly one element+O(n)@ Vector of the given length with the same value in each position,O(n)O Construct a vector of the given length by applying the function to each index-O(n)C Apply function n times to value. Zeroth element is original value..O(n)l Construct a vector by repeatedly applying the generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements. Uunfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1>/O(n)! Construct a vector with at most nb elements by repeatedly applying the generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements. -unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>0O(n)t Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements.1O(n)t Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements.2O(n) Construct a vector with ng elements by repeatedly applying the generator function to the already constructed part of the vector. DconstructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>3O(n) Construct a vector with n{ elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. DconstructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>4O(n): Yield a vector of the given length containing the values x, x+15 etc. This operation is usually more efficient than 6. enumFromN 5 3 = <5,6,7>5O(n): Yield a vector of the given length containing the values x, x+y, x+y+y5 etc. This operations is usually more efficient than 7. +enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>6O(n) Enumerate values from x to y.WARNING:B This operation can be very inefficient. If at all possible, use 4 instead.7O(n) Enumerate values from x to y with a specific step z.WARNING:B This operation can be very inefficient. If at all possible, use 5 instead.8O(n) Prepend an element9O(n) Append an element:O(m+n) Concatenate two vectors;O(n)$ Concatenate all vectors in the list<O(n)Y Execute the monadic action the given number of times and store the results in a vector.=O(n)U Construct a vector of the given length by applying the monadic action to each index>O(n)K Apply monadic function n times to value. Zeroth element is original value.?;Execute the monadic action and freeze the resulting vector. Fcreate (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b> @<Execute the monadic action and freeze the resulting vectors.AO(n)Y Yield the argument but force it not to retain any extra memory, possibly by copying it.@This is especially useful when dealing with slices. For example: force (slice 0 2 <huge vector>)Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.BO(m+n) For each pair (i,a)8 from the list, replace the vector element at position i by a. ,<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>CO(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value aO from the value vector, replace the element of the initial vector at position i by a. .update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7>D Same as (B) but without bounds checking.ESame as C but without bounds checking.FO(m+n) For each pair (i,b), from the list, replace the vector element a at position i by f a b. ?accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>GO(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value bT from the the value vector, replace the element of the initial vector at position i by f a b. ?accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>HSame as F but without bounds checking.ISame as G but without bounds checking.JO(n) Reverse a vectorKO(n)5 Yield the vector obtained by replacing each element i of the index vector by xsi. This is equivalent to N (xs) is# but is often much more efficient. 3backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>LSame as K but without bounds checking.MApply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise. modify (\v -> write v 0 'x') (+ 3 'a') = <'x','a','a'> NO(n) Map a function over a vectorOO(n)< Apply a function to every element of a vector and its indexP9Map a function over a vector and concatenate the results.QO(n)V Apply the monadic action to all elements of the vector, yielding a vector of resultsRO(n)M Apply the monadic action to all elements of a vector and ignore the resultsSO(n)f Apply the monadic action to all elements of the vector, yielding a vector of results. Equivalent to flip Q.TO(n)] Apply the monadic action to all elements of a vector and ignore the results. Equivalent to flip R.U O(min(m,n))) Zip two vectors with the given function.V*Zip three vectors with the given function.Z O(min(m,n))H Zip two vectors with a function that also takes the elements' indices.[<Zip three vectors and their indices with the given function._ O(min(m,n))K Zip the two vectors with the monadic action and yield a vector of results` O(min(m,n))D Zip the two vectors with the monadic action and ignore the resultsaO(n)0 Drop elements that do not satisfy the predicatebO(n)^ Drop elements that do not satisfy the predicate which is applied to values and their indicescO(n)! Drop repeated adjacent elements.dO(n)- Drop elements when predicate returns NothingeO(n)J Drop elements when predicate, applied to index and value, returns NothingfO(n)8 Drop elements that do not satisfy the monadic predicategO(n)P Yield the longest prefix of elements satisfying the predicate without copying.hO(n)Q Drop the longest prefix of elements that satisfy the predicate without copying.iO(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The relative order of the elements is preserved at the cost of a sometimes reduced performance compared to j.jO(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved but the operation is often faster than i.kO(n)o Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.lO(n)v Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying.mO(n)( Check if the vector contains an elementnO(n)= Check if the vector does not contain an element (inverse of m)oO(n) Yield j- the first element matching the predicate or i if no such element exists.pO(n) Yield j; the index of the first element matching the predicate or i if no such element exists.qO(n)L Yield the indices of elements satisfying the predicate in ascending order.rO(n) Yield j; the index of the first occurence of the given element or iO if the vector does not contain the element. This is a specialised version of p.sO(n)p Yield the indices of all occurences of the given element in ascending order. This is a specialised version of q.tO(n) Left folduO(n) Left fold on non-empty vectorsvO(n)" Left fold with strict accumulatorwO(n)7 Left fold on non-empty vectors with strict accumulatorxO(n) Right foldyO(n) Right fold on non-empty vectorszO(n)% Right fold with a strict accumulator{O(n)8 Right fold on non-empty vectors with strict accumulator|O(n); Left fold (function applied to each element and its index)}O(n)T Left fold with strict accumulator (function applied to each element and its index)~O(n)< Right fold (function applied to each element and its index)O(n)U Right fold with strict accumulator (function applied to each element and its index)O(n)- Check if all elements satisfy the predicate.O(n). Check if any element satisfies the predicate.O(n) Compute the sum of the elementsO(n)$ Compute the produce of the elementsO(n)G Yield the maximum element of the vector. The vector may not be empty.O(n)r Yield the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)G Yield the minimum element of the vector. The vector may not be empty.O(n)r Yield the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the maximum element of the vector. The vector may not be empty.O(n) Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the minimum element of the vector. The vector may not be empty.O(n) Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n) Monadic foldO(n)$ Monadic fold over non-empty vectorsO(n)% Monadic fold with strict accumulatorO(n)< Monadic fold over non-empty vectors with strict accumulatorO(n)& Monadic fold that discards the resultO(n)= Monadic fold over non-empty vectors that discards the resultO(n)> Monadic fold with strict accumulator that discards the resultO(n)V Monadic fold over non-empty vectors with strict accumulator that discards the resultO(n) Prescan prescanl f z =  .  f z  Example: $prescanl (+) 0 <1,2,3,4> = <0,1,3,6>O(n) Prescan with strict accumulatorO(n) Scan postscanl f z =   .  f z  Example: &postscanl (+) 0 <1,2,3,4> = <1,3,6,10>O(n) Scan with strict accumulatorO(n) Haskell-style scan Sscanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) Example: $scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>O(n)+ Haskell-style scan with strict accumulatorO(n) Scan over a non-empty vector Jscanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xiO(n)7 Scan over a non-empty vector with a strict accumulatorO(n) Right-to-left prescan prescanr f z = J .  (flip f) z . J O(n). Right-to-left prescan with strict accumulatorO(n) Right-to-left scanO(n)+ Right-to-left scan with strict accumulatorO(n)! Right-to-left Haskell-style scanO(n)9 Right-to-left Haskell-style scan with strict accumulatorO(n)+ Right-to-left scan over a non-empty vectorO(n)F Right-to-left scan over a non-empty vector with a strict accumulatorO(n) Convert a vector to a listO(n) Convert a list to a vectorO(n) Convert the first n elements of a list to a vector fromListN n xs =  (! n xs) O(1) Unsafe convert a mutable vector to an immutable one without copying. The mutable vector may not be used after this operation.O(1) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation.O(n). Yield a mutable copy of the immutable vector.O(n)/ Yield an immutable copy of the mutable vector.O(n)n Copy an immutable vector into a mutable one. The two vectors must have the same length. This is not checked.O(n)Y Copy an immutable vector into a mutable one. The two vectors must have the same length. i starting indexn length !"#$i starting indexn length%&'()*+,-./0123456789:;<=>?@ABinitial vector (of length m)%list of index/value pairs (of length n)Cinitial vector (of length m)index vector (of length n1)value vector (of length n2)DEFaccumulating function finitial vector (of length m)%list of index/value pairs (of length n)Gaccumulating function finitial vector (of length m)index vector (of length n1)value vector (of length n2)HIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-<=>?@./0123456789:;ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~:5m4n4 (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone 09;<=DORT-based vectorsO(1) Yield the length of the vectorO(1) Test whether a vector is empty O(1) IndexingO(1) Safe indexingO(1) First elementO(1) Last elementO(1)( Unsafe indexing without bounds checkingO(1)6 First element without checking if the vector is emptyO(1)5 Last element without checking if the vector is emptyO(1) Indexing in a monad.xThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i) would not be evaluated which means that mv, would unnecessarily retain a reference to v in each element written.With /, copying can be implemented like this instead: Scopy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not% the elements) is evaluated eagerly.O(1)+ First element of a vector in a monad. See + for an explanation of why this is useful.O(1)* Last element of a vector in a monad. See + for an explanation of why this is useful.O(1)0 Indexing in a monad without bounds checks. See + for an explanation of why this is useful.O(1)C First element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)B Last element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)S Yield a slice of the vector without copying it. The vector must contain at least i+n elements.O(1)N Yield all but the last element without copying. The vector may not be empty.O(1)O Yield all but the first element without copying. The vector may not be empty.O(1) Yield at the first n= elements without copying. The vector may contain less than n1 elements in which case it is returned unchanged.O(1) Yield all but the first n= elements without copying. The vector may contain less than n4 elements in which case an empty vector is returned.O(1) Yield the first n4 elements paired with the remainder without copying. Note that  n v is equivalent to ( n v,  n v) but slightly more efficient.O(1)P Yield a slice of the vector without copying. The vector must contain at least i+n" elements but this is not checked.O(1)f Yield all but the last element without copying. The vector may not be empty but this is not checked.O(1)g Yield all but the first element without copying. The vector may not be empty but this is not checked.O(1) Yield the first n= elements without copying. The vector must contain at least n" elements but this is not checked.O(1) Yield all but the first n= elements without copying. The vector must contain at least n" elements but this is not checked.O(1) Empty vectorO(1) Vector with exactly one elementO(n)@ Vector of the given length with the same value in each positionO(n)O Construct a vector of the given length by applying the function to each indexO(n)C Apply function n times to value. Zeroth element is original value.O(n)l Construct a vector by repeatedly applying the generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements. Uunfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1>O(n)! Construct a vector with at most nb elements by repeatedly applying the generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements. -unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>O(n)t Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements.O(n)t Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements.O(n) Construct a vector with ng elements by repeatedly applying the generator function to the already constructed part of the vector. DconstructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>O(n) Construct a vector with n{ elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. DconstructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>O(n): Yield a vector of the given length containing the values x, x+15 etc. This operation is usually more efficient than . enumFromN 5 3 = <5,6,7>O(n): Yield a vector of the given length containing the values x, x+y, x+y+y5 etc. This operations is usually more efficient than . +enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>O(n) Enumerate values from x to y.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Enumerate values from x to y with a specific step z.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Prepend an elementO(n) Append an elementO(m+n) Concatenate two vectorsO(n)$ Concatenate all vectors in the listO(n)Y Execute the monadic action the given number of times and store the results in a vector.O(n)U Construct a vector of the given length by applying the monadic action to each indexO(n)K Apply monadic function n times to value. Zeroth element is original value.;Execute the monadic action and freeze the resulting vector. Fcreate (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b> <Execute the monadic action and freeze the resulting vectors.O(n)Y Yield the argument but force it not to retain any extra memory, possibly by copying it.@This is especially useful when dealing with slices. For example: force (slice 0 2 <huge vector>)Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.O(m+n) For each pair (i,a)8 from the list, replace the vector element at position i by a. ,<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value aO from the value vector, replace the element of the initial vector at position i by a. .update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7> Same as () but without bounds checking.Same as  but without bounds checking.O(m+n) For each pair (i,b), from the list, replace the vector element a at position i by f a b. ?accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value bT from the the value vector, replace the element of the initial vector at position i by f a b. ?accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>Same as  but without bounds checking.Same as  but without bounds checking.O(n) Reverse a vectorO(n)5 Yield the vector obtained by replacing each element i of the index vector by xsi. This is equivalent to  (xs) is# but is often much more efficient. 3backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>Same as  but without bounds checking.Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise. modify (\v -> write v 0 'x') ( 3 'a') = <'x','a','a'> O(n) Map a function over a vectorO(n)< Apply a function to every element of a vector and its index9Map a function over a vector and concatenate the results.O(n)V Apply the monadic action to all elements of the vector, yielding a vector of resultsO(n)M Apply the monadic action to all elements of a vector and ignore the resultsO(n)f Apply the monadic action to all elements of the vector, yielding a vector of results. Equivalent to flip .O(n)] Apply the monadic action to all elements of a vector and ignore the results. Equivalent to flip . O(min(m,n))) Zip two vectors with the given function.*Zip three vectors with the given function. O(min(m,n))H Zip two vectors with a function that also takes the elements' indices.<Zip three vectors and their indices with the given function. O(min(m,n))K Zip the two vectors with the monadic action and yield a vector of results  O(min(m,n))D Zip the two vectors with the monadic action and ignore the results O(n)0 Drop elements that do not satisfy the predicate O(n)^ Drop elements that do not satisfy the predicate which is applied to values and their indices O(n)! Drop repeated adjacent elements. O(n)- Drop elements when predicate returns NothingO(n)J Drop elements when predicate, applied to index and value, returns NothingO(n)8 Drop elements that do not satisfy the monadic predicateO(n)P Yield the longest prefix of elements satisfying the predicate without copying.O(n)Q Drop the longest prefix of elements that satisfy the predicate without copying.O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The relative order of the elements is preserved at the cost of a sometimes reduced performance compared to .O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved but the operation is often faster than .O(n)o Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.O(n)v Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying.O(n)( Check if the vector contains an elementO(n)= Check if the vector does not contain an element (inverse of )O(n) Yield j- the first element matching the predicate or i if no such element exists.O(n) Yield j; the index of the first element matching the predicate or i if no such element exists.O(n)L Yield the indices of elements satisfying the predicate in ascending order.O(n) Yield j; the index of the first occurence of the given element or iO if the vector does not contain the element. This is a specialised version of .O(n)p Yield the indices of all occurences of the given element in ascending order. This is a specialised version of .O(n) Left foldO(n) Left fold on non-empty vectorsO(n)" Left fold with strict accumulator O(n)7 Left fold on non-empty vectors with strict accumulator!O(n) Right fold"O(n) Right fold on non-empty vectors#O(n)% Right fold with a strict accumulator$O(n)8 Right fold on non-empty vectors with strict accumulator%O(n); Left fold (function applied to each element and its index)&O(n)T Left fold with strict accumulator (function applied to each element and its index)'O(n)< Right fold (function applied to each element and its index)(O(n)U Right fold with strict accumulator (function applied to each element and its index))O(n)- Check if all elements satisfy the predicate.*O(n). Check if any element satisfies the predicate.+O(n) Check if all elements are ,O(n) Check if any element is -O(n) Compute the sum of the elements.O(n)$ Compute the produce of the elements/O(n)G Yield the maximum element of the vector. The vector may not be empty.0O(n)r Yield the maximum element of the vector according to the given comparison function. The vector may not be empty.1O(n)G Yield the minimum element of the vector. The vector may not be empty.2O(n)r Yield the minimum element of the vector according to the given comparison function. The vector may not be empty.3O(n)T Yield the index of the maximum element of the vector. The vector may not be empty.4O(n) Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty.5O(n)T Yield the index of the minimum element of the vector. The vector may not be empty.6O(n) Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty.7O(n) Monadic fold8O(n)$ Monadic fold over non-empty vectors9O(n)% Monadic fold with strict accumulator:O(n)< Monadic fold over non-empty vectors with strict accumulator;O(n)& Monadic fold that discards the result<O(n)= Monadic fold over non-empty vectors that discards the result=O(n)> Monadic fold with strict accumulator that discards the result>O(n)V Monadic fold over non-empty vectors with strict accumulator that discards the result?O(n) Prescan prescanl f z =  . C f z  Example: $prescanl (+) 0 <1,2,3,4> = <0,1,3,6>@O(n) Prescan with strict accumulatorAO(n) Scan postscanl f z =  . C f z  Example: &postscanl (+) 0 <1,2,3,4> = <1,3,6,10>BO(n) Scan with strict accumulatorCO(n) Haskell-style scan Sscanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) Example: $scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>DO(n)+ Haskell-style scan with strict accumulatorEO(n) Scan over a non-empty vector Jscanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xiFO(n)7 Scan over a non-empty vector with a strict accumulatorGO(n) Right-to-left prescan prescanr f z =  . ? (flip f) z .  HO(n). Right-to-left prescan with strict accumulatorIO(n) Right-to-left scanJO(n)+ Right-to-left scan with strict accumulatorKO(n)! Right-to-left Haskell-style scanLO(n)9 Right-to-left Haskell-style scan with strict accumulatorMO(n)+ Right-to-left scan over a non-empty vectorNO(n)F Right-to-left scan over a non-empty vector with a strict accumulatorOO(n) Convert a vector to a listPO(n) Convert a list to a vectorQO(n) Convert the first n elements of a list to a vector fromListN n xs = P ( n xs) RO(1) Unsafely cast a vector from one element type to another. The operation just changes the type of the underlying pointer and does not modify the elements.\The resulting vector contains as many elements as can fit into the underlying memory block.SO(1) Unsafe convert a mutable vector to an immutable one without copying. The mutable vector may not be used after this operation.TO(1) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation.UO(n). Yield a mutable copy of the immutable vector.VO(n)/ Yield an immutable copy of the mutable vector.WO(n)n Copy an immutable vector into a mutable one. The two vectors must have the same length. This is not checked.XO(n)Y Copy an immutable vector into a mutable one. The two vectors must have the same length.YO(1) Create a vector from a  with an offset and a length.)The data may not be modified through the  afterwards.0If your offset is 0 it is more efficient to use Z.ZO(1) Create a vector from a  and a length.HIt is assumed the pointer points directly to the data (no offset). Use Y" if you need to specify an offset.)The data may not be modified through the  afterwards.[O(1) Yield the underlying ` together with the offset to the data and its length. The data may not be modified through the .\O(1) Yield the underlying  together with its length.CYou can assume the pointer points directly to the data (no offset).)The data may not be modified through the .]ePass a pointer to the vector's data to the IO action. The data may not be modified through the 'Ptr.i starting indexn lengthi starting indexn lengthinitial vector (of length m)%list of index/value pairs (of length n)initial vector (of length m)index vector (of length n1)value vector (of length n2)accumulating function finitial vector (of length m)%list of index/value pairs (of length n)accumulating function finitial vector (of length m)index vector (of length n1)value vector (of length n2)      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYpointeroffsetlengthZpointerlength[\]^_`abcdefg      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]      !"#$%&'()*+,-./0125634798:;=<>?@ABCDEFGHIJKLMNOPQRVUXSTWYZ[\]      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg544 (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone /0:<=DRhijkl      !"#$%&'()*+,-./0123456789:;<=/hijklshijkl      !"#$%&'()*+,-./0123456789:;<= (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone%mLength of the mutable vector.n!Check whether the vector is emptyo6Yield a part of the mutable vector without copying it.uWYield a part of the mutable vector without copying it. No bounds checks are performed.z"Check whether two vectors overlap.{,Create a mutable vector of the given length.|KCreate a mutable vector of the given length. The memory is not initialized.}mCreate a mutable vector of the given length (0 if the length is negative) and fill it with an initial value.~Create a mutable vector of the given length (0 if the length is negative) and fill it with values produced by repeatedly executing the monadic action."Create a copy of a mutable vector.LGrow a vector by the given number of elements. The number must be positive.dGrow a vector by the given number of elements. The number must be positive but this is not checked.Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.(Yield the element at the given position.*Replace the element at the given position.)Modify the element at the given position.)Swap the elements at the given positions.HYield the element at the given position. No bounds checks are performed.JReplace the element at the given position. No bounds checks are performed.IModify the element at the given position. No bounds checks are performed.ISwap the elements at the given positions. No bounds checks are performed.2Set all elements of the vector to the given value.NCopy a vector. The two vectors must have the same length and may not overlap.cCopy a vector. The two vectors must have the same length and may not overlap. This is not checked.JMove the contents of a vector. The two vectors must have the same length.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.cMove the contents of a vector. The two vectors must have the same length, but this is not checked.:If the vectors do not overlap, then this is equivalent to . Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.~Compute the next (lexicographically) permutation of given vector in-place. Returns False when input is the last permtuationO(1) Zip 2 vectorsO(1) Unzip 2 vectorsO(1) Zip 3 vectorsO(1) Unzip 3 vectorsO(1) Zip 4 vectorsO(1) Unzip 4 vectorsO(1) Zip 5 vectorsO(1) Unzip 5 vectorsO(1) Zip 6 vectorsO(1) Unzip 6 vectors.mnopqrstustarting indexlength of the slicevwxyz{|}~targetsourcetargetsourcetargetsourceGhijlmnopqrstuvwxyz{|}~2ljihmnostpqruxyvwz{|}~.mnopqrstuvwxyz{|}~ (c) Roman Leshchinskiy 2009-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNoneDORTO(1) Yield the length of the vectorO(1) Test whether a vector is empty O(1) IndexingO(1) Safe indexingO(1) First elementO(1) Last elementO(1)( Unsafe indexing without bounds checkingO(1)6 First element without checking if the vector is emptyO(1)5 Last element without checking if the vector is emptyO(1) Indexing in a monad.xThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i) would not be evaluated which means that mv, would unnecessarily retain a reference to v in each element written.With /, copying can be implemented like this instead: Scopy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not% the elements) is evaluated eagerly.O(1)+ First element of a vector in a monad. See + for an explanation of why this is useful.O(1)* Last element of a vector in a monad. See + for an explanation of why this is useful.O(1)0 Indexing in a monad without bounds checks. See + for an explanation of why this is useful.O(1)C First element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)B Last element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)S Yield a slice of the vector without copying it. The vector must contain at least i+n elements.O(1)N Yield all but the last element without copying. The vector may not be empty.O(1)O Yield all but the first element without copying. The vector may not be empty.O(1) Yield at the first n= elements without copying. The vector may contain less than n1 elements in which case it is returned unchanged.O(1) Yield all but the first n= elements without copying. The vector may contain less than n4 elements in which case an empty vector is returned.O(1) Yield the first n4 elements paired with the remainder without copying. Note that  n v is equivalent to ( n v,  n v) but slightly more efficient.O(1)P Yield a slice of the vector without copying. The vector must contain at least i+n" elements but this is not checked.O(1)f Yield all but the last element without copying. The vector may not be empty but this is not checked.O(1)g Yield all but the first element without copying. The vector may not be empty but this is not checked.O(1) Yield the first n= elements without copying. The vector must contain at least n" elements but this is not checked.O(1) Yield all but the first n= elements without copying. The vector must contain at least n" elements but this is not checked.O(1) Empty vectorO(1) Vector with exactly one elementO(n)@ Vector of the given length with the same value in each positionO(n)O Construct a vector of the given length by applying the function to each indexO(n)C Apply function n times to value. Zeroth element is original value.O(n)l Construct a vector by repeatedly applying the generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements. Uunfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1>O(n)! Construct a vector with at most nb elements by repeatedly applying the generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements. -unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>O(n)t Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements.O(n)t Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements.O(n) Construct a vector with ng elements by repeatedly applying the generator function to the already constructed part of the vector. DconstructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>O(n) Construct a vector with n{ elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. DconstructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>O(n): Yield a vector of the given length containing the values x, x+15 etc. This operation is usually more efficient than . enumFromN 5 3 = <5,6,7>O(n): Yield a vector of the given length containing the values x, x+y, x+y+y5 etc. This operations is usually more efficient than . +enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>O(n) Enumerate values from x to y.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Enumerate values from x to y with a specific step z.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Prepend an elementO(n) Append an elementO(m+n) Concatenate two vectorsO(n)$ Concatenate all vectors in the listO(n)Y Execute the monadic action the given number of times and store the results in a vector.O(n)U Construct a vector of the given length by applying the monadic action to each indexO(n)K Apply monadic function n times to value. Zeroth element is original value.;Execute the monadic action and freeze the resulting vector. Fcreate (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b> <Execute the monadic action and freeze the resulting vectors.O(n)Y Yield the argument but force it not to retain any extra memory, possibly by copying it.@This is especially useful when dealing with slices. For example: force (slice 0 2 <huge vector>)Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.O(m+n) For each pair (i,a)8 from the list, replace the vector element at position i by a. ,<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>O(m+n) For each pair (i,a)O from the vector of index/value pairs, replace the vector element at position i by a. 0update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value aO from the value vector, replace the element of the initial vector at position i by a. .update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7> The function A provides the same functionality and is usually more convenient. update_ xs is ys =  xs (H is ys)  Same as () but without bounds checking.Same as  but without bounds checking.Same as  but without bounds checking.O(m+n) For each pair (i,b), from the list, replace the vector element a at position i by f a b. ?accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>O(m+n) For each pair (i,b)7 from the vector of pairs, replace the vector element a at position i by f a b. Daccumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value bT from the the value vector, replace the element of the initial vector at position i by f a b. ?accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4> The function A provides the same functionality and is usually more convenient. accumulate_ f as is bs =  f as (H is bs) Same as  but without bounds checking.Same as  but without bounds checking.Same as  but without bounds checking.O(n) Reverse a vectorO(n)5 Yield the vector obtained by replacing each element i of the index vector by xsi. This is equivalent to  (xs) is# but is often much more efficient. 3backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>Same as  but without bounds checking.Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise. modify (\v -> write v 0 'x') ( 3 'a') = <'x','a','a'> O(n)- Pair each element in a vector with its indexO(n) Map a function over a vectorO(n)< Apply a function to every element of a vector and its index9Map a function over a vector and concatenate the results.O(n)V Apply the monadic action to all elements of the vector, yielding a vector of resultsO(n)c Apply the monadic action to every element of a vector and its index, yielding a vector of resultsO(n)M Apply the monadic action to all elements of a vector and ignore the resultsO(n)[ Apply the monadic action to every element of a vector and its index, ignoring the resultsO(n)f Apply the monadic action to all elements of the vector, yielding a vector of results. Equivalent to flip .O(n)] Apply the monadic action to all elements of a vector and ignore the results. Equivalent to flip . O(min(m,n))) Zip two vectors with the given function.*Zip three vectors with the given function. O(min(m,n))H Zip two vectors with a function that also takes the elements' indices.<Zip three vectors and their indices with the given function. O(min(m,n))K Zip the two vectors with the monadic action and yield a vector of results O(min(m,n))k Zip the two vectors with a monadic action that also takes the element index and yield a vector of results O(min(m,n))D Zip the two vectors with the monadic action and ignore the results O(min(m,n))d Zip the two vectors with a monadic action that also takes the element index and ignore the resultsO(n)0 Drop elements that do not satisfy the predicateO(n)! Drop repeated adjacent elements.O(n)^ Drop elements that do not satisfy the predicate which is applied to values and their indicesO(n)- Drop elements when predicate returns NothingO(n)J Drop elements when predicate, applied to index and value, returns NothingO(n)8 Drop elements that do not satisfy the monadic predicateO(n)P Yield the longest prefix of elements satisfying the predicate without copying.O(n)Q Drop the longest prefix of elements that satisfy the predicate without copying.O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The relative order of the elements is preserved at the cost of a sometimes reduced performance compared to .O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved but the operation is often faster than .O(n)o Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.O(n)v Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying.O(n)( Check if the vector contains an elementO(n)= Check if the vector does not contain an element (inverse of )O(n) Yield j- the first element matching the predicate or i if no such element exists.O(n) Yield j; the index of the first element matching the predicate or i if no such element exists.O(n)L Yield the indices of elements satisfying the predicate in ascending order.O(n) Yield j; the index of the first occurence of the given element or iO if the vector does not contain the element. This is a specialised version of .O(n)p Yield the indices of all occurences of the given element in ascending order. This is a specialised version of . O(n) Left fold O(n) Left fold on non-empty vectors O(n)" Left fold with strict accumulator O(n)7 Left fold on non-empty vectors with strict accumulator O(n) Right foldO(n) Right fold on non-empty vectorsO(n)% Right fold with a strict accumulatorO(n)8 Right fold on non-empty vectors with strict accumulatorO(n); Left fold (function applied to each element and its index)O(n)T Left fold with strict accumulator (function applied to each element and its index)O(n)< Right fold (function applied to each element and its index)O(n)U Right fold with strict accumulator (function applied to each element and its index)O(n)- Check if all elements satisfy the predicate.O(n). Check if any element satisfies the predicate.O(n) Check if all elements are O(n) Check if any element is O(n) Compute the sum of the elementsO(n)$ Compute the produce of the elementsO(n)G Yield the maximum element of the vector. The vector may not be empty.O(n)r Yield the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)G Yield the minimum element of the vector. The vector may not be empty.O(n)r Yield the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the maximum element of the vector. The vector may not be empty. O(n) Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty.!O(n)T Yield the index of the minimum element of the vector. The vector may not be empty."O(n) Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty.#O(n) Monadic fold$O(n)< Monadic fold (action applied to each element and its index)%O(n)$ Monadic fold over non-empty vectors&O(n)% Monadic fold with strict accumulator'O(n)U Monadic fold with strict accumulator (action applied to each element and its index)(O(n)< Monadic fold over non-empty vectors with strict accumulator)O(n)& Monadic fold that discards the result*O(n)V Monadic fold that discards the result (action applied to each element and its index)+O(n)= Monadic fold over non-empty vectors that discards the result,O(n)> Monadic fold with strict accumulator that discards the result-O(n)n Monadic fold with strict accumulator that discards the result (action applied to each element and its index).O(n)V Monadic fold over non-empty vectors with strict accumulator that discards the result/O(n) Prescan prescanl f z =  . 3 f z  Example: $prescanl (+) 0 <1,2,3,4> = <0,1,3,6>0O(n) Prescan with strict accumulator1O(n) Scan postscanl f z =  . 3 f z  Example: &postscanl (+) 0 <1,2,3,4> = <1,3,6,10>2O(n) Scan with strict accumulator3O(n) Haskell-style scan Sscanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) Example: $scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>4O(n)+ Haskell-style scan with strict accumulator5O(n) Scan over a non-empty vector Jscanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xi6O(n)7 Scan over a non-empty vector with a strict accumulator7O(n) Right-to-left prescan prescanr f z =  . / (flip f) z .  8O(n). Right-to-left prescan with strict accumulator9O(n) Right-to-left scan:O(n)+ Right-to-left scan with strict accumulator;O(n)! Right-to-left Haskell-style scan<O(n)9 Right-to-left Haskell-style scan with strict accumulator=O(n)+ Right-to-left scan over a non-empty vector>O(n)F Right-to-left scan over a non-empty vector with a strict accumulator?O(n) Convert a vector to a list@O(n) Convert a list to a vectorAO(n) Convert the first n elements of a list to a vector fromListN n xs = @ ( n xs) BO(1) Unsafe convert a mutable vector to an immutable one without copying. The mutable vector may not be used after this operation.CO(1) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation.DO(n). Yield a mutable copy of the immutable vector.EO(n)/ Yield an immutable copy of the mutable vector.FO(n)n Copy an immutable vector into a mutable one. The two vectors must have the same length. This is not checked.GO(n)Y Copy an immutable vector into a mutable one. The two vectors must have the same length.HO(1) Zip 2 vectorsIO(1) Unzip 2 vectorsJO(1) Zip 3 vectorsKO(1) Unzip 3 vectorsLO(1) Zip 4 vectorsMO(1) Unzip 4 vectorsNO(1) Zip 5 vectorsOO(1) Unzip 5 vectorsPO(1) Zip 6 vectorsQO(1) Unzip 6 vectorsi starting indexn lengthi starting indexn lengthinitial vector (of length m)%list of index/value pairs (of length n)initial vector (of length m)'vector of index/value pairs (of length n)initial vector (of length m)index vector (of length n1)value vector (of length n2)accumulating function finitial vector (of length m)%list of index/value pairs (of length n)accumulating function finitial vector (of length m)'vector of index/value pairs (of length n)accumulating function finitial vector (of length m)index vector (of length n1)value vector (of length n2)      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXhkl      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQklhHJLNPIKMOQ     !" #$&'%()*,-+./0123456789:;<=>?@AEDGBCF      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX544 (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone 09;<=DR[7Mutable boxed vectors keyed on the monad they live in (> or ST s).]Length of the mutable vector.^!Check whether the vector is empty_6Yield a part of the mutable vector without copying it.eWYield a part of the mutable vector without copying it. No bounds checks are performed.j"Check whether two vectors overlap.k,Create a mutable vector of the given length.lKCreate a mutable vector of the given length. The memory is not initialized.mmCreate a mutable vector of the given length (0 if the length is negative) and fill it with an initial value.nCreate a mutable vector of the given length (0 if the length is negative) and fill it with values produced by repeatedly executing the monadic action.o"Create a copy of a mutable vector.pLGrow a vector by the given number of elements. The number must be positive.qdGrow a vector by the given number of elements. The number must be positive but this is not checked.rReset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.s(Yield the element at the given position.t*Replace the element at the given position.u)Modify the element at the given position.v)Swap the elements at the given positions.wHYield the element at the given position. No bounds checks are performed.xJReplace the element at the given position. No bounds checks are performed.yIModify the element at the given position. No bounds checks are performed.zISwap the elements at the given positions. No bounds checks are performed.{2Set all elements of the vector to the given value.|NCopy a vector. The two vectors must have the same length and may not overlap.}cCopy a vector. The two vectors must have the same length and may not overlap. This is not checked.~JMove the contents of a vector. The two vectors must have the same length.:If the vectors do not overlap, then this is equivalent to |. Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.cMove the contents of a vector. The two vectors must have the same length, but this is not checked.:If the vectors do not overlap, then this is equivalent to }. Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.~Compute the next (lexicographically) permutation of given vector in-place. Returns False when input is the last permtuation.YZ[\?@ABC]^_`abcdestarting indexlength of the slicefghijklmnopqrstuvwxyz{|}targetsource~targetsource(YZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~([\ZY]^_cd`abehifgjklmnopqrstuvwxyz{|~}-YZ[\?@ABC]^_`abcdefghijklmnopqrstuvwxyz{|}~ (c) Roman Leshchinskiy 2008-2010 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> experimental non-portableNone 09;<=DORT,Boxed vectors, supporting efficient slicing.O(1) Yield the length of the vectorO(1) Test whether a vector is empty O(1) IndexingO(1) Safe indexingO(1) First elementO(1) Last elementO(1)( Unsafe indexing without bounds checkingO(1)6 First element without checking if the vector is emptyO(1)5 Last element without checking if the vector is emptyO(1) Indexing in a monad.xThe monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: &copy mv v = ... write mv i (v ! i) ...For lazy vectors, v ! i) would not be evaluated which means that mv, would unnecessarily retain a reference to v in each element written.With /, copying can be implemented like this instead: Scopy mv v = ... do x <- indexM v i write mv i xHere, no references to v$ are retained because indexing (but not% the elements) is evaluated eagerly.O(1)+ First element of a vector in a monad. See + for an explanation of why this is useful.O(1)* Last element of a vector in a monad. See + for an explanation of why this is useful.O(1)0 Indexing in a monad without bounds checks. See + for an explanation of why this is useful.O(1)C First element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)B Last element in a monad without checking for empty vectors. See * for an explanation of why this is useful.O(1)S Yield a slice of the vector without copying it. The vector must contain at least i+n elements.O(1)N Yield all but the last element without copying. The vector may not be empty.O(1)O Yield all but the first element without copying. The vector may not be empty.O(1) Yield at the first n= elements without copying. The vector may contain less than n1 elements in which case it is returned unchanged.O(1) Yield all but the first n= elements without copying. The vector may contain less than n4 elements in which case an empty vector is returned.O(1) Yield the first n4 elements paired with the remainder without copying. Note that  n v is equivalent to ( n v,  n v) but slightly more efficient.O(1)P Yield a slice of the vector without copying. The vector must contain at least i+n" elements but this is not checked.O(1)f Yield all but the last element without copying. The vector may not be empty but this is not checked.O(1)g Yield all but the first element without copying. The vector may not be empty but this is not checked.O(1) Yield the first n= elements without copying. The vector must contain at least n" elements but this is not checked.O(1) Yield all but the first n= elements without copying. The vector must contain at least n" elements but this is not checked.O(1) Empty vectorO(1) Vector with exactly one elementO(n)@ Vector of the given length with the same value in each positionO(n)O Construct a vector of the given length by applying the function to each indexO(n)C Apply function n times to value. Zeroth element is original value.O(n)l Construct a vector by repeatedly applying the generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements. Uunfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1>O(n)! Construct a vector with at most nb elements by repeatedly applying the generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements. -unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>O(n)t Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements.O(n)t Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields j' the next element and the new seed or i if there are no more elements.O(n) Construct a vector with ng elements by repeatedly applying the generator function to the already constructed part of the vector. DconstructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c>O(n) Construct a vector with n{ elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. DconstructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>O(n): Yield a vector of the given length containing the values x, x+15 etc. This operation is usually more efficient than . enumFromN 5 3 = <5,6,7>O(n): Yield a vector of the given length containing the values x, x+y, x+y+y5 etc. This operations is usually more efficient than . +enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>O(n) Enumerate values from x to y.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Enumerate values from x to y with a specific step z.WARNING:B This operation can be very inefficient. If at all possible, use  instead.O(n) Prepend an elementO(n) Append an elementO(m+n) Concatenate two vectorsO(n)$ Concatenate all vectors in the listO(n)Y Execute the monadic action the given number of times and store the results in a vector.O(n)U Construct a vector of the given length by applying the monadic action to each indexO(n)K Apply monadic function n times to value. Zeroth element is original value.;Execute the monadic action and freeze the resulting vector. Fcreate (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b> <Execute the monadic action and freeze the resulting vectors.O(n)Y Yield the argument but force it not to retain any extra memory, possibly by copying it.@This is especially useful when dealing with slices. For example: force (slice 0 2 <huge vector>)Here, the slice retains a reference to the huge vector. Forcing it creates a copy of just the elements that belong to the slice and allows the huge vector to be garbage collected.O(m+n) For each pair (i,a)8 from the list, replace the vector element at position i by a. ,<5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>O(m+n) For each pair (i,a)O from the vector of index/value pairs, replace the vector element at position i by a. 0update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value aO from the value vector, replace the element of the initial vector at position i by a. .update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7> The function A provides the same functionality and is usually more convenient. update_ xs is ys =  xs ( is ys)  Same as () but without bounds checking.Same as  but without bounds checking.Same as  but without bounds checking.O(m+n) For each pair (i,b), from the list, replace the vector element a at position i by f a b. ?accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>O(m+n) For each pair (i,b)7 from the vector of pairs, replace the vector element a at position i by f a b. Daccumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>O(m+min(n1,n2)) For each index i4 from the index vector and the corresponding value bT from the the value vector, replace the element of the initial vector at position i by f a b. ?accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4> The function A provides the same functionality and is usually more convenient. accumulate_ f as is bs =  f as ( is bs) Same as  but without bounds checking.Same as  but without bounds checking.Same as  but without bounds checking.O(n) Reverse a vectorO(n)5 Yield the vector obtained by replacing each element i of the index vector by xsi. This is equivalent to  (xs) is# but is often much more efficient. 3backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>Same as  but without bounds checking.Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise. modify (\v -> write v 0 'x') ( 3 'a') = <'x','a','a'> O(n)- Pair each element in a vector with its indexO(n) Map a function over a vectorO(n)< Apply a function to every element of a vector and its index9Map a function over a vector and concatenate the results.O(n)V Apply the monadic action to all elements of the vector, yielding a vector of resultsO(n)c Apply the monadic action to every element of a vector and its index, yielding a vector of resultsO(n)M Apply the monadic action to all elements of a vector and ignore the resultsO(n)[ Apply the monadic action to every element of a vector and its index, ignoring the resultsO(n)f Apply the monadic action to all elements of the vector, yielding a vector of results. Equivalent to flip .O(n)] Apply the monadic action to all elements of a vector and ignore the results. Equivalent to flip . O(min(m,n))) Zip two vectors with the given function.*Zip three vectors with the given function. O(min(m,n))H Zip two vectors with a function that also takes the elements' indices.<Zip three vectors and their indices with the given function.&Elementwise pairing of array elements.3zip together three vectors into a vector of triples O(min(m,n)) Unzip a vector of pairs. O(min(m,n))K Zip the two vectors with the monadic action and yield a vector of results O(min(m,n))k Zip the two vectors with a monadic action that also takes the element index and yield a vector of results O(min(m,n))D Zip the two vectors with the monadic action and ignore the results O(min(m,n))d Zip the two vectors with a monadic action that also takes the element index and ignore the resultsO(n)0 Drop elements that do not satisfy the predicateO(n)^ Drop elements that do not satisfy the predicate which is applied to values and their indicesO(n)! Drop repeated adjacent elements.O(n)- Drop elements when predicate returns NothingO(n)J Drop elements when predicate, applied to index and value, returns NothingO(n)8 Drop elements that do not satisfy the monadic predicateO(n)P Yield the longest prefix of elements satisfying the predicate without copying.O(n)Q Drop the longest prefix of elements that satisfy the predicate without copying.O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The relative order of the elements is preserved at the cost of a sometimes reduced performance compared to .O(n) Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved but the operation is often faster than .O(n)o Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.O(n)v Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying.O(n)( Check if the vector contains an elementO(n)= Check if the vector does not contain an element (inverse of )O(n) Yield j- the first element matching the predicate or i if no such element exists.O(n) Yield j; the index of the first element matching the predicate or i if no such element exists.O(n)L Yield the indices of elements satisfying the predicate in ascending order.O(n) Yield j; the index of the first occurence of the given element or iO if the vector does not contain the element. This is a specialised version of .O(n)p Yield the indices of all occurences of the given element in ascending order. This is a specialised version of .O(n) Left foldO(n) Left fold on non-empty vectorsO(n)" Left fold with strict accumulatorO(n)7 Left fold on non-empty vectors with strict accumulatorO(n) Right foldO(n) Right fold on non-empty vectorsO(n)% Right fold with a strict accumulatorO(n)8 Right fold on non-empty vectors with strict accumulatorO(n); Left fold (function applied to each element and its index)O(n)T Left fold with strict accumulator (function applied to each element and its index)O(n)< Right fold (function applied to each element and its index)O(n)U Right fold with strict accumulator (function applied to each element and its index)O(n)- Check if all elements satisfy the predicate.O(n). Check if any element satisfies the predicate. O(n) Check if all elements are  O(n) Check if any element is  O(n) Compute the sum of the elements O(n)$ Compute the produce of the elements O(n)G Yield the maximum element of the vector. The vector may not be empty.O(n)r Yield the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)G Yield the minimum element of the vector. The vector may not be empty.O(n)r Yield the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the maximum element of the vector. The vector may not be empty.O(n) Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty.O(n)T Yield the index of the minimum element of the vector. The vector may not be empty.O(n) Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty.O(n) Monadic foldO(n)< Monadic fold (action applied to each element and its index)O(n)$ Monadic fold over non-empty vectorsO(n)% Monadic fold with strict accumulatorO(n)U Monadic fold with strict accumulator (action applied to each element and its index)O(n)< Monadic fold over non-empty vectors with strict accumulatorO(n)& Monadic fold that discards the resultO(n)V Monadic fold that discards the result (action applied to each element and its index)O(n)= Monadic fold over non-empty vectors that discards the resultO(n)> Monadic fold with strict accumulator that discards the resultO(n)n Monadic fold with strict accumulator that discards the result (action applied to each element and its index) O(n)V Monadic fold over non-empty vectors with strict accumulator that discards the result!,Evaluate each action and collect the results",Evaluate each action and discard the results#O(n) Prescan prescanl f z =  . ' f z  Example: $prescanl (+) 0 <1,2,3,4> = <0,1,3,6>$O(n) Prescan with strict accumulator%O(n) Scan postscanl f z =  . ' f z  Example: &postscanl (+) 0 <1,2,3,4> = <1,3,6,10>&O(n) Scan with strict accumulator'O(n) Haskell-style scan Sscanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) Example: $scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>(O(n)+ Haskell-style scan with strict accumulator)O(n)" Scan over a vector with its index*O(n)- Scan over a vector (strictly) with its index+O(n) Scan over a non-empty vector Jscanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xi,O(n)7 Scan over a non-empty vector with a strict accumulator-O(n) Right-to-left prescan prescanr f z =  . # (flip f) z .  .O(n). Right-to-left prescan with strict accumulator/O(n) Right-to-left scan0O(n)+ Right-to-left scan with strict accumulator1O(n)! Right-to-left Haskell-style scan2O(n)9 Right-to-left Haskell-style scan with strict accumulator3O(n)0 Right-to-left scan over a vector with its index4O(n); Right-to-left scan over a vector (strictly) with its index5O(n)+ Right-to-left scan over a non-empty vector6O(n)F Right-to-left scan over a non-empty vector with a strict accumulator7O(n) Convert a vector to a list8O(n) Convert a list to a vector9O(n) Convert the first n elements of a list to a vector fromListN n xs = 8 ( n xs) :O(1) Unsafe convert a mutable vector to an immutable one without copying. The mutable vector may not be used after this operation.;O(1) Unsafely convert an immutable vector to a mutable one without copying. The immutable vector may not be used after this operation.<O(n). Yield a mutable copy of the immutable vector.=O(n)/ Yield an immutable copy of the mutable vector.>O(n)n Copy an immutable vector into a mutable one. The two vectors must have the same length. This is not checked.?O(n)Y Copy an immutable vector into a mutable one. The two vectors must have the same length.Di starting indexn lengthi starting indexn lengthinitial vector (of length m)%list of index/value pairs (of length n)initial vector (of length m)'vector of index/value pairs (of length n)initial vector (of length m)index vector (of length n1)value vector (of length n2)accumulating function finitial vector (of length m)%list of index/value pairs (of length n)accumulating function finitial vector (of length m)'vector of index/value pairs (of length n)accumulating function finitial vector (of length m)index vector (of length n1)value vector (of length n2)      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU[      !"#$%&'()*+,-./0123456789:;<=>?[      !"#$%&'(+,)*-./0125634789=<?:;>D      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU544E !"#$%&'()*+,-./0123456789*+:4;<==>??@ABCDEFGHIJKLMNOPQRSTU V W X Y Z [ \ ] ^ _ ` abbcdefghijklmnopqrstuvwxyz{|}~     g h i j k l m n o p q r s t u v w x y z { | } ~    g h i j k m o p q r s t u v w x y z {  | } g h v y z w x    k l                               ! ! " # $ %  & v w x y z '())ghvyzwxkl     )*'())ghvyzwxkl    +,-./0)*gh1urs23456789:vwxyzijkm;<=opq>?ln"@ABCDEFGHIJK {L|M}NOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~77gh1urs23456789:vwxyzijkm;<=opq>ln"@ABCDEGIJK {L|}OPQRSTU]^_`abcdefghijklmnopqrstuvy{|~7gh1urs23456789:vwxyzijkm;<=opq>ln"@ABCDEGIJK {L|}OPQRSTU]^_`abcdefghijklmnopqrstuvy{|~+,-./0'(7)ghvyzwxkl     XYZ[\gh1urs23456789:vwxyzijkm;<=opq>ln"@ABCDEFGHIJK {L|M}NOPQRSTUVW]^_`abcdefghijklmnopqrstuvwxyz{|}~XYZ[\'())ghvyzwxkl     )7gh1urs23456789:vwxyzijkm;<=opq>ln"@ABCDEFGHIJK {L|M}NOPQRSTUXYZ[\VW]^_`abcdefghijklmnopqrstuvwxyz{|}~ g k                                         &7      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~*7&vector-0.12.0.0-GWJC6IEV2W1I9Hk21LuTgL!Data.Vector.Fusion.Stream.MonadicData.Vector.Storable.MutableData.Vector.Primitive.MutableData.Vector.Storable.Internal Data.Vector.Generic.Mutable.BaseData.Vector.GenericData.Vector.Fusion.UtilData.Vector.Fusion.Bundle.SizeData.Vector.Internal.Check!Data.Vector.Fusion.Bundle.MonadicData.Vector.Fusion.BundleData.Vector.Generic.MutableData.Vector.Generic.NewData.Vector.PrimitiveData.Vector.StorableData.Vector.Unboxed.MutableData.Vector.UnboxedData.Vector.Mutable Data.VectorData.Vector.Generic.BasePrelude showsPrec Text.ReadreadPrec Data.DatagfoldlData.Vector.Unboxed.Baseghc-prim GHC.TypesSPECSPEC2baseForeign.StorableStorable'primitive-0.6.1.0-Ip44DqhfCp21tTUYbecwaData.Primitive.TypesPrimgetPtrsetPtrupdPtrMVector basicLengthbasicUnsafeSlice basicOverlapsbasicUnsafeNewbasicInitializebasicUnsafeReplicatebasicUnsafeReadbasicUnsafeWrite basicClearbasicSetbasicUnsafeCopybasicUnsafeMovebasicUnsafeGrowVectorbasicUnsafeFreezebasicUnsafeThawbasicUnsafeIndexMelemseqMutableBoxunBoxIdunId delay_inline delayed_min $fMonadBox$fApplicativeBox $fFunctorBox $fMonadId$fApplicativeId $fFunctorIdSizeExactMaxUnknownclampedSubtractsmallerlargertoMax lowerBound upperBound $fNumSize$fEqSize $fShowSizeChecksBoundsUnsafeInternaldoCheckserror internalErrorcheck checkIndex checkLength checkSlice $fEqChecksStreamStepYieldSkipDonelengthnullempty singleton replicate replicateMgenerate generateMconssnoc++headlast!!!?sliceinittailtakedropmapmapMmapM_transunboxindexedindexedRzipWithM zipWithM_ zipWith3M zipWith4M zipWith5M zipWith6MzipWithzipWith3zipWith4zipWith5zipWith6zipzip3zip4zip5zip6eqBycmpByfiltermapMaybefilterMuniq takeWhile takeWhileM dropWhile dropWhileMelemnotElemfindfindM findIndex findIndexMfoldlfoldlMfoldMfoldl1foldl1Mfold1Mfoldl'foldlM'foldM'foldl1'foldl1M'fold1M'foldrfoldrMfoldr1foldr1Mandor concatMap concatMapMflattenunfoldrunfoldrMunfoldrN unfoldrNM iterateNMiterateNprescanl prescanlM prescanl' prescanlM' postscanl postscanlM postscanl' postscanlM'scanlscanlMscanl'scanlM'scanl1scanl1Mscanl1'scanl1M' enumFromStepN enumFromToenumFromThenTotoListfromList fromListN$fFunctorStream $fFunctorStepBundlesElemssChunkssVectorsSizeChunk fromStreamchunkselementssizesizedunsafeFromList fromVector fromVectors concatVectorsreVector$fFunctorBundleMBundleinplacelifteqcmp $fOrd1Bundle $fEq1Bundle $fOrdBundle $fEqBundlemstreamfill transformmstreamRfillR transformRunstream munstream vunstream unstreamR munstreamRsplitAt unsafeSlice unsafeInit unsafeTail unsafeTake unsafeDropoverlapsnew unsafeNewclonegrow growFront unsafeGrowunsafeGrowFrontclearreadwritemodifyswapexchange unsafeRead unsafeWrite unsafeModify unsafeSwapunsafeExchangesetcopymove unsafeCopy unsafeMoveaccumupdate unsafeAccum unsafeUpdatereverseunstablePartitionunstablePartitionBundlepartitionBundlenextPermutationNewcreaterunrunPrimapplymodifyWithBundleSTVectorIOVector$fMVectorMVectora$fNFDataMVector unsafeCastunsafeFromForeignPtrunsafeFromForeignPtr0unsafeToForeignPtrunsafeToForeignPtr0 unsafeWith! unsafeIndex unsafeHead unsafeLastindexMheadMlastM unsafeIndexM unsafeHeadM unsafeLastM constructN constructrN enumFromNconcatconcatNEcreateTforce//update_ unsafeUpd unsafeUpdate_ accumulate accumulate_unsafeAccumulateunsafeAccumulate_ backpermuteunsafeBackpermuteimapimapMimapM_forMforM_izipWith izipWith3 izipWith4 izipWith5 izipWith6 izipWithM izipWithM_unzipunzip3unzip4unzip5unzip6ifilter imapMaybe partitionspanbreak findIndices elemIndex elemIndicesfoldr'foldr1'ifoldlifoldl'ifoldrifoldr'allanysumproductmaximum maximumByminimum minimumBymaxIndex maxIndexByminIndex minIndexByifoldMifoldM'foldM_ifoldM_fold1M_foldM'_ifoldM'_fold1M'_sequence sequence_iscanliscanl'prescanr prescanr' postscanr postscanr'scanrscanr'iscanriscanr'scanr1scanr1'convert unsafeFreezefreeze unsafeThawthawstreamstreamR liftShowsPrec liftReadsPrecmkTypedataCast$fIsListVector$fMonoidVector$fSemigroupVector $fOrdVector $fEqVector$fVectorVectora $fDataVector $fReadVector $fShowVector$fNFDataVectorUnbox$fTraversableVector$fFoldableVector$fAlternativeVector$fApplicativeVector$fMonadZipVector$fMonadPlusVector $fMonadVector$fFunctorVector $fOrd1Vector $fEq1Vector $fRead1Vector $fShow1Vector Data.FoldableGHC.List GHC.Classesmin checkedAddcheckedSubtractnot&&||doBoundsChecksdoUnsafeChecksdoInternalChecks error_msg checkErrorcheckIndex_msgcheckIndex_msg#checkLength_msgcheckLength_msg#checkSlice_msgcheckSlice_msg#GHC.BaseNothingJust DropWhileDropWhile_DropDropWhile_YieldDropWhile_Next emptyStreamconsumeenumFromTo_smallenumFromTo_intenumFromTo_intlikeenumFromTo_big_wordenumFromTo_big_intenumFromTo_charenumFromTo_doubletoListFB vmunstreamenlarge unsafeAppend1unsafePrepend1 munstreamMaxmunstreamUnknown vmunstreamMaxvmunstreamUnknown munstreamRMaxmunstreamRUnknown enlarge_delta enlargeFrontunstablePartitionMax partitionMaxpartitionUnknownGHC.ForeignPtr ForeignPtr storableZero storableSetstorableSetAsPrim mallocVectorTrueEqOrdText.ParserCombinators.ReadPReadS update_streamunsafeUpdate_stream accum_streamunsafeAccum_streampartition_streamunstablePartition_streamunstablePartition_newdiscard unstreamM unstreamPrimMunstreamPrimM_IOunstreamPrimM_STV_6MV_6V_5MV_5V_4MV_4V_3MV_3V_2MV_2 V_Complex MV_ComplexV_BoolMV_BoolV_CharMV_CharV_Double MV_DoubleV_FloatMV_FloatV_Word64 MV_Word64V_Word32 MV_Word32V_Word16 MV_Word16V_Word8MV_Word8V_WordMV_WordV_Int64MV_Int64V_Int32MV_Int32V_Int16MV_Int16V_Int8MV_Int8V_IntMV_IntV_UnitMV_UnitfromBooltoBool$fVectorVector(,,,,,)$fMVectorMVector(,,,,,)$fUnbox(,,,,,)D:R:Vector(,,,,,)0D:R:MVectors(,,,,,)0$fVectorVector(,,,,)$fMVectorMVector(,,,,) $fUnbox(,,,,)D:R:Vector(,,,,)0D:R:MVectors(,,,,)0$fVectorVector(,,,)$fMVectorMVector(,,,) $fUnbox(,,,)D:R:Vector(,,,)0D:R:MVectors(,,,)0$fVectorVector(,,)$fMVectorMVector(,,) $fUnbox(,,)D:R:Vector(,,)0D:R:MVectors(,,)0$fVectorVector(,)$fMVectorMVector(,) $fUnbox(,)D:R:Vector(,)0D:R:MVectors(,)0$fVectorVectorComplex$fMVectorMVectorComplex$fUnboxComplexD:R:VectorComplex0D:R:MVectorsComplex0$fVectorVectorBool$fMVectorMVectorBool $fUnboxBoolD:R:VectorBool0D:R:MVectorsBool0$fVectorVectorChar$fMVectorMVectorChar $fUnboxCharD:R:VectorChar0D:R:MVectorsChar0$fVectorVectorDouble$fMVectorMVectorDouble $fUnboxDoubleD:R:VectorDouble0D:R:MVectorsDouble0$fVectorVectorFloat$fMVectorMVectorFloat $fUnboxFloatD:R:VectorFloat0D:R:MVectorsFloat0$fVectorVectorWord64$fMVectorMVectorWord64 $fUnboxWord64D:R:VectorWord640D:R:MVectorsWord640$fVectorVectorWord32$fMVectorMVectorWord32 $fUnboxWord32D:R:VectorWord320D:R:MVectorsWord320$fVectorVectorWord16$fMVectorMVectorWord16 $fUnboxWord16D:R:VectorWord160D:R:MVectorsWord160$fVectorVectorWord8$fMVectorMVectorWord8 $fUnboxWord8D:R:VectorWord80D:R:MVectorsWord80$fVectorVectorWord$fMVectorMVectorWord $fUnboxWordD:R:VectorWord0D:R:MVectorsWord0$fVectorVectorInt64$fMVectorMVectorInt64 $fUnboxInt64D:R:VectorInt640D:R:MVectorsInt640$fVectorVectorInt32$fMVectorMVectorInt32 $fUnboxInt32D:R:VectorInt320D:R:MVectorsInt320$fVectorVectorInt16$fMVectorMVectorInt16 $fUnboxInt16D:R:VectorInt160D:R:MVectorsInt160$fVectorVectorInt8$fMVectorMVectorInt8 $fUnboxInt8D:R:VectorInt80D:R:MVectorsInt80$fVectorVectorInt$fMVectorMVectorInt $fUnboxIntD:R:VectorInt0D:R:MVectorsInt0$fVectorVector()$fMVectorMVector() $fUnbox() D:R:Vector()0D:R:MVectors()0IO moveBackwardsmoveForwardsSmallOverlapmoveForwardsLargeOverlaploopM uninitialised