I'm learning Haskell and a simple doubt struck me, what is the difference between these two commands to compile using GHC (fac is a program to calculate factorial) :
ghc -o fac fac.hs
and
ghc fac.hs
Now to run the program I just do fac.exe (I'm using Windows).
Given that both works which one is right? both? And which one is the most advisable to use?
Both are OK. The only thing the -o command does is determine the name of the executable file that is generated. As far as the Haskell goes it doesn't make any difference.
Personally, I like always using "-o" to make things explicit (since I like avoiding implicit defaults in general) and to make it look more similar to other compilers (for example, the gcc C compiler kind of forces you to use its "-o" option, since the default name it uses otherwise is very ugly)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With