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