<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Vector.Primitive.Safe</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Data-Vector-Primitive-Safe.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Vector-Primitive-Safe.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">vector-0.9.1: Efficient Arrays</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>non-portable</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>Roman Leshchinskiy <rl@cse.unsw.edu.au></td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Data.Vector.Primitive.Safe</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Primitive vectors </a></li><li><a href="#g:2">Accessors </a><ul><li><a href="#g:3">Length information </a></li><li><a href="#g:4">Indexing </a></li><li><a href="#g:5">Monadic indexing </a></li><li><a href="#g:6">Extracting subvectors (slicing) </a></li></ul></li><li><a href="#g:7">Construction </a><ul><li><a href="#g:8">Initialisation </a></li><li><a href="#g:9">Monadic initialisation </a></li><li><a href="#g:10">Unfolding </a></li><li><a href="#g:11">Enumeration </a></li><li><a href="#g:12">Concatenation </a></li><li><a href="#g:13">Restricting memory usage </a></li></ul></li><li><a href="#g:14">Modifying vectors </a><ul><li><a href="#g:15">Bulk updates </a></li><li><a href="#g:16">Accumulations </a></li><li><a href="#g:17">Permutations </a></li><li><a href="#g:18">Safe destructive updates </a></li></ul></li><li><a href="#g:19">Elementwise operations </a><ul><li><a href="#g:20">Mapping </a></li><li><a href="#g:21">Monadic mapping </a></li><li><a href="#g:22">Zipping </a></li><li><a href="#g:23">Monadic zipping </a></li></ul></li><li><a href="#g:24">Working with predicates </a><ul><li><a href="#g:25">Filtering </a></li><li><a href="#g:26">Partitioning </a></li><li><a href="#g:27">Searching </a></li></ul></li><li><a href="#g:28">Folding </a><ul><li><a href="#g:29">Specialised folds </a></li><li><a href="#g:30">Monadic folds </a></li></ul></li><li><a href="#g:31">Prefix sums (scans) </a></li><li><a href="#g:32">Conversions </a><ul><li><a href="#g:33">Lists </a></li><li><a href="#g:34">Other vector types </a></li><li><a href="#g:35">Mutable vectors </a></li></ul></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Safe interface to <a href="Data-Vector-Primitive.html">Data.Vector.Primitive</a> </p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Vector">Vector</a> a</li><li class="src short"><span class="keyword">data</span> <a href="#t:MVector">MVector</a> s a</li><li class="src short"><span class="keyword">class</span> <a href="#t:Prim">Prim</a> a </li><li class="src short"><a href="#v:length">length</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:null">null</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:-33-">(!)</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a</li><li class="src short"><a href="#v:-33--63-">(!?)</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a</li><li class="src short"><a href="#v:head">head</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:last">last</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:indexM">indexM</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> m a</li><li class="src short"><a href="#v:headM">headM</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m a</li><li class="src short"><a href="#v:lastM">lastM</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m a</li><li class="src short"><a href="#v:slice">slice</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:init">init</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:tail">tail</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:take">take</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:drop">drop</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:splitAt">splitAt</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:singleton">singleton</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:replicate">replicate</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:generate">generate</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:iterateN">iterateN</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (a -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:replicateM">replicateM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> m a -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</li><li class="src short"><a href="#v:generateM">generateM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> m a) -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</li><li class="src short"><a href="#v:create">create</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (<span class="keyword">forall</span> s. <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad-ST-Safe.html#t:ST">ST</a> s (<a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> s a)) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:unfoldr">unfoldr</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (b -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (a, b)) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:unfoldrN">unfoldrN</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (b -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (a, b)) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:constructN">constructN</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:constructrN">constructrN</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:enumFromN">enumFromN</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Num">Num</a> a) => a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:enumFromStepN">enumFromStepN</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Num">Num</a> a) => a -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:enumFromTo">enumFromTo</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Enum">Enum</a> a) => a -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:enumFromThenTo">enumFromThenTo</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Enum">Enum</a> a) => a -> a -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:cons">cons</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:snoc">snoc</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:-43--43-">(++)</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:concat">concat</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => [<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a] -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:force">force</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:-47--47-">(//)</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> [(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a>, a)] -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:update_">update_</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:accum">accum</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> b -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> [(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a>, b)] -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:accumulate_">accumulate_</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:reverse">reverse</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:backpermute">backpermute</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:modify">modify</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (<span class="keyword">forall</span> s. <a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> s a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad-ST-Safe.html#t:ST">ST</a> s <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:map">map</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b</li><li class="src short"><a href="#v:imap">imap</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b</li><li class="src short"><a href="#v:concatMap">concatMap</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b</li><li class="src short"><a href="#v:mapM">mapM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> m b) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b)</li><li class="src short"><a href="#v:mapM_">mapM_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> m b) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:forM">forM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (a -> m b) -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b)</li><li class="src short"><a href="#v:forM_">forM_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (a -> m b) -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:zipWith">zipWith</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c) => (a -> b -> c) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c</li><li class="src short"><a href="#v:zipWith3">zipWith3</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d) => (a -> b -> c -> d) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d</li><li class="src short"><a href="#v:zipWith4">zipWith4</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e) => (a -> b -> c -> d -> e) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e</li><li class="src short"><a href="#v:zipWith5">zipWith5</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> f) => (a -> b -> c -> d -> e -> f) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> f</li><li class="src short"><a href="#v:zipWith6">zipWith6</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> f, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> g) => (a -> b -> c -> d -> e -> f -> g) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> f -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> g</li><li class="src short"><a href="#v:izipWith">izipWith</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> c) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c</li><li class="src short"><a href="#v:izipWith3">izipWith3</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> c -> d) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d</li><li class="src short"><a href="#v:izipWith4">izipWith4</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> c -> d -> e) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e</li><li class="src short"><a href="#v:izipWith5">izipWith5</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> f) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> c -> d -> e -> f) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> f</li><li class="src short"><a href="#v:izipWith6">izipWith6</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> f, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> g) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> c -> d -> e -> f -> g) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> f -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> g</li><li class="src short"><a href="#v:zipWithM">zipWithM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c) => (a -> b -> m c) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c)</li><li class="src short"><a href="#v:zipWithM_">zipWithM_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> m c) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:filter">filter</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:ifilter">ifilter</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:filterM">filterM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> m <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</li><li class="src short"><a href="#v:takeWhile">takeWhile</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:dropWhile">dropWhile</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:partition">partition</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</li><li class="src short"><a href="#v:unstablePartition">unstablePartition</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</li><li class="src short"><a href="#v:span">span</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</li><li class="src short"><a href="#v:break">break</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</li><li class="src short"><a href="#v:elem">elem</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:notElem">notElem</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:find">find</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a</li><li class="src short"><a href="#v:findIndex">findIndex</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:findIndices">findIndices</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:elemIndex">elemIndex</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:elemIndices">elemIndices</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:foldl">foldl</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> a</li><li class="src short"><a href="#v:foldl1">foldl1</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:foldl-39-">foldl'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> a</li><li class="src short"><a href="#v:foldl1-39-">foldl1'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:foldr">foldr</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> b</li><li class="src short"><a href="#v:foldr1">foldr1</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:foldr-39-">foldr'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> b</li><li class="src short"><a href="#v:foldr1-39-">foldr1'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:ifoldl">ifoldl</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> a</li><li class="src short"><a href="#v:ifoldl-39-">ifoldl'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> a</li><li class="src short"><a href="#v:ifoldr">ifoldr</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> b</li><li class="src short"><a href="#v:ifoldr-39-">ifoldr'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> b</li><li class="src short"><a href="#v:all">all</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:any">any</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:sum">sum</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Num">Num</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:product">product</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Num">Num</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:maximum">maximum</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:maximumBy">maximumBy</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ordering">Ordering</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:minimum">minimum</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:minimumBy">minimumBy</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ordering">Ordering</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a</li><li class="src short"><a href="#v:minIndex">minIndex</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:minIndexBy">minIndexBy</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ordering">Ordering</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:maxIndex">maxIndex</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:maxIndexBy">maxIndexBy</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ordering">Ordering</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:foldM">foldM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> m a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m a</li><li class="src short"><a href="#v:foldM-39-">foldM'</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> m a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m a</li><li class="src short"><a href="#v:fold1M">fold1M</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> a -> m a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m a</li><li class="src short"><a href="#v:fold1M-39-">fold1M'</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> a -> m a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m a</li><li class="src short"><a href="#v:foldM_">foldM_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> m a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:foldM-39-_">foldM'_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> m a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:fold1M_">fold1M_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> a -> m a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:fold1M-39-_">fold1M'_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> a -> m a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:prescanl">prescanl</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:prescanl-39-">prescanl'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:postscanl">postscanl</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:postscanl-39-">postscanl'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:scanl">scanl</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:scanl-39-">scanl'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:scanl1">scanl1</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:scanl1-39-">scanl1'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:prescanr">prescanr</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b</li><li class="src short"><a href="#v:prescanr-39-">prescanr'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b</li><li class="src short"><a href="#v:postscanr">postscanr</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b</li><li class="src short"><a href="#v:postscanr-39-">postscanr'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b</li><li class="src short"><a href="#v:scanr">scanr</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b</li><li class="src short"><a href="#v:scanr-39-">scanr'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b</li><li class="src short"><a href="#v:scanr1">scanr1</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:scanr1-39-">scanr1'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:toList">toList</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> [a]</li><li class="src short"><a href="#v:fromList">fromList</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => [a] -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:fromListN">fromListN</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> [a] -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</li><li class="src short"><a href="#v:convert">convert</a> :: (<a href="Data-Vector-Generic.html#t:Vector">Vector</a> v a, <a href="Data-Vector-Generic.html#t:Vector">Vector</a> w a) => v a -> w a</li><li class="src short"><a href="#v:freeze">freeze</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> (<a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimState">PrimState</a> m) a -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</li><li class="src short"><a href="#v:thaw">thaw</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m (<a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> (<a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimState">PrimState</a> m) a)</li><li class="src short"><a href="#v:copy">copy</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> (<a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimState">PrimState</a> m) a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li></ul></div><div id="interface"><h1 id="g:1">Primitive vectors </h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Vector" class="def">Vector</a> a <a href="src/Data-Vector-Primitive.html#Vector" class="link">Source</a></p><div class="doc"><p>Unboxed vectors of primitive types </p></div><div class="subs instances"><p id="control.i:Vector" class="caption collapser" onclick="toggleSection('i:Vector')">Instances</p><div id="section.i:Vector" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Generic.html#t:Vector">Vector</a> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Data.html#t:Data">Data</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Data.html#t:Data">Data</a> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Text-Read.html#t:Read">Read</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Text-Read.html#t:Read">Read</a> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Text-Show.html#t:Show">Show</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Text-Show.html#t:Show">Show</a> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:MVector" class="def">MVector</a> s a <a href="src/Data-Vector-Primitive-Mutable.html#MVector" class="link">Source</a></p><div class="doc"><p>Mutable vectors of primitive types. </p></div><div class="subs instances"><p id="control.i:MVector" class="caption collapser" onclick="toggleSection('i:MVector')">Instances</p><div id="section.i:MVector" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Typeable-Internal.html#t:Typeable2">Typeable2</a> <a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Generic-Mutable.html#t:MVector">MVector</a> <a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> a</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:Prim" class="def">Prim</a> a </p><div class="doc"><p>Class of types supporting primitive array operations </p></div><div class="subs instances"><p id="control.i:Prim" class="caption collapser" onclick="toggleSection('i:Prim')">Instances</p><div id="section.i:Prim" class="show"><table><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Double">Double</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Float">Float</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int8">Int8</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int16">Int16</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int32">Int32</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word">Word</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word8">Word8</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word16">Word16</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word32">Word32</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Word.html#t:Word64">Word64</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> <a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Data-Primitive-Types.html#t:Addr">Addr</a></td><td class="doc empty"> </td></tr></table></div></div></div><h1 id="g:2">Accessors </h1><h2 id="g:3">Length information </h2><div class="top"><p class="src"><a name="v:length" class="def">length</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Vector-Primitive.html#length" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Yield the length of the vector. </p></div></div><div class="top"><p class="src"><a name="v:null" class="def">null</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Vector-Primitive.html#null" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Test whether a vector if empty </p></div></div><h2 id="g:4">Indexing </h2><div class="top"><p class="src"><a name="v:-33-" class="def">(!)</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a<a href="src/Data-Vector-Primitive.html#%21" class="link">Source</a></p><div class="doc"><p>O(1) Indexing </p></div></div><div class="top"><p class="src"><a name="v:-33--63-" class="def">(!?)</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a<a href="src/Data-Vector-Primitive.html#%21%3F" class="link">Source</a></p><div class="doc"><p>O(1) Safe indexing </p></div></div><div class="top"><p class="src"><a name="v:head" class="def">head</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#head" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> First element </p></div></div><div class="top"><p class="src"><a name="v:last" class="def">last</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#last" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Last element </p></div></div><h2 id="g:5">Monadic indexing </h2><div class="top"><p class="src"><a name="v:indexM" class="def">indexM</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> m a<a href="src/Data-Vector-Primitive.html#indexM" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Indexing in a monad. </p><p>The monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this: </p><pre> copy mv v = ... write mv i (v ! i) ... </pre><p>For lazy vectors, <code>v ! i</code> would not be evaluated which means that <code>mv</code> would unnecessarily retain a reference to <code>v</code> in each element written. </p><p>With <code><a href="Data-Vector-Primitive-Safe.html#v:indexM">indexM</a></code>, copying can be implemented like this instead: </p><pre> copy mv v = ... do x <- indexM v i write mv i x </pre><p>Here, no references to <code>v</code> are retained because indexing (but <em>not</em> the elements) is evaluated eagerly. </p></div></div><div class="top"><p class="src"><a name="v:headM" class="def">headM</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m a<a href="src/Data-Vector-Primitive.html#headM" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> First element of a vector in a monad. See <code><a href="Data-Vector-Primitive-Safe.html#v:indexM">indexM</a></code> for an explanation of why this is useful. </p></div></div><div class="top"><p class="src"><a name="v:lastM" class="def">lastM</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m a<a href="src/Data-Vector-Primitive.html#lastM" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Last element of a vector in a monad. See <code><a href="Data-Vector-Primitive-Safe.html#v:indexM">indexM</a></code> for an explanation of why this is useful. </p></div></div><h2 id="g:6">Extracting subvectors (slicing) </h2><div class="top"><p class="src"><a name="v:slice" class="def">slice</a><a href="src/Data-Vector-Primitive.html#slice" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p><code>i</code> starting index </p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p><code>n</code> length </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p><em>O(1)</em> Yield a slice of the vector without copying it. The vector must contain at least <code>i+n</code> elements. </p></div></div><div class="top"><p class="src"><a name="v:init" class="def">init</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#init" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Yield all but the last element without copying. The vector may not be empty. </p></div></div><div class="top"><p class="src"><a name="v:tail" class="def">tail</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#tail" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Yield all but the first element without copying. The vector may not be empty. </p></div></div><div class="top"><p class="src"><a name="v:take" class="def">take</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#take" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Yield at the first <code>n</code> elements without copying. The vector may contain less than <code>n</code> elements in which case it is returned unchanged. </p></div></div><div class="top"><p class="src"><a name="v:drop" class="def">drop</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#drop" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Yield all but the first <code>n</code> elements without copying. The vector may contain less than <code>n</code> elements in which case an empty vector is returned. </p></div></div><div class="top"><p class="src"><a name="v:splitAt" class="def">splitAt</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)<a href="src/Data-Vector-Primitive.html#splitAt" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Yield the first <code>n</code> elements paired with the remainder without copying. </p><p>Note that <code><code><a href="Data-Vector-Primitive-Safe.html#v:splitAt">splitAt</a></code> n v</code> is equivalent to <code>(<code><a href="Data-Vector-Primitive-Safe.html#v:take">take</a></code> n v, <code><a href="Data-Vector-Primitive-Safe.html#v:drop">drop</a></code> n v)</code> but slightly more efficient. </p></div></div><h1 id="g:7">Construction </h1><h2 id="g:8">Initialisation </h2><div class="top"><p class="src"><a name="v:empty" class="def">empty</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#empty" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Empty vector </p></div></div><div class="top"><p class="src"><a name="v:singleton" class="def">singleton</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#singleton" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Vector with exactly one element </p></div></div><div class="top"><p class="src"><a name="v:replicate" class="def">replicate</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#replicate" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Vector of the given length with the same value in each position </p></div></div><div class="top"><p class="src"><a name="v:generate" class="def">generate</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#generate" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Construct a vector of the given length by applying the function to each index </p></div></div><div class="top"><p class="src"><a name="v:iterateN" class="def">iterateN</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (a -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#iterateN" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Apply function n times to value. Zeroth element is original value. </p></div></div><h2 id="g:9">Monadic initialisation </h2><div class="top"><p class="src"><a name="v:replicateM" class="def">replicateM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> m a -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)<a href="src/Data-Vector-Primitive.html#replicateM" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Execute the monadic action the given number of times and store the results in a vector. </p></div></div><div class="top"><p class="src"><a name="v:generateM" class="def">generateM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> m a) -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)<a href="src/Data-Vector-Primitive.html#generateM" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Construct a vector of the given length by applying the monadic action to each index </p></div></div><div class="top"><p class="src"><a name="v:create" class="def">create</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (<span class="keyword">forall</span> s. <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad-ST-Safe.html#t:ST">ST</a> s (<a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> s a)) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#create" class="link">Source</a></p><div class="doc"><p>Execute the monadic action and freeze the resulting vector. </p><pre> create (do { v <- new 2; write v 0 'a'; write v 1 'b' }) = <<code>a</code>,<code>b</code>> </pre></div></div><h2 id="g:10">Unfolding </h2><div class="top"><p class="src"><a name="v:unfoldr" class="def">unfoldr</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (b -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (a, b)) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#unfoldr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Construct a vector by repeatedly applying the generator function to a seed. The generator function yields <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Just">Just</a></code> the next element and the new seed or <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if there are no more elements. </p><pre> unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10 = <10,9,8,7,6,5,4,3,2,1> </pre></div></div><div class="top"><p class="src"><a name="v:unfoldrN" class="def">unfoldrN</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (b -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (a, b)) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#unfoldrN" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Construct a vector with at most <code>n</code> by repeatedly applying the generator function to the a seed. The generator function yields <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Just">Just</a></code> the next element and the new seed or <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if there are no more elements. </p><pre> unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8> </pre></div></div><div class="top"><p class="src"><a name="v:constructN" class="def">constructN</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#constructN" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Construct a vector with <code>n</code> elements by repeatedly applying the generator function to the already constructed part of the vector. </p><pre> constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in f <a,b,c> </pre></div></div><div class="top"><p class="src"><a name="v:constructrN" class="def">constructrN</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#constructrN" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Construct a vector with <code>n</code> elements from right to left by repeatedly applying the generator function to the already constructed part of the vector. </p><pre> constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a> </pre></div></div><h2 id="g:11">Enumeration </h2><div class="top"><p class="src"><a name="v:enumFromN" class="def">enumFromN</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Num">Num</a> a) => a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#enumFromN" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield a vector of the given length containing the values <code>x</code>, <code>x+1</code> etc. This operation is usually more efficient than <code><a href="Data-Vector-Primitive-Safe.html#v:enumFromTo">enumFromTo</a></code>. </p><pre> enumFromN 5 3 = <5,6,7> </pre></div></div><div class="top"><p class="src"><a name="v:enumFromStepN" class="def">enumFromStepN</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Num">Num</a> a) => a -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#enumFromStepN" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield a vector of the given length containing the values <code>x</code>, <code>x+y</code>, <code>x+y+y</code> etc. This operations is usually more efficient than <code><a href="Data-Vector-Primitive-Safe.html#v:enumFromThenTo">enumFromThenTo</a></code>. </p><pre> enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4> </pre></div></div><div class="top"><p class="src"><a name="v:enumFromTo" class="def">enumFromTo</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Enum">Enum</a> a) => a -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#enumFromTo" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Enumerate values from <code>x</code> to <code>y</code>. </p><p><em>WARNING:</em> This operation can be very inefficient. If at all possible, use <code><a href="Data-Vector-Primitive-Safe.html#v:enumFromN">enumFromN</a></code> instead. </p></div></div><div class="top"><p class="src"><a name="v:enumFromThenTo" class="def">enumFromThenTo</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Enum">Enum</a> a) => a -> a -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#enumFromThenTo" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Enumerate values from <code>x</code> to <code>y</code> with a specific step <code>z</code>. </p><p><em>WARNING:</em> This operation can be very inefficient. If at all possible, use <code><a href="Data-Vector-Primitive-Safe.html#v:enumFromStepN">enumFromStepN</a></code> instead. </p></div></div><h2 id="g:12">Concatenation </h2><div class="top"><p class="src"><a name="v:cons" class="def">cons</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#cons" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Prepend an element </p></div></div><div class="top"><p class="src"><a name="v:snoc" class="def">snoc</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#snoc" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Append an element </p></div></div><div class="top"><p class="src"><a name="v:-43--43-" class="def">(++)</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#%2B%2B" class="link">Source</a></p><div class="doc"><p><em>O(m+n)</em> Concatenate two vectors </p></div></div><div class="top"><p class="src"><a name="v:concat" class="def">concat</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => [<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a] -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#concat" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Concatenate all vectors in the list </p></div></div><h2 id="g:13">Restricting memory usage </h2><div class="top"><p class="src"><a name="v:force" class="def">force</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#force" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the argument but force it not to retain any extra memory, possibly by copying it. </p><p>This is especially useful when dealing with slices. For example: </p><pre> force (slice 0 2 <huge vector>) </pre><p>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. </p></div></div><h1 id="g:14">Modifying vectors </h1><h2 id="g:15">Bulk updates </h2><div class="top"><p class="src"><a name="v:-47--47-" class="def">(//)</a><a href="src/Data-Vector-Primitive.html#%2F%2F" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc"><p>initial vector (of length <code>m</code>) </p></td></tr><tr><td class="src">-> [(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a>, a)]</td><td class="doc"><p>list of index/value pairs (of length <code>n</code>) </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p><em>O(m+n)</em> For each pair <code>(i,a)</code> from the list, replace the vector element at position <code>i</code> by <code>a</code>. </p><pre> <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7> </pre></div></div><div class="top"><p class="src"><a name="v:update_" class="def">update_</a><a href="src/Data-Vector-Primitive.html#update_" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc"><p>initial vector (of length <code>m</code>) </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>index vector (of length <code>n1</code>) </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc"><p>value vector (of length <code>n2</code>) </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p><em>O(m+min(n1,n2))</em> For each index <code>i</code> from the index vector and the corresponding value <code>a</code> from the value vector, replace the element of the initial vector at position <code>i</code> by <code>a</code>. </p><pre> update_ <5,9,2,7> <2,0,2> <1,3,8> = <3,9,8,7> </pre></div></div><h2 id="g:16">Accumulations </h2><div class="top"><p class="src"><a name="v:accum" class="def">accum</a><a href="src/Data-Vector-Primitive.html#accum" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">=> (a -> b -> a)</td><td class="doc"><p>accumulating function <code>f</code> </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc"><p>initial vector (of length <code>m</code>) </p></td></tr><tr><td class="src">-> [(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a>, b)]</td><td class="doc"><p>list of index/value pairs (of length <code>n</code>) </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p><em>O(m+n)</em> For each pair <code>(i,b)</code> from the list, replace the vector element <code>a</code> at position <code>i</code> by <code>f a b</code>. </p><pre> accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4> </pre></div></div><div class="top"><p class="src"><a name="v:accumulate_" class="def">accumulate_</a><a href="src/Data-Vector-Primitive.html#accumulate_" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b)</td><td class="doc empty"> </td></tr><tr><td class="src">=> (a -> b -> a)</td><td class="doc"><p>accumulating function <code>f</code> </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc"><p>initial vector (of length <code>m</code>) </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>index vector (of length <code>n1</code>) </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b</td><td class="doc"><p>value vector (of length <code>n2</code>) </p></td></tr><tr><td class="src">-> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p><em>O(m+min(n1,n2))</em> For each index <code>i</code> from the index vector and the corresponding value <code>b</code> from the the value vector, replace the element of the initial vector at position <code>i</code> by <code>f a b</code>. </p><pre> accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4> </pre></div></div><h2 id="g:17">Permutations </h2><div class="top"><p class="src"><a name="v:reverse" class="def">reverse</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#reverse" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Reverse a vector </p></div></div><div class="top"><p class="src"><a name="v:backpermute" class="def">backpermute</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#backpermute" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the vector obtained by replacing each element <code>i</code> of the index vector by <code>xs<code><a href="Data-Vector-Primitive-Safe.html#v:-33-">!</a></code>i</code>. This is equivalent to <code><code><a href="Data-Vector-Primitive-Safe.html#v:map">map</a></code> (xs<code><a href="Data-Vector-Primitive-Safe.html#v:-33-">!</a></code>) is</code> but is often much more efficient. </p><pre> backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a> </pre></div></div><h2 id="g:18">Safe destructive updates </h2><div class="top"><p class="src"><a name="v:modify" class="def">modify</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (<span class="keyword">forall</span> s. <a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> s a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad-ST-Safe.html#t:ST">ST</a> s <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#modify" class="link">Source</a></p><div class="doc"><p>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. </p><pre> modify (\v -> write v 0 'x') (<code><a href="Data-Vector-Primitive-Safe.html#v:replicate">replicate</a></code> 3 'a') = <'x','a','a'> </pre></div></div><h1 id="g:19">Elementwise operations </h1><h2 id="g:20">Mapping </h2><div class="top"><p class="src"><a name="v:map" class="def">map</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b<a href="src/Data-Vector-Primitive.html#map" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Map a function over a vector </p></div></div><div class="top"><p class="src"><a name="v:imap" class="def">imap</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b<a href="src/Data-Vector-Primitive.html#imap" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Apply a function to every element of a vector and its index </p></div></div><div class="top"><p class="src"><a name="v:concatMap" class="def">concatMap</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b<a href="src/Data-Vector-Primitive.html#concatMap" class="link">Source</a></p><div class="doc"><p>Map a function over a vector and concatenate the results. </p></div></div><h2 id="g:21">Monadic mapping </h2><div class="top"><p class="src"><a name="v:mapM" class="def">mapM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> m b) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b)<a href="src/Data-Vector-Primitive.html#mapM" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Apply the monadic action to all elements of the vector, yielding a vector of results </p></div></div><div class="top"><p class="src"><a name="v:mapM_" class="def">mapM_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> m b) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Data-Vector-Primitive.html#mapM_" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Apply the monadic action to all elements of a vector and ignore the results </p></div></div><div class="top"><p class="src"><a name="v:forM" class="def">forM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (a -> m b) -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b)<a href="src/Data-Vector-Primitive.html#forM" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Apply the monadic action to all elements of the vector, yielding a vector of results. Equvalent to <code>flip <code><a href="Data-Vector-Primitive-Safe.html#v:mapM">mapM</a></code></code>. </p></div></div><div class="top"><p class="src"><a name="v:forM_" class="def">forM_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (a -> m b) -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Data-Vector-Primitive.html#forM_" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Apply the monadic action to all elements of a vector and ignore the results. Equivalent to <code>flip <code><a href="Data-Vector-Primitive-Safe.html#v:mapM_">mapM_</a></code></code>. </p></div></div><h2 id="g:22">Zipping </h2><div class="top"><p class="src"><a name="v:zipWith" class="def">zipWith</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c) => (a -> b -> c) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c<a href="src/Data-Vector-Primitive.html#zipWith" class="link">Source</a></p><div class="doc"><p><em>O(min(m,n))</em> Zip two vectors with the given function. </p></div></div><div class="top"><p class="src"><a name="v:zipWith3" class="def">zipWith3</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d) => (a -> b -> c -> d) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d<a href="src/Data-Vector-Primitive.html#zipWith3" class="link">Source</a></p><div class="doc"><p>Zip three vectors with the given function. </p></div></div><div class="top"><p class="src"><a name="v:zipWith4" class="def">zipWith4</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e) => (a -> b -> c -> d -> e) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e<a href="src/Data-Vector-Primitive.html#zipWith4" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:zipWith5" class="def">zipWith5</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> f) => (a -> b -> c -> d -> e -> f) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> f<a href="src/Data-Vector-Primitive.html#zipWith5" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:zipWith6" class="def">zipWith6</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> f, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> g) => (a -> b -> c -> d -> e -> f -> g) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> f -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> g<a href="src/Data-Vector-Primitive.html#zipWith6" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:izipWith" class="def">izipWith</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> c) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c<a href="src/Data-Vector-Primitive.html#izipWith" class="link">Source</a></p><div class="doc"><p><em>O(min(m,n))</em> Zip two vectors with a function that also takes the elements' indices. </p></div></div><div class="top"><p class="src"><a name="v:izipWith3" class="def">izipWith3</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> c -> d) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d<a href="src/Data-Vector-Primitive.html#izipWith3" class="link">Source</a></p><div class="doc"><p>Zip three vectors and their indices with the given function. </p></div></div><div class="top"><p class="src"><a name="v:izipWith4" class="def">izipWith4</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> c -> d -> e) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e<a href="src/Data-Vector-Primitive.html#izipWith4" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:izipWith5" class="def">izipWith5</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> f) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> c -> d -> e -> f) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> f<a href="src/Data-Vector-Primitive.html#izipWith5" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:izipWith6" class="def">izipWith6</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> d, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> e, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> f, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> g) => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> c -> d -> e -> f -> g) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> d -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> e -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> f -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> g<a href="src/Data-Vector-Primitive.html#izipWith6" class="link">Source</a></p></div><h2 id="g:23">Monadic zipping </h2><div class="top"><p class="src"><a name="v:zipWithM" class="def">zipWithM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> c) => (a -> b -> m c) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> c)<a href="src/Data-Vector-Primitive.html#zipWithM" class="link">Source</a></p><div class="doc"><p><em>O(min(m,n))</em> Zip the two vectors with the monadic action and yield a vector of results </p></div></div><div class="top"><p class="src"><a name="v:zipWithM_" class="def">zipWithM_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> m c) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Data-Vector-Primitive.html#zipWithM_" class="link">Source</a></p><div class="doc"><p><em>O(min(m,n))</em> Zip the two vectors with the monadic action and ignore the results </p></div></div><h1 id="g:24">Working with predicates </h1><h2 id="g:25">Filtering </h2><div class="top"><p class="src"><a name="v:filter" class="def">filter</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#filter" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Drop elements that do not satisfy the predicate </p></div></div><div class="top"><p class="src"><a name="v:ifilter" class="def">ifilter</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#ifilter" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Drop elements that do not satisfy the predicate which is applied to values and their indices </p></div></div><div class="top"><p class="src"><a name="v:filterM" class="def">filterM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> m <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)<a href="src/Data-Vector-Primitive.html#filterM" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Drop elements that do not satisfy the monadic predicate </p></div></div><div class="top"><p class="src"><a name="v:takeWhile" class="def">takeWhile</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#takeWhile" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the longest prefix of elements satisfying the predicate without copying. </p></div></div><div class="top"><p class="src"><a name="v:dropWhile" class="def">dropWhile</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#dropWhile" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Drop the longest prefix of elements that satisfy the predicate without copying. </p></div></div><h2 id="g:26">Partitioning </h2><div class="top"><p class="src"><a name="v:partition" class="def">partition</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)<a href="src/Data-Vector-Primitive.html#partition" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> 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 <code><a href="Data-Vector-Primitive-Safe.html#v:unstablePartition">unstablePartition</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:unstablePartition" class="def">unstablePartition</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)<a href="src/Data-Vector-Primitive.html#unstablePartition" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> 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 <code><a href="Data-Vector-Primitive-Safe.html#v:partition">partition</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:span" class="def">span</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)<a href="src/Data-Vector-Primitive.html#span" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying. </p></div></div><div class="top"><p class="src"><a name="v:break" class="def">break</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)<a href="src/Data-Vector-Primitive.html#break" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest without copying. </p></div></div><h2 id="g:27">Searching </h2><div class="top"><p class="src"><a name="v:elem" class="def">elem</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Vector-Primitive.html#elem" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Check if the vector contains an element </p></div></div><div class="top"><p class="src"><a name="v:notElem" class="def">notElem</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Vector-Primitive.html#notElem" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Check if the vector does not contain an element (inverse of <code><a href="Data-Vector-Primitive-Safe.html#v:elem">elem</a></code>) </p></div></div><div class="top"><p class="src"><a name="v:find" class="def">find</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a<a href="src/Data-Vector-Primitive.html#find" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Just">Just</a></code> the first element matching the predicate or <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if no such element exists. </p></div></div><div class="top"><p class="src"><a name="v:findIndex" class="def">findIndex</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Vector-Primitive.html#findIndex" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Just">Just</a></code> the index of the first element matching the predicate or <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if no such element exists. </p></div></div><div class="top"><p class="src"><a name="v:findIndices" class="def">findIndices</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Vector-Primitive.html#findIndices" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the indices of elements satisfying the predicate in ascending order. </p></div></div><div class="top"><p class="src"><a name="v:elemIndex" class="def">elemIndex</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Vector-Primitive.html#elemIndex" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Just">Just</a></code> the index of the first occurence of the given element or <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if the vector does not contain the element. This is a specialised version of <code><a href="Data-Vector-Primitive-Safe.html#v:findIndex">findIndex</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:elemIndices" class="def">elemIndices</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Vector-Primitive.html#elemIndices" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the indices of all occurences of the given element in ascending order. This is a specialised version of <code><a href="Data-Vector-Primitive-Safe.html#v:findIndices">findIndices</a></code>. </p></div></div><h1 id="g:28">Folding </h1><div class="top"><p class="src"><a name="v:foldl" class="def">foldl</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> a<a href="src/Data-Vector-Primitive.html#foldl" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Left fold </p></div></div><div class="top"><p class="src"><a name="v:foldl1" class="def">foldl1</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#foldl1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Left fold on non-empty vectors </p></div></div><div class="top"><p class="src"><a name="v:foldl-39-" class="def">foldl'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> a<a href="src/Data-Vector-Primitive.html#foldl%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Left fold with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:foldl1-39-" class="def">foldl1'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#foldl1%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Left fold on non-empty vectors with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:foldr" class="def">foldr</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> b<a href="src/Data-Vector-Primitive.html#foldr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right fold </p></div></div><div class="top"><p class="src"><a name="v:foldr1" class="def">foldr1</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#foldr1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right fold on non-empty vectors </p></div></div><div class="top"><p class="src"><a name="v:foldr-39-" class="def">foldr'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> b<a href="src/Data-Vector-Primitive.html#foldr%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right fold with a strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:foldr1-39-" class="def">foldr1'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#foldr1%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right fold on non-empty vectors with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:ifoldl" class="def">ifoldl</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> a<a href="src/Data-Vector-Primitive.html#ifoldl" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Left fold (function applied to each element and its index) </p></div></div><div class="top"><p class="src"><a name="v:ifoldl-39-" class="def">ifoldl'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> a<a href="src/Data-Vector-Primitive.html#ifoldl%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Left fold with strict accumulator (function applied to each element and its index) </p></div></div><div class="top"><p class="src"><a name="v:ifoldr" class="def">ifoldr</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> b<a href="src/Data-Vector-Primitive.html#ifoldr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right fold (function applied to each element and its index) </p></div></div><div class="top"><p class="src"><a name="v:ifoldr-39-" class="def">ifoldr'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> b<a href="src/Data-Vector-Primitive.html#ifoldr%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right fold with strict accumulator (function applied to each element and its index) </p></div></div><h2 id="g:29">Specialised folds </h2><div class="top"><p class="src"><a name="v:all" class="def">all</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Vector-Primitive.html#all" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Check if all elements satisfy the predicate. </p></div></div><div class="top"><p class="src"><a name="v:any" class="def">any</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Vector-Primitive.html#any" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Check if any element satisfies the predicate. </p></div></div><div class="top"><p class="src"><a name="v:sum" class="def">sum</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Num">Num</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#sum" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Compute the sum of the elements </p></div></div><div class="top"><p class="src"><a name="v:product" class="def">product</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#t:Num">Num</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#product" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Compute the produce of the elements </p></div></div><div class="top"><p class="src"><a name="v:maximum" class="def">maximum</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#maximum" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the maximum element of the vector. The vector may not be empty. </p></div></div><div class="top"><p class="src"><a name="v:maximumBy" class="def">maximumBy</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ordering">Ordering</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#maximumBy" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the maximum element of the vector according to the given comparison function. The vector may not be empty. </p></div></div><div class="top"><p class="src"><a name="v:minimum" class="def">minimum</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#minimum" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the minimum element of the vector. The vector may not be empty. </p></div></div><div class="top"><p class="src"><a name="v:minimumBy" class="def">minimumBy</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ordering">Ordering</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> a<a href="src/Data-Vector-Primitive.html#minimumBy" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the minimum element of the vector according to the given comparison function. The vector may not be empty. </p></div></div><div class="top"><p class="src"><a name="v:minIndex" class="def">minIndex</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Vector-Primitive.html#minIndex" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the index of the minimum element of the vector. The vector may not be empty. </p></div></div><div class="top"><p class="src"><a name="v:minIndexBy" class="def">minIndexBy</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ordering">Ordering</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Vector-Primitive.html#minIndexBy" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the index of the minimum element of the vector according to the given comparison function. The vector may not be empty. </p></div></div><div class="top"><p class="src"><a name="v:maxIndex" class="def">maxIndex</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Vector-Primitive.html#maxIndex" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the index of the maximum element of the vector. The vector may not be empty. </p></div></div><div class="top"><p class="src"><a name="v:maxIndexBy" class="def">maxIndexBy</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ordering">Ordering</a>) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Vector-Primitive.html#maxIndexBy" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield the index of the maximum element of the vector according to the given comparison function. The vector may not be empty. </p></div></div><h2 id="g:30">Monadic folds </h2><div class="top"><p class="src"><a name="v:foldM" class="def">foldM</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> m a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m a<a href="src/Data-Vector-Primitive.html#foldM" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Monadic fold </p></div></div><div class="top"><p class="src"><a name="v:foldM-39-" class="def">foldM'</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> m a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m a<a href="src/Data-Vector-Primitive.html#foldM%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Monadic fold with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:fold1M" class="def">fold1M</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> a -> m a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m a<a href="src/Data-Vector-Primitive.html#fold1M" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Monadic fold over non-empty vectors </p></div></div><div class="top"><p class="src"><a name="v:fold1M-39-" class="def">fold1M'</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> a -> m a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m a<a href="src/Data-Vector-Primitive.html#fold1M%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Monadic fold over non-empty vectors with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:foldM_" class="def">foldM_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> m a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Data-Vector-Primitive.html#foldM_" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Monadic fold that discards the result </p></div></div><div class="top"><p class="src"><a name="v:foldM-39-_" class="def">foldM'_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> m a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Data-Vector-Primitive.html#foldM%27_" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Monadic fold with strict accumulator that discards the result </p></div></div><div class="top"><p class="src"><a name="v:fold1M_" class="def">fold1M_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> a -> m a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Data-Vector-Primitive.html#fold1M_" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Monadic fold over non-empty vectors that discards the result </p></div></div><div class="top"><p class="src"><a name="v:fold1M-39-_" class="def">fold1M'_</a> :: (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a) => (a -> a -> m a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Data-Vector-Primitive.html#fold1M%27_" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Monadic fold over non-empty vectors with strict accumulator that discards the result </p></div></div><h1 id="g:31">Prefix sums (scans) </h1><div class="top"><p class="src"><a name="v:prescanl" class="def">prescanl</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#prescanl" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Prescan </p><pre> prescanl f z = <code><a href="Data-Vector-Primitive-Safe.html#v:init">init</a></code> . <code><a href="Data-Vector-Primitive-Safe.html#v:scanl">scanl</a></code> f z </pre><p>Example: <code>prescanl (+) 0 <1,2,3,4> = <0,1,3,6></code> </p></div></div><div class="top"><p class="src"><a name="v:prescanl-39-" class="def">prescanl'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#prescanl%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Prescan with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:postscanl" class="def">postscanl</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#postscanl" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Scan </p><pre> postscanl f z = <code><a href="Data-Vector-Primitive-Safe.html#v:tail">tail</a></code> . <code><a href="Data-Vector-Primitive-Safe.html#v:scanl">scanl</a></code> f z </pre><p>Example: <code>postscanl (+) 0 <1,2,3,4> = <1,3,6,10></code> </p></div></div><div class="top"><p class="src"><a name="v:postscanl-39-" class="def">postscanl'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#postscanl%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Scan with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:scanl" class="def">scanl</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#scanl" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Haskell-style scan </p><pre> scanl f z <x1,...,xn> = <y1,...,y(n+1)> where y1 = z yi = f y(i-1) x(i-1) </pre><p>Example: <code>scanl (+) 0 <1,2,3,4> = <0,1,3,6,10></code> </p></div></div><div class="top"><p class="src"><a name="v:scanl-39-" class="def">scanl'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> a) -> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#scanl%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Haskell-style scan with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:scanl1" class="def">scanl1</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#scanl1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Scan over a non-empty vector </p><pre> scanl f <x1,...,xn> = <y1,...,yn> where y1 = x1 yi = f y(i-1) xi </pre></div></div><div class="top"><p class="src"><a name="v:scanl1-39-" class="def">scanl1'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#scanl1%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Scan over a non-empty vector with a strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:prescanr" class="def">prescanr</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b<a href="src/Data-Vector-Primitive.html#prescanr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right-to-left prescan </p><pre> prescanr f z = <code><a href="Data-Vector-Primitive-Safe.html#v:reverse">reverse</a></code> . <code><a href="Data-Vector-Primitive-Safe.html#v:prescanl">prescanl</a></code> (flip f) z . <code><a href="Data-Vector-Primitive-Safe.html#v:reverse">reverse</a></code> </pre></div></div><div class="top"><p class="src"><a name="v:prescanr-39-" class="def">prescanr'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b<a href="src/Data-Vector-Primitive.html#prescanr%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right-to-left prescan with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:postscanr" class="def">postscanr</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b<a href="src/Data-Vector-Primitive.html#postscanr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right-to-left scan </p></div></div><div class="top"><p class="src"><a name="v:postscanr-39-" class="def">postscanr'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b<a href="src/Data-Vector-Primitive.html#postscanr%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right-to-left scan with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:scanr" class="def">scanr</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b<a href="src/Data-Vector-Primitive.html#scanr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right-to-left Haskell-style scan </p></div></div><div class="top"><p class="src"><a name="v:scanr-39-" class="def">scanr'</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> b) => (a -> b -> b) -> b -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> b<a href="src/Data-Vector-Primitive.html#scanr%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right-to-left Haskell-style scan with strict accumulator </p></div></div><div class="top"><p class="src"><a name="v:scanr1" class="def">scanr1</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#scanr1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right-to-left scan over a non-empty vector </p></div></div><div class="top"><p class="src"><a name="v:scanr1-39-" class="def">scanr1'</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => (a -> a -> a) -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#scanr1%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right-to-left scan over a non-empty vector with a strict accumulator </p></div></div><h1 id="g:32">Conversions </h1><h2 id="g:33">Lists </h2><div class="top"><p class="src"><a name="v:toList" class="def">toList</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> [a]<a href="src/Data-Vector-Primitive.html#toList" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a vector to a list </p></div></div><div class="top"><p class="src"><a name="v:fromList" class="def">fromList</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => [a] -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#fromList" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a list to a vector </p></div></div><div class="top"><p class="src"><a name="v:fromListN" class="def">fromListN</a> :: <a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a => <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> [a] -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a<a href="src/Data-Vector-Primitive.html#fromListN" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert the first <code>n</code> elements of a list to a vector </p><pre> fromListN n xs = <code><a href="Data-Vector-Primitive-Safe.html#v:fromList">fromList</a></code> (<code><a href="Data-Vector-Primitive-Safe.html#v:take">take</a></code> n xs) </pre></div></div><h2 id="g:34">Other vector types </h2><div class="top"><p class="src"><a name="v:convert" class="def">convert</a> :: (<a href="Data-Vector-Generic.html#t:Vector">Vector</a> v a, <a href="Data-Vector-Generic.html#t:Vector">Vector</a> w a) => v a -> w a<a href="src/Data-Vector-Generic.html#convert" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert different vector types </p></div></div><h2 id="g:35">Mutable vectors </h2><div class="top"><p class="src"><a name="v:freeze" class="def">freeze</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> (<a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimState">PrimState</a> m) a -> m (<a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a)<a href="src/Data-Vector-Primitive.html#freeze" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield an immutable copy of the mutable vector. </p></div></div><div class="top"><p class="src"><a name="v:thaw" class="def">thaw</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m (<a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> (<a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimState">PrimState</a> m) a)<a href="src/Data-Vector-Primitive.html#thaw" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Yield a mutable copy of the immutable vector. </p></div></div><div class="top"><p class="src"><a name="v:copy" class="def">copy</a> :: (<a href="Data-Vector-Primitive-Safe.html#t:Prim">Prim</a> a, <a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimMonad">PrimMonad</a> m) => <a href="Data-Vector-Primitive-Safe.html#t:MVector">MVector</a> (<a href="/usr/share/doc/ghc/html/libraries/primitive-0.4.1/Control-Monad-Primitive.html#t:PrimState">PrimState</a> m) a -> <a href="Data-Vector-Primitive-Safe.html#t:Vector">Vector</a> a -> m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Data-Vector-Primitive.html#copy" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Copy an immutable vector into a mutable one. The two vectors must have the same length. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.10.0</p></div></body></html>