On 12-02-14 03:01 PM, JP Moresmau wrote:
I'm confused: I'm using GHC 7.0.2 and Cabal 1.10.1.0 with cabal-install 0.10.2. I use -Wall in my Cabal file. If I build a Haskell file with unused do binds, via the GHC API I get no warning, which is normal, since the doc states: The warnings that are not enabled by -Wall are ..., -fwarn-unused-do-bind .... But if I build my project through cabal it gives me the warning! Why is compiling with Cabal giving that extra warning that GHC on its own with the same flags doesn't give? Using --verbose on cabal build does not give any clue, no suspicious extra flag is passed on.
The plot thickens as I perform some experiments. Experiment #1: main :: IO () main = do { x <- getLine; putStrLn "thank you" } ghc -Wall => Warning: Defined but not used: `x' ghc -fwarn-unused-do-bind => (no warning) Apparently, warn-unused-do-bind does not mean that x is unused. Experiment #2: main :: IO () main = do { getLine; putStrLn "thank you" } ghc -fwarn-unused-do-bind => Warning: A do-notation statement discarded a result of type String. Suppress this warning by saying "_ <- getLine", or by using the flag -fno-warn-unused-do-bind ghc -Wall => Warning: A do-notation statement discarded a result of type String. Suppress this warning by saying "_ <- getLine", or by using the flag -fno-warn-unused-do-bind ghc -Wall -fno-warn-unused-do-bind => (no warning) Apparently, -Wall turns on -fwarn-unused-do-bind, despite the user guide. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe