However, I also needed to use the command line options for the GHC runtime system in my compiled program.
The important thing to note (which I missed on a first sleepy reading) is this:
When your Haskell program starts up, its RTS extracts command-line arguments bracketed between
+RTS
and-RTS
as its own. For example:% ./a.out -f +RTS -p -S -RTS -h foo barThe RTS will snaffle
-p
-S
for itself, and the remaining arguments-f -h foo bar
will be handed to your program if/when it callsSystem.getArgs
.
If you do that, then you can use the command line arguments for the RTS along with whatever you have written into your program.