Add all, any
[darcs-mirrors/vector.git] / Data / Vector.hs
1 {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, TypeFamilies #-}
2
3 -- |
4 -- Module : Data.Vector
5 -- Copyright : (c) Roman Leshchinskiy 2008-2009
6 -- License : BSD-style
7 --
8 -- Maintainer : Roman Leshchinskiy <rl@cse.unsw.edu.au>
9 -- Stability : experimental
10 -- Portability : non-portable
11 --
12 -- Boxed vectors
13 --
14
15 module Data.Vector (
16 Vector, MVector,
17
18 -- * Length information
19 length, null,
20
21 -- * Construction
22 empty, singleton, cons, snoc, replicate, (++), copy,
23
24 -- * Accessing individual elements
25 (!), head, last, indexM, headM, lastM,
26
27 -- * Subvectors
28 slice, init, tail, take, drop,
29 unsafeSlice,
30
31 -- * Permutations
32 accum, accumulate, accumulate_,
33 (//), update, update_,
34 backpermute, reverse,
35
36 -- * Mapping
37 map, imap, concatMap,
38
39 -- * Zipping and unzipping
40 zipWith, zipWith3, zipWith4, zipWith5, zipWith6,
41 izipWith, izipWith3, izipWith4, izipWith5, izipWith6,
42 zip, zip3, zip4, zip5, zip6,
43 unzip, unzip3, unzip4, unzip5, unzip6,
44
45 -- * Filtering
46 filter, ifilter, takeWhile, dropWhile,
47
48 -- * Searching
49 elem, notElem, find, findIndex, findIndices, elemIndex, elemIndices,
50
51 -- * Folding
52 foldl, foldl1, foldl', foldl1', foldr, foldr1,
53 ifoldl, ifoldl', ifoldr,
54
55 -- * Specialised folds
56 all, any, and, or,
57 sum, product,
58 maximum, maximumBy, minimum, minimumBy,
59 minIndex, minIndexBy, maxIndex, maxIndexBy,
60
61 -- * Unfolding
62 unfoldr,
63
64 -- * Scans
65 prescanl, prescanl',
66 postscanl, postscanl',
67 scanl, scanl', scanl1, scanl1',
68
69 -- * Enumeration
70 enumFromTo, enumFromThenTo,
71
72 -- * Conversion to/from lists
73 toList, fromList,
74
75 -- * Unsafe operations
76 unsafeIndex, unsafeIndexM,
77 unsafeAccum, unsafeAccumulate, unsafeAccumulate_,
78 unsafeUpd, unsafeUpdate, unsafeUpdate_
79 ) where
80
81 import qualified Data.Vector.Generic as G
82 import Data.Vector.Mutable ( MVector(..) )
83 import Data.Primitive.Array
84
85 import Control.Monad ( liftM )
86
87 import Prelude hiding ( length, null,
88 replicate, (++),
89 head, last,
90 init, tail, take, drop, reverse,
91 map, concatMap,
92 zipWith, zipWith3, zip, zip3, unzip, unzip3,
93 filter, takeWhile, dropWhile,
94 elem, notElem,
95 foldl, foldl1, foldr, foldr1,
96 all, any, and, or, sum, product, minimum, maximum,
97 scanl, scanl1,
98 enumFromTo, enumFromThenTo )
99
100 import qualified Prelude
101
102 data Vector a = Vector {-# UNPACK #-} !Int
103 {-# UNPACK #-} !Int
104 {-# UNPACK #-} !(Array a)
105
106 instance Show a => Show (Vector a) where
107 show = (Prelude.++ " :: Data.Vector.Vector") . ("fromList " Prelude.++) . show . toList
108
109 type instance G.Mutable Vector = MVector
110
111 instance G.Vector Vector a where
112 {-# INLINE unsafeFreeze #-}
113 unsafeFreeze (MVector i n marr)
114 = Vector i n `liftM` unsafeFreezeArray marr
115
116 {-# INLINE basicLength #-}
117 basicLength (Vector _ n _) = n
118
119 {-# INLINE basicUnsafeSlice #-}
120 basicUnsafeSlice (Vector i _ arr) j n = Vector (i+j) n arr
121
122 {-# INLINE basicUnsafeIndexM #-}
123 basicUnsafeIndexM (Vector i _ arr) j = indexArrayM arr (i+j)
124
125 instance Eq a => Eq (Vector a) where
126 {-# INLINE (==) #-}
127 (==) = G.eq
128
129 instance Ord a => Ord (Vector a) where
130 {-# INLINE compare #-}
131 compare = G.cmp
132
133 -- Length
134 -- ------
135
136 length :: Vector a -> Int
137 {-# INLINE length #-}
138 length = G.length
139
140 null :: Vector a -> Bool
141 {-# INLINE null #-}
142 null = G.null
143
144 -- Construction
145 -- ------------
146
147 -- | Empty vector
148 empty :: Vector a
149 {-# INLINE empty #-}
150 empty = G.empty
151
152 -- | Vector with exaclty one element
153 singleton :: a -> Vector a
154 {-# INLINE singleton #-}
155 singleton = G.singleton
156
157 -- | Vector of the given length with the given value in each position
158 replicate :: Int -> a -> Vector a
159 {-# INLINE replicate #-}
160 replicate = G.replicate
161
162 -- | Prepend an element
163 cons :: a -> Vector a -> Vector a
164 {-# INLINE cons #-}
165 cons = G.cons
166
167 -- | Append an element
168 snoc :: Vector a -> a -> Vector a
169 {-# INLINE snoc #-}
170 snoc = G.snoc
171
172 infixr 5 ++
173 -- | Concatenate two vectors
174 (++) :: Vector a -> Vector a -> Vector a
175 {-# INLINE (++) #-}
176 (++) = (G.++)
177
178 -- | Create a copy of a vector. Useful when dealing with slices.
179 copy :: Vector a -> Vector a
180 {-# INLINE copy #-}
181 copy = G.copy
182
183 -- Accessing individual elements
184 -- -----------------------------
185
186 -- | Indexing
187 (!) :: Vector a -> Int -> a
188 {-# INLINE (!) #-}
189 (!) = (G.!)
190
191 -- | Unsafe indexing without bounds checks
192 unsafeIndex :: Vector a -> Int -> a
193 {-# INLINE unsafeIndex #-}
194 unsafeIndex = G.unsafeIndex
195
196 -- | First element
197 head :: Vector a -> a
198 {-# INLINE head #-}
199 head = G.head
200
201 -- | Last element
202 last :: Vector a -> a
203 {-# INLINE last #-}
204 last = G.last
205
206 -- | Monadic indexing which can be strict in the vector while remaining lazy in
207 -- the element
208 indexM :: Monad m => Vector a -> Int -> m a
209 {-# INLINE indexM #-}
210 indexM = G.indexM
211
212 -- | Unsafe monadic indexing without bounds checks
213 unsafeIndexM :: Monad m => Vector a -> Int -> m a
214 {-# INLINE unsafeIndexM #-}
215 unsafeIndexM = G.unsafeIndexM
216
217 headM :: Monad m => Vector a -> m a
218 {-# INLINE headM #-}
219 headM = G.headM
220
221 lastM :: Monad m => Vector a -> m a
222 {-# INLINE lastM #-}
223 lastM = G.lastM
224
225 -- Subarrays
226 -- ---------
227
228 -- | Yield a part of the vector without copying it. Safer version of
229 -- 'basicUnsafeSlice'.
230 slice :: Vector a -> Int -- ^ starting index
231 -> Int -- ^ length
232 -> Vector a
233 {-# INLINE slice #-}
234 slice = G.slice
235
236 -- | Unsafely yield a part of the vector without copying it and without
237 -- performing bounds checks.
238 unsafeSlice :: Vector a -> Int -- ^ starting index
239 -> Int -- ^ length
240 -> Vector a
241 {-# INLINE unsafeSlice #-}
242 unsafeSlice = G.unsafeSlice
243
244 -- | Yield all but the last element without copying.
245 init :: Vector a -> Vector a
246 {-# INLINE init #-}
247 init = G.init
248
249 -- | All but the first element (without copying).
250 tail :: Vector a -> Vector a
251 {-# INLINE tail #-}
252 tail = G.tail
253
254 -- | Yield the first @n@ elements without copying.
255 take :: Int -> Vector a -> Vector a
256 {-# INLINE take #-}
257 take = G.take
258
259 -- | Yield all but the first @n@ elements without copying.
260 drop :: Int -> Vector a -> Vector a
261 {-# INLINE drop #-}
262 drop = G.drop
263
264 -- Permutations
265 -- ------------
266
267 unsafeAccum :: (a -> b -> a) -> Vector a -> [(Int,b)] -> Vector a
268 {-# INLINE unsafeAccum #-}
269 unsafeAccum = G.unsafeAccum
270
271 unsafeAccumulate :: (a -> b -> a) -> Vector a -> Vector (Int,b) -> Vector a
272 {-# INLINE unsafeAccumulate #-}
273 unsafeAccumulate = G.unsafeAccumulate
274
275 unsafeAccumulate_
276 :: (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a
277 {-# INLINE unsafeAccumulate_ #-}
278 unsafeAccumulate_ = G.unsafeAccumulate_
279
280 accum :: (a -> b -> a) -> Vector a -> [(Int,b)] -> Vector a
281 {-# INLINE accum #-}
282 accum = G.accum
283
284 accumulate :: (a -> b -> a) -> Vector a -> Vector (Int,b) -> Vector a
285 {-# INLINE accumulate #-}
286 accumulate = G.accumulate
287
288 accumulate_ :: (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a
289 {-# INLINE accumulate_ #-}
290 accumulate_ = G.accumulate_
291
292 unsafeUpd :: Vector a -> [(Int, a)] -> Vector a
293 {-# INLINE unsafeUpd #-}
294 unsafeUpd = G.unsafeUpd
295
296 unsafeUpdate :: Vector a -> Vector (Int, a) -> Vector a
297 {-# INLINE unsafeUpdate #-}
298 unsafeUpdate = G.unsafeUpdate
299
300 unsafeUpdate_ :: Vector a -> Vector Int -> Vector a -> Vector a
301 {-# INLINE unsafeUpdate_ #-}
302 unsafeUpdate_ = G.unsafeUpdate_
303
304 (//) :: Vector a -> [(Int, a)] -> Vector a
305 {-# INLINE (//) #-}
306 (//) = (G.//)
307
308 update :: Vector a -> Vector (Int, a) -> Vector a
309 {-# INLINE update #-}
310 update = G.update
311
312 update_ :: Vector a -> Vector Int -> Vector a -> Vector a
313 {-# INLINE update_ #-}
314 update_ = G.update_
315
316 backpermute :: Vector a -> Vector Int -> Vector a
317 {-# INLINE backpermute #-}
318 backpermute = G.backpermute
319
320 reverse :: Vector a -> Vector a
321 {-# INLINE reverse #-}
322 reverse = G.reverse
323
324 -- Mapping
325 -- -------
326
327 -- | Map a function over a vector
328 map :: (a -> b) -> Vector a -> Vector b
329 {-# INLINE map #-}
330 map = G.map
331
332 -- | Apply a function to every index/value pair
333 imap :: (Int -> a -> b) -> Vector a -> Vector b
334 {-# INLINE imap #-}
335 imap = G.imap
336
337 concatMap :: (a -> Vector b) -> Vector a -> Vector b
338 {-# INLINE concatMap #-}
339 concatMap = G.concatMap
340
341 -- Zipping/unzipping
342 -- -----------------
343
344 -- | Zip two vectors with the given function.
345 zipWith :: (a -> b -> c) -> Vector a -> Vector b -> Vector c
346 {-# INLINE zipWith #-}
347 zipWith = G.zipWith
348
349 -- | Zip three vectors with the given function.
350 zipWith3 :: (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
351 {-# INLINE zipWith3 #-}
352 zipWith3 = G.zipWith3
353
354 zipWith4 :: (a -> b -> c -> d -> e)
355 -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
356 {-# INLINE zipWith4 #-}
357 zipWith4 = G.zipWith4
358
359 zipWith5 :: (a -> b -> c -> d -> e -> f)
360 -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
361 -> Vector f
362 {-# INLINE zipWith5 #-}
363 zipWith5 = G.zipWith5
364
365 zipWith6 :: (a -> b -> c -> d -> e -> f -> g)
366 -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
367 -> Vector f -> Vector g
368 {-# INLINE zipWith6 #-}
369 zipWith6 = G.zipWith6
370
371 -- | Zip two vectors and their indices with the given function.
372 izipWith :: (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c
373 {-# INLINE izipWith #-}
374 izipWith = G.izipWith
375
376 -- | Zip three vectors and their indices with the given function.
377 izipWith3 :: (Int -> a -> b -> c -> d)
378 -> Vector a -> Vector b -> Vector c -> Vector d
379 {-# INLINE izipWith3 #-}
380 izipWith3 = G.izipWith3
381
382 izipWith4 :: (Int -> a -> b -> c -> d -> e)
383 -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
384 {-# INLINE izipWith4 #-}
385 izipWith4 = G.izipWith4
386
387 izipWith5 :: (Int -> a -> b -> c -> d -> e -> f)
388 -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
389 -> Vector f
390 {-# INLINE izipWith5 #-}
391 izipWith5 = G.izipWith5
392
393 izipWith6 :: (Int -> a -> b -> c -> d -> e -> f -> g)
394 -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
395 -> Vector f -> Vector g
396 {-# INLINE izipWith6 #-}
397 izipWith6 = G.izipWith6
398
399 zip :: Vector a -> Vector b -> Vector (a, b)
400 {-# INLINE zip #-}
401 zip = G.zip
402
403 zip3 :: Vector a -> Vector b -> Vector c -> Vector (a, b, c)
404 {-# INLINE zip3 #-}
405 zip3 = G.zip3
406
407 zip4 :: Vector a -> Vector b -> Vector c -> Vector d
408 -> Vector (a, b, c, d)
409 {-# INLINE zip4 #-}
410 zip4 = G.zip4
411
412 zip5 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector e
413 -> Vector (a, b, c, d, e)
414 {-# INLINE zip5 #-}
415 zip5 = G.zip5
416
417 zip6 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
418 -> Vector (a, b, c, d, e, f)
419 {-# INLINE zip6 #-}
420 zip6 = G.zip6
421
422 unzip :: Vector (a, b) -> (Vector a, Vector b)
423 {-# INLINE unzip #-}
424 unzip = G.unzip
425
426 unzip3 :: Vector (a, b, c) -> (Vector a, Vector b, Vector c)
427 {-# INLINE unzip3 #-}
428 unzip3 = G.unzip3
429
430 unzip4 :: Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d)
431 {-# INLINE unzip4 #-}
432 unzip4 = G.unzip4
433
434 unzip5 :: Vector (a, b, c, d, e)
435 -> (Vector a, Vector b, Vector c, Vector d, Vector e)
436 {-# INLINE unzip5 #-}
437 unzip5 = G.unzip5
438
439 unzip6 :: Vector (a, b, c, d, e, f)
440 -> (Vector a, Vector b, Vector c, Vector d, Vector e, Vector f)
441 {-# INLINE unzip6 #-}
442 unzip6 = G.unzip6
443
444 -- Filtering
445 -- ---------
446
447 -- | Drop elements which do not satisfy the predicate
448 filter :: (a -> Bool) -> Vector a -> Vector a
449 {-# INLINE filter #-}
450 filter = G.filter
451
452 -- | Drop elements that do not satisfy the predicate (applied to values and
453 -- their indices)
454 ifilter :: (Int -> a -> Bool) -> Vector a -> Vector a
455 {-# INLINE ifilter #-}
456 ifilter = G.ifilter
457
458 -- | Yield the longest prefix of elements satisfying the predicate.
459 takeWhile :: (a -> Bool) -> Vector a -> Vector a
460 {-# INLINE takeWhile #-}
461 takeWhile = G.takeWhile
462
463 -- | Drop the longest prefix of elements that satisfy the predicate.
464 dropWhile :: (a -> Bool) -> Vector a -> Vector a
465 {-# INLINE dropWhile #-}
466 dropWhile = G.dropWhile
467
468 -- Searching
469 -- ---------
470
471 infix 4 `elem`
472 -- | Check whether the vector contains an element
473 elem :: Eq a => a -> Vector a -> Bool
474 {-# INLINE elem #-}
475 elem = G.elem
476
477 infix 4 `notElem`
478 -- | Inverse of `elem`
479 notElem :: Eq a => a -> Vector a -> Bool
480 {-# INLINE notElem #-}
481 notElem = G.notElem
482
483 -- | Yield 'Just' the first element matching the predicate or 'Nothing' if no
484 -- such element exists.
485 find :: (a -> Bool) -> Vector a -> Maybe a
486 {-# INLINE find #-}
487 find = G.find
488
489 -- | Yield 'Just' the index of the first element matching the predicate or
490 -- 'Nothing' if no such element exists.
491 findIndex :: (a -> Bool) -> Vector a -> Maybe Int
492 {-# INLINE findIndex #-}
493 findIndex = G.findIndex
494
495 -- | Yield the indices of elements satisfying the predicate
496 findIndices :: (a -> Bool) -> Vector a -> Vector Int
497 {-# INLINE findIndices #-}
498 findIndices = G.findIndices
499
500 -- | Yield 'Just' the index of the first occurence of the given element or
501 -- 'Nothing' if the vector does not contain the element
502 elemIndex :: Eq a => a -> Vector a -> Maybe Int
503 {-# INLINE elemIndex #-}
504 elemIndex = G.elemIndex
505
506 -- | Yield the indices of all occurences of the given element
507 elemIndices :: Eq a => a -> Vector a -> Vector Int
508 {-# INLINE elemIndices #-}
509 elemIndices = G.elemIndices
510
511 -- Folding
512 -- -------
513
514 -- | Left fold
515 foldl :: (a -> b -> a) -> a -> Vector b -> a
516 {-# INLINE foldl #-}
517 foldl = G.foldl
518
519 -- | Lefgt fold on non-empty vectors
520 foldl1 :: (a -> a -> a) -> Vector a -> a
521 {-# INLINE foldl1 #-}
522 foldl1 = G.foldl1
523
524 -- | Left fold with strict accumulator
525 foldl' :: (a -> b -> a) -> a -> Vector b -> a
526 {-# INLINE foldl' #-}
527 foldl' = G.foldl'
528
529 -- | Left fold on non-empty vectors with strict accumulator
530 foldl1' :: (a -> a -> a) -> Vector a -> a
531 {-# INLINE foldl1' #-}
532 foldl1' = G.foldl1'
533
534 -- | Right fold
535 foldr :: (a -> b -> b) -> b -> Vector a -> b
536 {-# INLINE foldr #-}
537 foldr = G.foldr
538
539 -- | Right fold on non-empty vectors
540 foldr1 :: (a -> a -> a) -> Vector a -> a
541 {-# INLINE foldr1 #-}
542 foldr1 = G.foldr1
543
544 -- | Left fold (function applied to each element and its index)
545 ifoldl :: (a -> Int -> b -> a) -> a -> Vector b -> a
546 {-# INLINE ifoldl #-}
547 ifoldl = G.ifoldl
548
549 -- | Left fold with strict accumulator (function applied to each element and
550 -- its index)
551 ifoldl' :: (a -> Int -> b -> a) -> a -> Vector b -> a
552 {-# INLINE ifoldl' #-}
553 ifoldl' = G.ifoldl'
554
555 -- | Right fold (function applied to each element and its index)
556 ifoldr :: (Int -> a -> b -> b) -> b -> Vector a -> b
557 {-# INLINE ifoldr #-}
558 ifoldr = G.ifoldr
559
560 -- Specialised folds
561 -- -----------------
562
563 all :: (a -> Bool) -> Vector a -> Bool
564 {-# INLINE all #-}
565 all = G.all
566
567 any :: (a -> Bool) -> Vector a -> Bool
568 {-# INLINE any #-}
569 any = G.any
570
571 and :: Vector Bool -> Bool
572 {-# INLINE and #-}
573 and = G.and
574
575 or :: Vector Bool -> Bool
576 {-# INLINE or #-}
577 or = G.or
578
579 sum :: Num a => Vector a -> a
580 {-# INLINE sum #-}
581 sum = G.sum
582
583 product :: Num a => Vector a -> a
584 {-# INLINE product #-}
585 product = G.product
586
587 maximum :: Ord a => Vector a -> a
588 {-# INLINE maximum #-}
589 maximum = G.maximum
590
591 maximumBy :: (a -> a -> Ordering) -> Vector a -> a
592 {-# INLINE maximumBy #-}
593 maximumBy = G.maximumBy
594
595 minimum :: Ord a => Vector a -> a
596 {-# INLINE minimum #-}
597 minimum = G.minimum
598
599 minimumBy :: (a -> a -> Ordering) -> Vector a -> a
600 {-# INLINE minimumBy #-}
601 minimumBy = G.minimumBy
602
603 maxIndex :: Ord a => Vector a -> Int
604 {-# INLINE maxIndex #-}
605 maxIndex = G.maxIndex
606
607 maxIndexBy :: (a -> a -> Ordering) -> Vector a -> Int
608 {-# INLINE maxIndexBy #-}
609 maxIndexBy = G.maxIndexBy
610
611 minIndex :: Ord a => Vector a -> Int
612 {-# INLINE minIndex #-}
613 minIndex = G.minIndex
614
615 minIndexBy :: (a -> a -> Ordering) -> Vector a -> Int
616 {-# INLINE minIndexBy #-}
617 minIndexBy = G.minIndexBy
618
619 -- Unfolding
620 -- ---------
621
622 unfoldr :: (b -> Maybe (a, b)) -> b -> Vector a
623 {-# INLINE unfoldr #-}
624 unfoldr = G.unfoldr
625
626 -- Scans
627 -- -----
628
629 -- | Prefix scan
630 prescanl :: (a -> b -> a) -> a -> Vector b -> Vector a
631 {-# INLINE prescanl #-}
632 prescanl = G.prescanl
633
634 -- | Prefix scan with strict accumulator
635 prescanl' :: (a -> b -> a) -> a -> Vector b -> Vector a
636 {-# INLINE prescanl' #-}
637 prescanl' = G.prescanl'
638
639 -- | Suffix scan
640 postscanl :: (a -> b -> a) -> a -> Vector b -> Vector a
641 {-# INLINE postscanl #-}
642 postscanl = G.postscanl
643
644 -- | Suffix scan with strict accumulator
645 postscanl' :: (a -> b -> a) -> a -> Vector b -> Vector a
646 {-# INLINE postscanl' #-}
647 postscanl' = G.postscanl'
648
649 -- | Haskell-style scan
650 scanl :: (a -> b -> a) -> a -> Vector b -> Vector a
651 {-# INLINE scanl #-}
652 scanl = G.scanl
653
654 -- | Haskell-style scan with strict accumulator
655 scanl' :: (a -> b -> a) -> a -> Vector b -> Vector a
656 {-# INLINE scanl' #-}
657 scanl' = G.scanl'
658
659 -- | Scan over a non-empty 'Vector'
660 scanl1 :: (a -> a -> a) -> Vector a -> Vector a
661 {-# INLINE scanl1 #-}
662 scanl1 = G.scanl1
663
664 -- | Scan over a non-empty 'Vector' with a strict accumulator
665 scanl1' :: (a -> a -> a) -> Vector a -> Vector a
666 {-# INLINE scanl1' #-}
667 scanl1' = G.scanl1'
668
669 -- Enumeration
670 -- -----------
671
672 enumFromTo :: Enum a => a -> a -> Vector a
673 {-# INLINE enumFromTo #-}
674 enumFromTo = G.enumFromTo
675
676 enumFromThenTo :: Enum a => a -> a -> a -> Vector a
677 {-# INLINE enumFromThenTo #-}
678 enumFromThenTo = G.enumFromThenTo
679
680 -- Conversion to/from lists
681 -- ------------------------
682
683 -- | Convert a vector to a list
684 toList :: Vector a -> [a]
685 {-# INLINE toList #-}
686 toList = G.toList
687
688 -- | Convert a list to a vector
689 fromList :: [a] -> Vector a
690 {-# INLINE fromList #-}
691 fromList = G.fromList
692