Bump versions and dependencies
[darcs-mirrors/vector.git] / Data / Vector / Primitive / Safe.hs
1 #if __GLASGOW_HASKELL__ >= 701 && defined(VECTOR_BOUNDS_CHECKS)
2 {-# LANGUAGE Trustworthy #-}
3 #endif
4
5 -- |
6 -- Module : Data.Vector.Primitive.Safe
7 -- Copyright : (c) Roman Leshchinskiy 2008-2010
8 -- License : BSD-style
9 --
10 -- Maintainer : Roman Leshchinskiy <rl@cse.unsw.edu.au>
11 -- Stability : experimental
12 -- Portability : non-portable
13 --
14 -- Safe interface to "Data.Vector.Primitive"
15 --
16
17 module Data.Vector.Primitive.Safe (
18 -- * Primitive vectors
19 Vector, MVector, Prim,
20
21 -- * Accessors
22
23 -- ** Length information
24 length, null,
25
26 -- ** Indexing
27 (!), (!?), head, last,
28
29 -- ** Monadic indexing
30 indexM, headM, lastM,
31
32 -- ** Extracting subvectors (slicing)
33 slice, init, tail, take, drop, splitAt,
34
35 -- * Construction
36
37 -- ** Initialisation
38 empty, singleton, replicate, generate, iterateN,
39
40 -- ** Monadic initialisation
41 replicateM, generateM, create,
42
43 -- ** Unfolding
44 unfoldr, unfoldrN,
45 constructN, constructrN,
46
47 -- ** Enumeration
48 enumFromN, enumFromStepN, enumFromTo, enumFromThenTo,
49
50 -- ** Concatenation
51 cons, snoc, (++), concat,
52
53 -- ** Restricting memory usage
54 force,
55
56 -- * Modifying vectors
57
58 -- ** Bulk updates
59 (//), update_,
60
61 -- ** Accumulations
62 accum, accumulate_,
63
64 -- ** Permutations
65 reverse, backpermute,
66
67 -- ** Safe destructive updates
68 modify,
69
70 -- * Elementwise operations
71
72 -- ** Mapping
73 map, imap, concatMap,
74
75 -- ** Monadic mapping
76 mapM, mapM_, forM, forM_,
77
78 -- ** Zipping
79 zipWith, zipWith3, zipWith4, zipWith5, zipWith6,
80 izipWith, izipWith3, izipWith4, izipWith5, izipWith6,
81
82 -- ** Monadic zipping
83 zipWithM, zipWithM_,
84
85 -- * Working with predicates
86
87 -- ** Filtering
88 filter, ifilter, filterM,
89 takeWhile, dropWhile,
90
91 -- ** Partitioning
92 partition, unstablePartition, span, break,
93
94 -- ** Searching
95 elem, notElem, find, findIndex, findIndices, elemIndex, elemIndices,
96
97 -- * Folding
98 foldl, foldl1, foldl', foldl1', foldr, foldr1, foldr', foldr1',
99 ifoldl, ifoldl', ifoldr, ifoldr',
100
101 -- ** Specialised folds
102 all, any,
103 sum, product,
104 maximum, maximumBy, minimum, minimumBy,
105 minIndex, minIndexBy, maxIndex, maxIndexBy,
106
107 -- ** Monadic folds
108 foldM, foldM', fold1M, fold1M',
109 foldM_, foldM'_, fold1M_, fold1M'_,
110
111 -- * Prefix sums (scans)
112 prescanl, prescanl',
113 postscanl, postscanl',
114 scanl, scanl', scanl1, scanl1',
115 prescanr, prescanr',
116 postscanr, postscanr',
117 scanr, scanr', scanr1, scanr1',
118
119 -- * Conversions
120
121 -- ** Lists
122 toList, fromList, fromListN,
123
124 -- ** Other vector types
125 G.convert,
126
127 -- ** Mutable vectors
128 freeze, thaw, copy,
129 ) where
130
131 import Data.Vector.Primitive
132 import qualified Data.Vector.Generic as G
133 import Prelude ()
134