Sometimes, I write code to a file solely for the purpose of checking whether it compiles -- with no interest in the generated binaries.
For example, if I am doing a learning exercise and want to produce some error or see if certain code compiles without error, I'd like to see the ordinary compile output printed to the terminal but without generating the *.hi or *.o files that occur by running ghc <myprogram>.hs
.
I sometimes effectively do this using runhaskell
, but that is not ideal -- it requires a main
function, and actually runs the program whereas I am just looking for a compilation check.
Is there some way to suppress generation when running GHC, only displaying the ordinary compilation errors and warnings?