Skip to content

Commit dab902b

Browse files
committed
Fixed warnings in Data/Vector/Generic.hs
- Removed unused imports - Data.Vector.Generic.Mutable - Date.Vector.Fusion.Bundle Step(..) - qualified Control.Monad - qualified Data.List - Removed unused variable bindings - Renamed comparison functions to avoid shadowing
1 parent 887a5f8 commit dab902b

File tree

1 file changed

+29
-32
lines changed

1 file changed

+29
-32
lines changed

Data/Vector/Generic.hs

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,13 @@ module Data.Vector.Generic (
163163

164164
import Data.Vector.Generic.Base
165165

166-
import Data.Vector.Generic.Mutable ( MVector )
167166
import qualified Data.Vector.Generic.Mutable as M
168167

169168
import qualified Data.Vector.Generic.New as New
170169
import Data.Vector.Generic.New ( New )
171170

172171
import qualified Data.Vector.Fusion.Bundle as Bundle
173-
import Data.Vector.Fusion.Bundle ( Bundle, MBundle, Step(..), lift, inplace )
172+
import Data.Vector.Fusion.Bundle ( Bundle, MBundle, lift, inplace )
174173
import qualified Data.Vector.Fusion.Bundle.Monadic as MBundle
175174
import Data.Vector.Fusion.Stream.Monadic ( Stream )
176175
import qualified Data.Vector.Fusion.Stream.Monadic as S
@@ -179,8 +178,6 @@ import Data.Vector.Fusion.Util
179178

180179
import Control.Monad.ST ( ST, runST )
181180
import Control.Monad.Primitive
182-
import qualified Control.Monad as Monad
183-
import qualified Data.List as List
184181
import Prelude hiding ( length, null,
185182
replicate, (++), concat,
186183
head, last,
@@ -573,7 +570,7 @@ constructN !n f = runST (
573570
v'' <- unsafeFreeze v'
574571
fill v'' (i+1)
575572

576-
fill v i = return v
573+
fill v _ = return v
577574

578575
-- | /O(n)/ Construct a vector with @n@ elements from right to left by
579576
-- repeatedly applying the generator function to the already constructed part
@@ -602,7 +599,7 @@ constructrN !n f = runST (
602599
v'' <- unsafeFreeze v'
603600
fill v'' (i+1)
604601

605-
fill v i = return v
602+
fill v _ = return v
606603

607604

608605
-- Enumeration
@@ -1228,39 +1225,39 @@ unzip xs = (map fst xs, map snd xs)
12281225
unzip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c))
12291226
=> v (a, b, c) -> (v a, v b, v c)
12301227
{-# INLINE unzip3 #-}
1231-
unzip3 xs = (map (\(a, b, c) -> a) xs,
1232-
map (\(a, b, c) -> b) xs,
1233-
map (\(a, b, c) -> c) xs)
1228+
unzip3 xs = (map (\(a, _, _) -> a) xs,
1229+
map (\(_, b, _) -> b) xs,
1230+
map (\(_, _, c) -> c) xs)
12341231

12351232
unzip4 :: (Vector v a, Vector v b, Vector v c, Vector v d,
12361233
Vector v (a, b, c, d))
12371234
=> v (a, b, c, d) -> (v a, v b, v c, v d)
12381235
{-# INLINE unzip4 #-}
1239-
unzip4 xs = (map (\(a, b, c, d) -> a) xs,
1240-
map (\(a, b, c, d) -> b) xs,
1241-
map (\(a, b, c, d) -> c) xs,
1242-
map (\(a, b, c, d) -> d) xs)
1236+
unzip4 xs = (map (\(a, _, _, _) -> a) xs,
1237+
map (\(_, b, _, _) -> b) xs,
1238+
map (\(_, _, c, _) -> c) xs,
1239+
map (\(_, _, _, d) -> d) xs)
12431240

12441241
unzip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e,
12451242
Vector v (a, b, c, d, e))
12461243
=> v (a, b, c, d, e) -> (v a, v b, v c, v d, v e)
12471244
{-# INLINE unzip5 #-}
1248-
unzip5 xs = (map (\(a, b, c, d, e) -> a) xs,
1249-
map (\(a, b, c, d, e) -> b) xs,
1250-
map (\(a, b, c, d, e) -> c) xs,
1251-
map (\(a, b, c, d, e) -> d) xs,
1252-
map (\(a, b, c, d, e) -> e) xs)
1245+
unzip5 xs = (map (\(a, _, _, _, _) -> a) xs,
1246+
map (\(_, b, _, _, _) -> b) xs,
1247+
map (\(_, _, c, _, _) -> c) xs,
1248+
map (\(_, _, _, d, _) -> d) xs,
1249+
map (\(_, _, _, _, e) -> e) xs)
12531250

12541251
unzip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e,
12551252
Vector v f, Vector v (a, b, c, d, e, f))
12561253
=> v (a, b, c, d, e, f) -> (v a, v b, v c, v d, v e, v f)
12571254
{-# INLINE unzip6 #-}
1258-
unzip6 xs = (map (\(a, b, c, d, e, f) -> a) xs,
1259-
map (\(a, b, c, d, e, f) -> b) xs,
1260-
map (\(a, b, c, d, e, f) -> c) xs,
1261-
map (\(a, b, c, d, e, f) -> d) xs,
1262-
map (\(a, b, c, d, e, f) -> e) xs,
1263-
map (\(a, b, c, d, e, f) -> f) xs)
1255+
unzip6 xs = (map (\(a, _, _, _, _, _) -> a) xs,
1256+
map (\(_, b, _, _, _, _) -> b) xs,
1257+
map (\(_, _, c, _, _, _) -> c) xs,
1258+
map (\(_, _, _, d, _, _) -> d) xs,
1259+
map (\(_, _, _, _, e, _) -> e) xs,
1260+
map (\(_, _, _, _, _, f) -> f) xs)
12641261

12651262
-- Filtering
12661263
-- ---------
@@ -1528,10 +1525,10 @@ maximum = Bundle.foldl1' max . stream
15281525
-- comparison function. The vector may not be empty.
15291526
maximumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a
15301527
{-# INLINE maximumBy #-}
1531-
maximumBy cmp = Bundle.foldl1' maxBy . stream
1528+
maximumBy cmpr = Bundle.foldl1' maxBy . stream
15321529
where
15331530
{-# INLINE maxBy #-}
1534-
maxBy x y = case cmp x y of
1531+
maxBy x y = case cmpr x y of
15351532
LT -> y
15361533
_ -> x
15371534

@@ -1545,10 +1542,10 @@ minimum = Bundle.foldl1' min . stream
15451542
-- comparison function. The vector may not be empty.
15461543
minimumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a
15471544
{-# INLINE minimumBy #-}
1548-
minimumBy cmp = Bundle.foldl1' minBy . stream
1545+
minimumBy cmpr = Bundle.foldl1' minBy . stream
15491546
where
15501547
{-# INLINE minBy #-}
1551-
minBy x y = case cmp x y of
1548+
minBy x y = case cmpr x y of
15521549
GT -> y
15531550
_ -> x
15541551

@@ -1562,10 +1559,10 @@ maxIndex = maxIndexBy compare
15621559
-- the given comparison function. The vector may not be empty.
15631560
maxIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int
15641561
{-# INLINE maxIndexBy #-}
1565-
maxIndexBy cmp = fst . Bundle.foldl1' imax . Bundle.indexed . stream
1562+
maxIndexBy cmpr = fst . Bundle.foldl1' imax . Bundle.indexed . stream
15661563
where
15671564
imax (i,x) (j,y) = i `seq` j `seq`
1568-
case cmp x y of
1565+
case cmpr x y of
15691566
LT -> (j,y)
15701567
_ -> (i,x)
15711568

@@ -1579,10 +1576,10 @@ minIndex = minIndexBy compare
15791576
-- the given comparison function. The vector may not be empty.
15801577
minIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int
15811578
{-# INLINE minIndexBy #-}
1582-
minIndexBy cmp = fst . Bundle.foldl1' imin . Bundle.indexed . stream
1579+
minIndexBy cmpr = fst . Bundle.foldl1' imin . Bundle.indexed . stream
15831580
where
15841581
imin (i,x) (j,y) = i `seq` j `seq`
1585-
case cmp x y of
1582+
case cmpr x y of
15861583
GT -> (j,y)
15871584
_ -> (i,x)
15881585

0 commit comments

Comments
 (0)