Reputation: 16850
I often have situations where I leave main :: IO ()
functions in tests. I can run these fine with runghc
, but sometimes I want to compile them (e.g. for running on another platform). Is there a way to do this? If I run, for example,
ghc --make Test.Haar
where Test/Haar.hs
has a main
method, then nothing happens, it just creates the .o
file.
Upvotes: 9
Views: 256
Reputation: 183873
Note, however, that after using -main-is Test.Haar
, if you want to use the module as part of another programme, you have to recompile it without the -main-is
, otherwise the linker will find two entry-points and throw an error.
Upvotes: 4