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