Summary of useful GHC options
The last part of this chapter collects options for GHC and the Runtime System into a concise reference. Let's start off with GHC.
Basic usage
These are some of the most often used general flags related to compilation with GHC:
--make
: Compile a multi-module program-j<n>
: Parallel compilation-i
,-e
,runghc
: Interactive and evaluation modes-fforce-recomp
: Force recompilation-Wall
: Turn on all code-level warnings-Werror
: Turn all warnings into errors-freverse-errors
: Print top-most error last
The LLVM backend
The LLVM route is the preferred compilation path for numeric code. It requires the LLVM libraries and a compatible system. The flags used to enable LLVM are:
-fllvm
: Compile via LLVM-optlo-O3
: Enable optimizations in the LLVM backend
Turn optimizations on and off
GHC has a sophisticated optimization pipeline. Every optimization can be turned on and off separately, but that's rarely necessary. Good default sets of optimizations are enabled with the -O
family...