diff options
author | Ian Lynagh <igloo@earth.li> | 2008-08-05 15:02:50 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2008-08-05 15:02:50 +0000 |
commit | 12a50ca359e6479c554667b5fbceaed4013891d1 (patch) | |
tree | 21b78b1884dd31a4e0c7c37df2a33861af62d722 /libraries/base/Text | |
parent | 4875183e5f712fcfd3d40a87ef9f55d125dc437d (diff) | |
download | haskell-12a50ca359e6479c554667b5fbceaed4013891d1.tar.gz |
Fix warnings
Diffstat (limited to 'libraries/base/Text')
-rw-r--r-- | libraries/base/Text/ParserCombinators/ReadP.hs | 10 | ||||
-rw-r--r-- | libraries/base/Text/ParserCombinators/ReadPrec.hs | 4 | ||||
-rw-r--r-- | libraries/base/Text/Read/Lex.hs | 19 |
3 files changed, 18 insertions, 15 deletions
diff --git a/libraries/base/Text/ParserCombinators/ReadP.hs b/libraries/base/Text/ParserCombinators/ReadP.hs index 187a79602e..d286c5172b 100644 --- a/libraries/base/Text/ParserCombinators/ReadP.hs +++ b/libraries/base/Text/ParserCombinators/ReadP.hs @@ -114,7 +114,7 @@ instance Monad P where (Get f) >>= k = Get (\c -> f c >>= k) (Look f) >>= k = Look (\s -> f s >>= k) - Fail >>= k = Fail + Fail >>= _ = Fail (Result x p) >>= k = k x `mplus` (p >>= k) (Final r) >>= k = final [ys' | (x,s) <- r, ys' <- run (k x) s] @@ -218,9 +218,9 @@ R f1 +++ R f2 = R (\k -> f1 k `mplus` f2 k) -- locally produces any result at all, then right parser is -- not used. #ifdef __GLASGOW_HASKELL__ -R f <++ q = +R f0 <++ q = do s <- look - probe (f return) s 0# + probe (f0 return) s 0# where probe (Get f) (c:s) n = probe (f c) s (n+#1#) probe (Look f) s n = probe (f s) s n @@ -258,10 +258,10 @@ gather (R m) = R (\k -> gath id (m (\a -> return (\s -> k (s,a))))) where gath l (Get f) = Get (\c -> gath (l.(c:)) (f c)) - gath l Fail = Fail + gath _ Fail = Fail gath l (Look f) = Look (\s -> gath l (f s)) gath l (Result k p) = k (l []) `mplus` gath l p - gath l (Final r) = error "do not use readS_to_P in gather!" + gath _ (Final _) = error "do not use readS_to_P in gather!" -- --------------------------------------------------------------------------- -- Derived operations diff --git a/libraries/base/Text/ParserCombinators/ReadPrec.hs b/libraries/base/Text/ParserCombinators/ReadPrec.hs index 88b5678be2..361f11af86 100644 --- a/libraries/base/Text/ParserCombinators/ReadPrec.hs +++ b/libraries/base/Text/ParserCombinators/ReadPrec.hs @@ -68,7 +68,7 @@ import GHC.Base -- --------------------------------------------------------------------------- -- The readPrec type -newtype ReadPrec a = P { unP :: Prec -> ReadP a } +newtype ReadPrec a = P (Prec -> ReadP a) -- Functor, Monad, MonadPlus @@ -104,7 +104,7 @@ step (P f) = P (\n -> f (n+1)) reset :: ReadPrec a -> ReadPrec a -- ^ Resets the precedence context to zero. -reset (P f) = P (\n -> f minPrec) +reset (P f) = P (\_ -> f minPrec) prec :: Prec -> ReadPrec a -> ReadPrec a -- ^ @(prec n p)@ checks whether the precedence context is diff --git a/libraries/base/Text/Read/Lex.hs b/libraries/base/Text/Read/Lex.hs index a2acf471a3..94292e0a2c 100644 --- a/libraries/base/Text/Read/Lex.hs +++ b/libraries/base/Text/Read/Lex.hs @@ -162,10 +162,10 @@ lexChar = do { (c,_) <- lexCharE; return c } lexCharE :: ReadP (Char, Bool) -- "escaped or not"? lexCharE = - do c <- get - if c == '\\' - then do c <- lexEsc; return (c, True) - else do return (c, False) + do c1 <- get + if c1 == '\\' + then do c2 <- lexEsc; return (c2, True) + else do return (c1, False) where lexEsc = lexEscChar @@ -360,8 +360,8 @@ lexFrac :: ReadP (Maybe Digits) -- Read the fractional part; fail if it doesn't -- start ".d" where d is a digit lexFrac = do char '.' - frac <- lexDigits 10 - return (Just frac) + fraction <- lexDigits 10 + return (Just fraction) lexExp :: ReadP (Maybe Integer) lexExp = do char 'e' +++ char 'E' @@ -393,13 +393,13 @@ lexInteger base = val :: Num a => a -> a -> Digits -> a -- val base y [d1,..,dn] = y ++ [d1,..,dn], as it were -val base y [] = y +val _ y [] = y val base y (x:xs) = y' `seq` val base y' xs where y' = y * base + fromIntegral x frac :: Integral a => a -> a -> a -> Digits -> Ratio a -frac base a b [] = a % b +frac _ a b [] = a % b frac base a b (x:xs) = a' `seq` b' `seq` frac base a' b' xs where a' = a * base + fromIntegral x @@ -418,6 +418,9 @@ valDig 16 c | 'A' <= c && c <= 'F' = Just (ord c - ord 'A' + 10) | otherwise = Nothing +valDig _ _ = error "valDig: Bad base" + +valDecDig :: Char -> Maybe Int valDecDig c | '0' <= c && c <= '9' = Just (ord c - ord '0') | otherwise = Nothing |