Skip to content

GHC ignores command-line options if *.o and *.hi files exist

For example, given the module

module Test where

foo = putStrLn "Hello World"

if I compile using the command

ghc -c Test.hs

and then I compile adding the -Wall flag

ghc -c -Wall Test.hs

I would expect the warning

Test.hs:3:1: Warning:
    Top-level binding with no type signature: foo :: IO ()

but GHC produces the message

compilation IS NOT required

That is, the -Wall flag was ignored because the Test.o and Test.hi exist.

(I couldn't reproduce this behaviour using GCC (the GNU Compiler Collection) version 4.6.3.)

Edited by Andrés Sicard-Ramírez
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information