Fix more warnings
authorIan Lynagh <igloo@earth.li>
Wed, 20 Aug 2008 23:19:37 +0000 (23:19 +0000)
committerIan Lynagh <igloo@earth.li>
Wed, 20 Aug 2008 23:19:37 +0000 (23:19 +0000)
Control/Arrow.hs
Control/Monad/Fix.hs
Control/Monad/Instances.hs
Data/Function.hs
GHC/Exts.hs
GHC/PArr.hs

index 174e695..ed9fa73 100644 (file)
@@ -164,7 +164,7 @@ class Arrow a => ArrowZero a where
         zeroArrow :: a b c
 
 instance MonadPlus m => ArrowZero (Kleisli m) where
-        zeroArrow = Kleisli (\x -> mzero)
+        zeroArrow = Kleisli (\_ -> mzero)
 
 class ArrowZero a => ArrowPlus a where
         (<+>) :: a b c -> a b c -> a b c
@@ -255,7 +255,7 @@ instance Monad m => ArrowApply (Kleisli m) where
 newtype ArrowApply a => ArrowMonad a b = ArrowMonad (a () b)
 
 instance ArrowApply a => Monad (ArrowMonad a) where
-        return x = ArrowMonad (arr (\z -> x))
+        return x = ArrowMonad (arr (\_ -> x))
         ArrowMonad m >>= f = ArrowMonad (m >>>
                         arr (\x -> let ArrowMonad h = f x in (h, ())) >>>
                         app)
index d058220..c1b4fe1 100644 (file)
@@ -63,6 +63,7 @@ class (Monad m) => MonadFix m where
 instance MonadFix Maybe where
     mfix f = let a = f (unJust a) in a
              where unJust (Just x) = x
+                   unJust Nothing  = error "mfix Maybe: Nothing"
 
 -- List:
 instance MonadFix [] where
index 63c943f..ae7ef65 100644 (file)
@@ -1,4 +1,5 @@
 {-# OPTIONS_NHC98 --prelude #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Control.Monad.Instances
index bc851a0..64ebfd0 100644 (file)
@@ -80,4 +80,4 @@ fix f = let x = f x in x
 --   flip on (g . f)
 
 on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
-(*) `on` f = \x y -> f x * f y
+(.*.) `on` f = \x y -> f x .*. f y
index bc36771..9bdf128 100644 (file)
@@ -92,7 +92,7 @@ groupWith :: Ord b => (a -> b) -> [a] -> [[a]]
 groupWith f xs = build (\c n -> groupByFB c n (\x y -> f x == f y) (sortWith f xs))
 
 groupByFB :: ([a] -> lst -> lst) -> lst -> (a -> a -> Bool) -> [a] -> lst
-groupByFB c n eq xs = groupByFBCore xs
+groupByFB c n eq xs0 = groupByFBCore xs0
   where groupByFBCore [] = n
         groupByFBCore (x:xs) = c (x:ys) (groupByFBCore zs)
             where (ys, zs) = span (eq x) xs
index 726c687..ce93fbd 100644 (file)
@@ -215,14 +215,14 @@ foldlP     :: (a -> b -> a) -> a -> [:b:] -> a
 foldlP f z  = snd . loop (foldEFL (flip f)) z
 
 foldl1P        :: (a -> a -> a) -> [:a:] -> a
-foldl1P f [::]  = error "Prelude.foldl1P: empty array"
+foldl1P _ [::]  = error "Prelude.foldl1P: empty array"
 foldl1P f a     = snd $ loopFromTo 1 (lengthP a - 1) (foldEFL f) (a!:0) a
 
 scanlP     :: (a -> b -> a) -> a -> [:b:] -> [:a:]
 scanlP f z  = fst . loop (scanEFL (flip f)) z
 
 scanl1P        :: (a -> a -> a) -> [:a:] -> [:a:]
-scanl1P f [::]  = error "Prelude.scanl1P: empty array"
+scanl1P _ [::]  = error "Prelude.scanl1P: empty array"
 scanl1P f a     = fst $ loopFromTo 1 (lengthP a - 1) (scanEFL f) (a!:0) a
 
 foldrP :: (a -> b -> b) -> b -> [:a:] -> b
@@ -353,9 +353,9 @@ unzipP   :: [:(a, b):] -> ([:a:], [:b:])
 unzipP a  = (fst $ loop (mapEFL fst) noAL a, fst $ loop (mapEFL snd) noAL a)
 -- FIXME: these two functions should be optimised using a tupled custom loop
 unzip3P   :: [:(a, b, c):] -> ([:a:], [:b:], [:c:])
-unzip3P a  = (fst $ loop (mapEFL fst3) noAL a, 
-              fst $ loop (mapEFL snd3) noAL a,
-              fst $ loop (mapEFL trd3) noAL a)
+unzip3P x  = (fst $ loop (mapEFL fst3) noAL x, 
+              fst $ loop (mapEFL snd3) noAL x,
+              fst $ loop (mapEFL trd3) noAL x)
              where
                fst3 (a, _, _) = a
                snd3 (_, b, _) = b
@@ -420,13 +420,13 @@ instance Read a => Read [:a:]  where
 -- properly fuse the following definitions.
 
 enumFromToP     :: Enum a => a -> a -> [:a:]
-enumFromToP x y  = mapP toEnum (eftInt (fromEnum x) (fromEnum y))
+enumFromToP x0 y0  = mapP toEnum (eftInt (fromEnum x0) (fromEnum y0))
   where
     eftInt x y = scanlP (+) x $ replicateP (y - x + 1) 1
 
 enumFromThenToP       :: Enum a => a -> a -> a -> [:a:]
-enumFromThenToP x y z  = 
-  mapP toEnum (efttInt (fromEnum x) (fromEnum y) (fromEnum z))
+enumFromThenToP x0 y0 z0  = 
+  mapP toEnum (efttInt (fromEnum x0) (fromEnum y0) (fromEnum z0))
   where
     efttInt x y z = scanlP (+) x $ 
                       replicateP (abs (z - x) `div` abs delta + 1) delta
@@ -623,8 +623,8 @@ loopFromTo :: Int                        -- from index
 loopFromTo from to mf start arr = runST (do
   marr      <- newArray (to - from + 1) noElem
   (n', acc) <- trans from to marr arr mf start
-  arr       <- mkPArr n' marr
-  return (arr, acc))
+  arr'      <- mkPArr n' marr
+  return (arr', acc))
   where
     noElem = error "GHC.PArr.loopFromTo: I do not exist!"
              -- unlike standard Haskell arrays, this value represents an
@@ -681,13 +681,13 @@ noAL  = ()
 --
 mapEFL   :: (e -> e') -> (e -> () -> (Maybe e', ()))
 {-# INLINE mapEFL #-}
-mapEFL f  = \e a -> (Just $ f e, ())
+mapEFL f  = \e _ -> (Just $ f e, ())
 
 -- `loop' mutator that filter elements according to a predicate
 --
 filterEFL   :: (e -> Bool) -> (e -> () -> (Maybe e, ()))
 {-# INLINE filterEFL #-}
-filterEFL p  = \e a -> if p e then (Just e, ()) else (Nothing, ())
+filterEFL p  = \e _ -> if p e then (Just e, ()) else (Nothing, ())
 
 -- `loop' mutator for array folding
 --