Bump versions and dependencies
[darcs-mirrors/vector.git] / Data / Vector / Unboxed / Safe.hs
1 #if __GLASGOW_HASKELL__ >= 701 && defined(VECTOR_BOUNDS_CHECKS)
2 {-# LANGUAGE Trustworthy #-}
3 #endif
4
5 -- |
6 -- Module : Data.Vector.Unboxed.Safe
7 -- Copyright : (c) Roman Leshchinskiy 2009-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.Unboxed"
15 --
16
17 module Data.Vector.Unboxed.Safe (
18 -- * Unboxed vectors
19 Vector, MVector, Unbox,
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, update_,
60
61 -- ** Accumulations
62 accum, accumulate, accumulate_,
63
64 -- ** Permutations
65 reverse, backpermute,
66
67 -- ** Safe destructive updates
68 modify,
69
70 -- * Elementwise operations
71
72 -- ** Indexing
73 indexed,
74
75 -- ** Mapping
76 map, imap, concatMap,
77
78 -- ** Monadic mapping
79 mapM, mapM_, forM, forM_,
80
81 -- ** Zipping
82 zipWith, zipWith3, zipWith4, zipWith5, zipWith6,
83 izipWith, izipWith3, izipWith4, izipWith5, izipWith6,
84 zip, zip3, zip4, zip5, zip6,
85
86 -- ** Monadic zipping
87 zipWithM, zipWithM_,
88
89 -- ** Unzipping
90 unzip, unzip3, unzip4, unzip5, unzip6,
91
92 -- * Working with predicates
93
94 -- ** Filtering
95 filter, ifilter, filterM,
96 takeWhile, dropWhile,
97
98 -- ** Partitioning
99 partition, unstablePartition, span, break,
100
101 -- ** Searching
102 elem, notElem, find, findIndex, findIndices, elemIndex, elemIndices,
103
104 -- * Folding
105 foldl, foldl1, foldl', foldl1', foldr, foldr1, foldr', foldr1',
106 ifoldl, ifoldl', ifoldr, ifoldr',
107
108 -- ** Specialised folds
109 all, any, and, or,
110 sum, product,
111 maximum, maximumBy, minimum, minimumBy,
112 minIndex, minIndexBy, maxIndex, maxIndexBy,
113
114 -- ** Monadic folds
115 foldM, foldM', fold1M, fold1M',
116 foldM_, foldM'_, fold1M_, fold1M'_,
117
118 -- * Prefix sums (scans)
119 prescanl, prescanl',
120 postscanl, postscanl',
121 scanl, scanl', scanl1, scanl1',
122 prescanr, prescanr',
123 postscanr, postscanr',
124 scanr, scanr', scanr1, scanr1',
125
126 -- * Conversions
127
128 -- ** Lists
129 toList, fromList, fromListN,
130
131 -- ** Other vector types
132 G.convert,
133
134 -- ** Mutable vectors
135 freeze, thaw, copy
136 ) where
137
138 import Data.Vector.Unboxed
139 import qualified Data.Vector.Generic as G
140 import Prelude ()
141