5.6. Flag reference¶
This section is a quick-reference for GHC’s command-line flags. For each flag, we also list its mode/dynamic status (see Dynamic and Mode options), and the flag’s opposite (if available).
5.6.1. Verbosity options¶
More details in Verbosity options
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| default: off. Toggles whether refinements where one or more of the holes are abstract are reported. | dynamic | ||
| Defer and group diagnostic messages by severity | dynamic | ||
| Use colors in error messages | dynamic | ||
| Whether to show snippets of original source code | dynamic | ||
| Output full span in error messages | dynamic | ||
| hide module source and object paths | dynamic | ||
| Continue compilation as far as possible on errors | dynamic | ||
| default: 6. Set the maximum number of refinement hole fits for typed holes to display in type error messages. | dynamic | ||
| default: 6. Set the maximum number of bindings to display in type error messages. | dynamic | ||
| default: 6. Set the maximum number of valid hole fits for typed holes to display in type error messages. | dynamic | ||
| Disables showing a list of valid hole fits for typed holes in type error messages. | dynamic | ||
| Disables the sorting of the list of valid hole fits for typed holes in type error messages. | dynamic | ||
| Display equation incompatibilities in closed type families | dynamic | ||
| Distinguish between equality relations when printing | dynamic | ||
| In type errors, also print type-synonym-expanded types. | dynamic | ||
| Print coercions in types | dynamic | ||
| Print explicit  | dynamic | ||
| Print explicit kind foralls and kind arguments in types.
See also  | dynamic | ||
| Print  | dynamic | ||
| display all available instances in type error messages | dynamic | ||
| Print extra information from typechecker. | dynamic | ||
| Use unicode syntax when printing expressions, types and kinds.
See also  | dynamic | ||
| default: off. Sets the level of refinement of the
refinement hole fits, where level  | dynamic | ||
| Output errors in reverse order | dynamic | ||
| Toggles whether to show the documentation of the valid hole fits in the output. | dynamic | ||
| Show constraints when reporting typed holes. | dynamic | ||
| Toggles whether to show the type of the additional holes in refinement hole fits. | dynamic | ||
| Toggles whether to show the provenance of the valid hole fits in the output. | dynamic | ||
| Toggles whether to show the type application of the valid hole fits in the output. | dynamic | ||
| Toggles whether to show what type each quantified variable takes in a valid hole fit. | dynamic | ||
| Toggles whether to show the type of the valid hole fits in the output. | dynamic | ||
| Sort valid hole fits by size. | dynamic | ||
| Sort valid hole fits by subsumption. | dynamic | ||
| Unclutter the list of valid hole fits by not showing provenance nor type applications of suggestions. | dynamic | ||
| Summarise timing stats for GHC (same as  | dynamic | ||
| verbose mode (equivalent to  | dynamic | ||
| set verbosity level | dynamic | 
5.6.2. Alternative modes of operation¶
More details in Modes of operation
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| run GHC with the given frontend plugin; see Frontend plugins for details. | mode | ||
| Display help | mode | ||
| display information about the compiler | mode | ||
| Interactive mode - normally used by just running  | mode | ||
| Build a multi-module Haskell program, automatically figuring out
dependencies. Likely to be much easier, and faster, than using
 | mode | ||
| DLL-creation mode (Windows only) | mode | ||
| display GHC version (numeric only) | mode | ||
| display GHC library directory | mode | ||
| display the contents of an interface file. | mode | ||
| display the supported command line options | mode | ||
| display the supported language extensions | mode | ||
| display GHC version | mode | ||
| Evaluate  | mode | ||
| generate dependency information suitable for use in a
 | mode | 
5.6.3. Which phases to run¶
More details in Batch compiler mode
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Stop after generating C ( | mode | ||
| Stop after generating object ( | mode | ||
| Stop after preprocessing ( | mode | ||
| Enable the use of a pre-processor
(set with  | dynamic | ||
| Stop after generating assembly ( | mode | ||
| Override default behaviour for source files | dynamic | 
5.6.4. Redirecting output¶
More details in Redirecting the compilation output(s)
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Regard  | dynamic | ||
| Dump module cycles | dynamic | ||
| Use ⟨file⟩ as the makefile | dynamic | ||
| Make dependencies that declare that files with suffix
 | dynamic | ||
| redirect dump files | dynamic | ||
| set the suffix to use for intermediate C files | dynamic | ||
| set directory for interface files | dynamic | ||
| set directory for extended interface files | dynamic | ||
| set the suffix to use for extended interface files | dynamic | ||
| set the suffix to use for interface files | dynamic | ||
| Include preprocessor dependencies | dynamic | ||
| Regard modules imported from packages as unstable | dynamic | ||
| set output filename | dynamic | ||
| set directory for object files | dynamic | ||
| set the filename in which to put the interface | dynamic | ||
| set the output file suffix | dynamic | ||
| set output directory | dynamic | ||
| redirect FFI stub files | dynamic | 
5.6.5. Keeping intermediate files¶
More details in Keeping Intermediate Files
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Retain intermediate  | dynamic | ||
| Retain intermediate  | dynamic | ||
| Retain intermediate  | dynamic | ||
| Retain intermediate LLVM  | dynamic | ||
| Retain intermediate  | dynamic | ||
| Retain intermediate  | dynamic | ||
| Retain all intermediate temporary files. | dynamic | 
5.6.6. Temporary files¶
More details in Redirecting temporary files
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| set the directory for temporary files | dynamic | 
5.6.7. Finding imports¶
More details in The search path
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Empty the import directory list | dynamic | ||
| add ⟨dir⟩, ⟨dir2⟩, etc. to import path | dynamic | 
5.6.8. Interface file options¶
More details in Other options related to interface files
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| See Modes of operation. | mode | ||
| Dump the new interface to stdout | dynamic | ||
| Show the differences vs. the old interface | dynamic | ||
| Dump a minimal set of imports | dynamic | 
5.6.9. Recompilation checking¶
More details in The recompilation checker
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Turn off recompilation checking. This is implied by any
 | dynamic | ||
| Do not recompile modules just to match changes to HPC flags. This is especially useful for avoiding recompilation when using GHCi, and is enabled by default for GHCi. | dynamic | ||
| Do not recompile modules just to match changes to optimisation flags. This is especially useful for avoiding recompilation when using GHCi, and is enabled by default for GHCi. | dynamic | 
5.6.10. Interactive-mode options¶
More details in The .ghci and .haskeline files
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| dynamic | |||
| dynamic | |||
| Set the number of entries GHCi keeps for  | dynamic | ||
| (Debugging only) check for space leaks when loading new modules in GHCi. | dynamic | ||
| Use current directory for the GHCi command history
file  | dynamic | ||
| No longer set the special variable  | dynamic | ||
| dynamic | |||
| Instruct  | dynamic | ||
| Show the names of modules that GHCi loaded after a
 | dynamic | ||
| Read additional  | dynamic | ||
| Disable reading of  | dynamic | ||
| Select the function to use for printing evaluated expressions in GHCi | dynamic | 
5.6.11. Packages¶
More details in Packages
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Clear the package db stack. | dynamic | ||
| Expose package ⟨pkg⟩ and set it to be distrusted. See Safe Haskell. | dynamic | ||
| Distrust all packages by default. See Safe Haskell. | dynamic | ||
| Enable Safe Haskell trusted package requirement for trustworthy modules. | dynamic | ||
| Add the global package db to the stack. | dynamic | ||
| Hide all packages by default | dynamic | ||
| Hide package ⟨pkg⟩ | dynamic | ||
| Ignore package ⟨pkg⟩ | dynamic | ||
| Don't automatically link in the base and rts packages. | dynamic | ||
| Remove the global package db from the stack. | dynamic | ||
| Remove the user's package db from the stack. | dynamic | ||
| Expose package ⟨pkg⟩ | dynamic | ||
| Add ⟨file⟩ to the package db stack. | dynamic | ||
| Use the specified package environment. | dynamic | ||
| Expose package by id ⟨unit-id⟩ | dynamic | ||
| Compile to be part of unit (i.e. package) ⟨unit-id⟩ | dynamic | ||
| Expose package ⟨pkg⟩ and set it to be trusted. See Safe Haskell. | dynamic | ||
| Add the user's package db to the stack. | dynamic | 
5.6.12. Language options¶
Language options can be enabled either by a command-line option
-Xblah, or by a {-# LANGUAGE blah #-} pragma in the file itself.
See Controlling extensions.
5.6.13. Warnings¶
More details in Warnings and sanity-checking
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Convert variable out of scope variables errors into warnings.
Implied by  | dynamic | ||
| Turn type errors into warnings, deferring the error until
runtime. Implies
 | dynamic | ||
| Convert typed hole errors into warnings,
deferring the error until runtime.
Implied by  | dynamic | ||
| Generate warnings for Template Haskell splices | dynamic | ||
| Make suggestions for mis-spelled names. | dynamic | ||
| soft limit on the number of parallel models the pattern match checker should check a pattern match clause against | dynamic | ||
| show which group an emitted warning belongs to. | dynamic | ||
| use the C code generator | dynamic | ||
| enable normal warnings | dynamic | ||
| disable all warnings | dynamic | ||
| enable almost all warnings (details in Warnings and sanity-checking) | dynamic | ||
| warn when specialisation of any overloaded function fails. | dynamic | ||
| (deprecated) Does nothing | dynamic | ||
| enable future compatibility warnings (details in Warnings and sanity-checking) | dynamic | ||
| Report unqualified imports of core libraries which are expected to cause compatibility problems in future releases. | dynamic | ||
| warn on uses of the #if directive on undefined identifiers | dynamic | ||
| enable default flags | dynamic | ||
| Report warnings when variable out-of-scope errors are
deferred until runtime.
See  | dynamic | ||
| Report warnings when deferred type errors are enabled. This option is enabled by
default. See  | dynamic | ||
| warn about uses of commandline flags that are deprecated | dynamic | ||
| warn about uses of functions & types that have warnings or
deprecated pragmas. Alias for  | dynamic | ||
| warn about default deriving when using both
 | dynamic | ||
| warn when Typeable is derived | dynamic | ||
| warn about dodgy exports | dynamic | ||
| warn about dodgy foreign imports | dynamic | ||
| warn about dodgy imports | dynamic | ||
| warn when a constraint appears duplicated in a type signature | dynamic | ||
| warn when an entity is exported multiple times | dynamic | ||
| warn about enumerations that are empty | dynamic | ||
| make warnings fatal | dynamic | ||
| enable all warnings supported by GHC | dynamic | ||
| (deprecated)
warn when a  | dynamic | ||
| warn about uses of Prelude numeric conversions that are probably the identity (and hence could be omitted) | dynamic | ||
| warn when kind variables are implicitly quantified over. | dynamic | ||
| warn when the Prelude is implicitly imported | dynamic | ||
| warn about inaccessible code | dynamic | ||
| warn when a pattern match could fail | dynamic | ||
| warn when a record update could fail | dynamic | ||
| warn when a pattern match in a lambda expression or pattern binding could fail | dynamic | ||
| warn when an explicitly Safe Haskell module imports a Safe-Inferred one | dynamic | ||
| Warn if a rewrite RULE might fail to fire because the function might be inlined before the rule has a chance to fire. See How rules interact with INLINE/NOINLINE pragmas. | dynamic | ||
| warn when a Haddock comment occurs in an invalid position | dynamic | ||
| Warn when GHCi can't load a shared lib. | dynamic | ||
| warn when specialisation of an imported, overloaded function fails. | dynamic | ||
| warn when a deriving clause is missing a deriving strategy | dynamic | ||
| warn when a module declaration does not explicitly list all exports | dynamic | ||
| warn about top-level functions without signatures, only if they are exported. takes precedence over -Wmissing-signatures | dynamic | ||
| (deprecated) warn about top-level functions without signatures, only if they are exported. takes precedence over -Wmissing-signatures | dynamic | ||
| warn when fields of a record are uninitialised | dynamic | ||
| warn when encountering a home module imported, but not listed
on the command line. Useful for cabal to ensure GHC won't pick
up modules, not listed neither in  | dynamic | ||
| warn when an import declaration does not explicitly list all the names brought into scope | dynamic | ||
| warn about polymorphic local bindings without signatures | dynamic | ||
| (deprecated) warn about polymorphic local bindings without signatures | dynamic | ||
| warn when class methods are undefined | dynamic | ||
| Warn when a failable pattern is used in a do-block that does
not have a  | dynamic | ||
| warn when pattern synonyms do not have type signatures | dynamic | ||
| warn when the Safe Haskell mode is not explicitly specified. | dynamic | ||
| warn about top-level functions without signatures | dynamic | ||
| (deprecated) Does nothing | dynamic | ||
| warn when the Monomorphism Restriction is applied | dynamic | ||
| warn when names are shadowed | dynamic | ||
| Disables all warnings enabled by  | dynamic | ||
| warn when  | dynamic | ||
| warn when  | dynamic | ||
| warn when  | dynamic | ||
| warn when the module contains orphan instance declarations or rewrite rules | dynamic | ||
| warn about literals that will overflow their type | dynamic | ||
| warn about overlapping patterns | dynamic | ||
| warn when defining a partial record field. | dynamic | ||
| warn about holes in partial type signatures when
 | dynamic | ||
| Have the compiler warn about redundant constraints in type signatures. | dynamic | ||
| Warn about record wildcard matches when the wildcard binds no patterns. | dynamic | ||
| warn if the module being compiled is regarded to be safe. | dynamic | ||
| warn when a  | dynamic | ||
| Warn about class constraints in a type signature that can be simplified using a top-level instance declaration. | dynamic | ||
| warn about binding the  | dynamic | ||
| warn when  | dynamic | ||
| warn if there are tabs in the source file | dynamic | ||
| warn if the module being compiled is marked as
 | dynamic | ||
| warn when defaulting happens | dynamic | ||
| Report warnings when typed hole errors are
deferred until runtime. See
 | dynamic | ||
| warn on pattern bind of unlifted variable that is neither bare nor banged | dynamic | ||
| warn about the usage of unicode bidirectional layout override characters | dynamic | ||
| warn about uses of pragmas that GHC doesn't recognise | dynamic | ||
| throw a warning when an unrecognised  | dynamic | ||
| warn if the module being compiled is regarded to be unsafe. See Safe Haskell | dynamic | ||
| warn about use of an unsupported calling convention | dynamic | ||
| Warn when using  | dynamic | ||
| warn if promoted constructors are not ticked | dynamic | ||
| warn about bindings that are unused. Alias for
 | dynamic | ||
| warn about do bindings that appear to throw away values of types
other than  | dynamic | ||
| warn about type variables in user-written
 | dynamic | ||
| warn about unnecessary imports | dynamic | ||
| warn about local bindings that are unused | dynamic | ||
| warn about variables in patterns that aren't used | dynamic | ||
| warn when package is requested on command line, but was never loaded. | dynamic | ||
| warn about pattern match bindings that are unused | dynamic | ||
| Warn about record wildcard matches when none of the bound variables are used. | dynamic | ||
| warn about top-level bindings that are unused | dynamic | ||
| warn about unused type variables which arise from patterns in in type family and data family instances | dynamic | ||
| make warnings non-fatal | dynamic | ||
| warn about uses of functions & types that have warnings or deprecated pragmas | dynamic | ||
| warn about do bindings that appear to throw away monadic values that you should have bound instead | dynamic | 
5.6.14. Optimisation levels¶
These options are described in more detail in Optimisation (code improvement).
See Individual optimisations for a list of optimisations enabled on level 1 and level 2.
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Enable level 1 optimisations | dynamic | ||
| Disable optimisations (default) | dynamic | ||
| Enable level 2 optimisations | dynamic | ||
| Any -On where n > 2 is the same as -O2. | dynamic | 
5.6.15. Individual optimisations¶
These options are described in more detail in -f*: platform-independent flags. If a
flag is implied by -O then it is also implied by -O2 (unless
flag description explicitly says otherwise). If a flag is implied by
-O0 only then the flag is not implied by -O and -O2.
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Enable shortcutting on assembly. Implied by  | dynamic | ||
| default: 500K. Tweak assembly generator for binary blobs. | dynamic | ||
| Use the new cfg based block layout algorithm. | dynamic | ||
| Ignore cfg weights for code layout. | dynamic | ||
| Sets edge weights used by the new code layout algorithm. | dynamic | ||
| Enable call-arity optimisation. Implied by  | dynamic | ||
| Enable constant folding in case expressions. Implied by  | dynamic | ||
| Enable case-merging. Implied by  | dynamic | ||
| Enable Cmm common block elimination. Implied by  | dynamic | ||
| Enable Cmm sinking. Implied by  | dynamic | ||
| Enable static control flow prediction. Implied by  | dynamic | ||
| Turn on CPR analysis in the demand analyser. Implied by  | dynamic | ||
| Turn on specialisation of overloaded functions imported from other modules. | dynamic | ||
| Enable common sub-expression elimination. Implied by  | dynamic | ||
| Make dictionary-valued expressions seem cheap to the optimiser. | dynamic | ||
| Make dictionaries strict | dynamic | ||
| Use a special demand transformer for dictionary selectors. Always enabled by default. | dynamic | ||
| Enable eta-reduction. Implied by  | dynamic | ||
| Enable lambda eta-expansion. Always enabled by default. | dynamic | ||
| Turn on eager blackholing | dynamic | ||
| Switch on all rewrite rules (including rules generated by
automatic specialisation of overloaded functions). Implied by
 | dynamic | ||
| Enable excess intermediate precision | dynamic | ||
| Enables exitification optimisation. Implied by  | dynamic | ||
| Expose all unfoldings, even for very large or recursive functions. | dynamic | ||
| Turn on the float-in transformation. Implied by  | dynamic | ||
| Turn on full laziness (floating bindings outwards).
Implied by  | dynamic | ||
| Allow worker-wrapper to convert a function closure into a thunk if the function does not use any of its arguments. Off by default. | dynamic | ||
| Ignore assertions in the source. Implied by  | dynamic | ||
| Ignore pragmas in interface files. Implied by  | dynamic | ||
| Run demand analysis again, at the end of the simplification pipeline | dynamic | ||
| Run a late specialisation pass | dynamic | ||
| Turn on the liberate-case transformation. Implied by  | dynamic | ||
| default: 2000. Set the size threshold for the liberate-case transformation to ⟨n⟩ | dynamic | ||
| Pass vector value in vector registers for function calls | dynamic | ||
| Turn saturated self-recursive tail-calls into local jumps in the
generated assembly. Implied by  | dynamic | ||
| default: 128. Set the maximum size of inline array allocations to ⟨n⟩ bytes (default: 128). | dynamic | ||
| default: 32. Inline  | dynamic | ||
| default: 32. Inline  | dynamic | ||
| default: 4. Set the max iterations for the simplifier. | dynamic | ||
| default: 4. Set the maximum number of patterns to display in warnings about non-exhaustive ones. | dynamic | ||
| default: 10. Maximum number of value arguments for a worker. | dynamic | ||
| Turn off the coercion optimiser | dynamic | ||
| Turn off pre-inlining | dynamic | ||
| Turn off the state hackwhereby any lambda with a real-world state token as argument is considered to be single-entry. Hence OK to inline things inside it. | dynamic | ||
| Don't generate interface pragmas. Implied by  | dynamic | ||
| Omit heap checks when no allocation is being performed. | dynamic | ||
| Use a slower but better algorithm for ApplicativeDo | dynamic | ||
| Make GHC be more precise about its treatment of bottom (but see
also  | dynamic | ||
| Use the graph colouring register allocator for register
allocation in the native code generator. Implied by  | dynamic | ||
| Use the iterative coalescing graph colouring register allocator in the native code generator. | dynamic | ||
| default: 100. Set the percentage factor for simplifier ticks. | dynamic | ||
| default: 2. Set the number of phases for the simplifier.
Ignored with  | dynamic | ||
| When solving constraints, try to eagerly solve super classes using available dictionaries. | dynamic | ||
| Turn on the SpecConstr transformation. Implied by  | dynamic | ||
| default: 3.* Set to ⟨n⟩ the maximum number of specialisations that will be created for any one function by the SpecConstr transformation. | dynamic | ||
| Specialize a call with an explicit constructor argument, even if the argument is not scrutinised in the body of the function | dynamic | ||
| default: 2000. Set the size threshold for the SpecConstr transformation to ⟨n⟩. | dynamic | ||
| Turn on specialisation of overloaded functions. Implied by  | dynamic | ||
| Turn on specialisation of overloaded functions regardless of size, if unfolding is available | dynamic | ||
| Turn on the static argument transformation. | dynamic | ||
| Enable common sub-expression elimination on the STG intermediate language | dynamic | ||
| Enable late lambda lifting on the STG intermediate
language. Implied by  | dynamic | ||
| Allow turning known into unknown calls while performing late lambda lifting. | dynamic | ||
| Create top-level non-recursive functions with at most <n> parameters while performing late lambda lifting. | dynamic | ||
| Create top-level recursive functions with at most <n> parameters while performing late lambda lifting. | dynamic | ||
| Turn on strictness analysis.
Implied by  | dynamic | ||
| Run an additional strictness analysis before simplifier phase ⟨n⟩ | dynamic | ||
| Flatten strict constructor fields with a pointer-sized
representation. Implied by  | dynamic | ||
| Flatten strict constructor fields | dynamic | ||
| default: 750. Tweak unfolding settings. | dynamic | ||
| default: 30. Tweak unfolding settings. | dynamic | ||
| default: 60. Tweak unfolding settings. | dynamic | ||
| This has been deprecated in GHC 9.0.1. | dynamic | ||
| default: 80. Tweak unfolding settings. | dynamic | ||
| Enable the worker-wrapper transformation. | dynamic | 
5.6.16. Profiling options¶
More details in Profiling
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Disables any previous  | dynamic | ||
| Disables any previous  | dynamic | ||
| Do not collect entry counts | dynamic | ||
| Auto-add  | dynamic | ||
| Auto-add  | dynamic | ||
| Auto-add  | dynamic | ||
| Auto-add  | dynamic | ||
| Auto-add  | dynamic | ||
| Turn on profiling | dynamic | ||
| dynamic | 
5.6.17. Program coverage options¶
More details in Observing Code Coverage
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Turn on Haskell program coverage instrumentation | dynamic | 
5.6.18. C pre-processor options¶
More details in Options affecting the C pre-processor
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Run the C pre-processor on Haskell source files | dynamic | ||
| Define a symbol in the C pre-processor | dynamic | ||
| Add ⟨dir⟩ to the directory search list for  | dynamic | ||
| Undefine a symbol in the C pre-processor | dynamic | 
5.6.19. Code generation options¶
More details in Options affecting code generation
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Build dynamic object files as well as static object files during compilation | dynamic | ||
| Use the native code generator | dynamic | ||
| Generate byte-code | dynamic | ||
| Generate code for linking against dynamic libraries | dynamic | ||
| Compile using the LLVM code generator | dynamic | ||
| Omit code generation | dynamic | ||
| Generate object code | dynamic | ||
| Generate position-independent code (where available) | dynamic | ||
| Generate code for a position-independent executable (where available) | dynamic | ||
| Always write interface files | dynamic | 
5.6.20. Linking options¶
More details in Options affecting linking
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Stop after generating object ( | mode | ||
| Use the debugging runtime | dynamic | ||
| Set the install name (via  | dynamic | ||
| Build dynamically-linked object files and executables | dynamic | ||
| Selects one of a number of modes for finding shared libraries at runtime. | dynamic | ||
| Enable runtime event tracing | dynamic | ||
| Do not garbage-collect CAFs (top-level expressions) at runtime | dynamic | ||
| Link the runtime when generating a shared or static library | dynamic | ||
| Do not embed the manifest in the executable (Windows only) | dynamic | ||
| Do not generate a manifest file (Windows only) | dynamic | ||
| Don't generate an import library for a DLL (Windows only) | dynamic | ||
| On Darwin/OS X/iOS only, link in the framework ⟨name⟩. This
option corresponds to the  | dynamic | ||
| On Darwin/OS X/iOS only, add ⟨dir⟩ to the list of directories
searched for frameworks. This option corresponds to the  | dynamic | ||
| Set the rpath based on -L flags | dynamic | ||
| When linking a binary executable, this inserts the flag
 | dynamic | ||
| Add ⟨dir⟩ to the list of directories searched for libraries | dynamic | ||
| Link in library ⟨lib⟩ | dynamic | ||
| Set main module and function | dynamic | ||
| Don't assume this program contains  | dynamic | ||
| Don't print RTS suggestions about linking with
 | dynamic | ||
| Expose package ⟨pkg⟩ | dynamic | ||
| Instruct the linker to produce a position-independent executable. | dynamic | ||
| This instructs the linker to add all symbols, not only used
ones, to the dynamic symbol table. Currently Linux and
Windows/MinGW32 only. This is equivalent to using
 | dynamic | ||
| Control whether the RTS behaviour can be tweaked via command-line
flags and the  | dynamic | ||
| Generate a shared library (as opposed to an executable) | dynamic | ||
| Split sections for link-time dead-code stripping | dynamic | ||
| Use static Haskell libraries | dynamic | ||
| Generate a standalone static library (as opposed to an executable). This is useful when cross compiling. The library together with all its dependencies ends up in in a single static library that can be linked against. | dynamic | ||
| Use the threaded runtime | dynamic | ||
| Set the default RTS options to ⟨opts⟩. | dynamic | 
5.6.21. Plugin options¶
More details in Compiler Plugins
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Clear the list of active plugins | dynamic | ||
| Give arguments to a plugin module; module must be specified with
 | dynamic | ||
| Trust the used plugins and no longer mark the compiled module as unsafe | dynamic | ||
| Load a plugin exported by a given module | dynamic | ||
| Hide all packages for plugins by default | dynamic | ||
| Expose ⟨pkg⟩ for plugins | dynamic | ||
| Expose ⟨pkg-id⟩ for plugins | dynamic | 
5.6.22. Replacing phases¶
More details in Replacing the program for one or more phases
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Use ⟨cmd⟩ as the assembler | dynamic | ||
| Use ⟨cmd⟩ as the C compiler | dynamic | ||
| Use ⟨cmd⟩ as the DLL generator | dynamic | ||
| Use ⟨cmd⟩ as the pre-processor (with  | dynamic | ||
| Use ⟨cmd⟩ as the external interpreter command. | dynamic | ||
| Use ⟨cmd⟩ as the program to inject  | dynamic | ||
| Use ⟨cmd⟩ as the literate pre-processor | dynamic | ||
| Use ⟨cmd⟩ as the linker | dynamic | ||
| Use ⟨cmd⟩ as the LLVM compiler | dynamic | ||
| Use ⟨cmd⟩ as the command for libtool (with  | dynamic | ||
| Use ⟨cmd⟩ as the linker when merging object files | dynamic | ||
| Use ⟨cmd⟩ as the LLVM optimiser | dynamic | ||
| Use ⟨cmd⟩ as the program to inspect mach-o dylibs on macOS | dynamic | ||
| Use ⟨cmd⟩ as the C pre-processor (with  | dynamic | ||
| Use ⟨cmd⟩ as the splitter | dynamic | ||
| Use ⟨cmd⟩ as the program for embedding manifests on Windows. | dynamic | 
5.6.23. Forcing options to particular phases¶
More details in Forcing options to a particular phase
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| pass ⟨option⟩ to the assembler | dynamic | ||
| pass ⟨option⟩ to the C compiler | dynamic | ||
| pass ⟨option⟩ to the C++ compiler | dynamic | ||
| pass ⟨option⟩ to the DLL generator | dynamic | ||
| pass ⟨option⟩ to the custom pre-processor | dynamic | ||
| pass ⟨option⟩ to the interpreter sub-process. | dynamic | ||
| pass ⟨option⟩ to the literate pre-processor | dynamic | ||
| pass ⟨option⟩ to the linker | dynamic | ||
| pass ⟨option⟩ to the LLVM compiler | dynamic | ||
| pass ⟨option⟩ to the linker when merging object files. | dynamic | ||
| pass ⟨option⟩ to the LLVM optimiser | dynamic | ||
| pass ⟨option⟩ to cpp (with  | dynamic | ||
| pass ⟨option⟩ to  | dynamic | ||
| Indicate that the C compiler supports  | dynamic | 
5.6.24. Platform-specific options¶
More details in Platform-specific Flags
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| (x86 only) Use BMI2 for bit manipulation operations | dynamic | ||
| (x86 only) Use SSE2 for floating-point operations | dynamic | ||
| (x86 only) Use SSE4.2 for floating-point operations | dynamic | 
5.6.25. Compiler debugging options¶
More details in Debugging the compiler
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| C-\- pass sanity checking | dynamic | ||
| Turn on internal sanity checking | dynamic | ||
| Dump final assembly | dynamic | ||
| Dump the result of the synthetic instruction expansion pass. | dynamic | ||
| Dump assembly augmented with register liveness | dynamic | ||
| Dump initial assembly | dynamic | ||
| Dump the result of register allocation | dynamic | ||
| Dump the build/spill stages of the  | dynamic | ||
| Dump statistics from the register allocator. | dynamic | ||
| Dump interpreter byte code | dynamic | ||
| Dump the assumed weights of the CFG. | dynamic | ||
| Dump the final C-\- output | dynamic | ||
| Dump the results of the C-\- CAF analysis pass. | dynamic | ||
| Dump the results of common block elimination | dynamic | ||
| Dump the results of the C-\- control flow optimisation pass. | dynamic | ||
| Dump the results of the CPS pass | dynamic | ||
| Dump STG-to-C-\- output | dynamic | ||
| Dump the results of the C-\- info table augmentation pass. | dynamic | ||
| Dump the results of C-\- to C-\- optimising passes | dynamic | ||
| Dump the results of proc-point analysis | dynamic | ||
| Dump the results of the C-\- proc-point map pass. | dynamic | ||
| Dump raw C-\- | dynamic | ||
| Dump the results of the C-\- sinking pass. | dynamic | ||
| Dump the results of the C-\- stack layout pass. | dynamic | ||
| Dump the results of the C-\- proc-point splitting pass. | dynamic | ||
| Dump the results of switch lowering passes | dynamic | ||
| Write output from main C-\- pipeline passes to files | dynamic | ||
| Show output from main C-\- pipeline passes (grouped by proc) | dynamic | ||
| Print a one-line summary of the size of the Core program at the end of the optimisation pipeline | dynamic | ||
| Dump CPR signatures | dynamic | ||
| Dump CPR analysis output | dynamic | ||
| Dump CSE output | dynamic | ||
| Dump deriving output | dynamic | ||
| Dump desugarer output. | dynamic | ||
| Trace exhaustiveness checker | dynamic | ||
| Set the prefix of the filenames used for debugging output. | dynamic | ||
| Dump  | dynamic | ||
| Dump the hie file syntax tree | dynamic | ||
| An alias for  | dynamic | ||
| Trace interface files | dynamic | ||
| Dump inlinings performed by the simplifier. | dynamic | ||
| Dump error messages as JSON documents | dynamic | ||
| Dump LLVM intermediate code. | dynamic | ||
| Dump the state of the module mapping database. | dynamic | ||
| Dump occurrence analysis output | dynamic | ||
| Dump the results of C-\- to C-\- optimising passes | dynamic | ||
| Dump parse tree | dynamic | ||
| Dump parser output as a syntax tree | dynamic | ||
| Dump prepared core | dynamic | ||
| Dump renamer output | dynamic | ||
| Dump renamer output as a syntax tree | dynamic | ||
| Renamer stats | dynamic | ||
| Trace renamer | dynamic | ||
| Trace runtime type inference | dynamic | ||
| Dump rule firing info | dynamic | ||
| Dump detailed rule firing info | dynamic | ||
| Dump rewrite rules | dynamic | ||
| Dump final simplifier output | dynamic | ||
| Dump output from each simplifier iteration | dynamic | ||
| Dump simplifier stats | dynamic | ||
| Dump specialiser output | dynamic | ||
| Dump TH spliced expressions, and what they evaluate to | dynamic | ||
| Show CoreToStg output | dynamic | ||
| Show output of last STG pass. | dynamic | ||
| Show unarised STG | dynamic | ||
| Dump strictness signatures | dynamic | ||
| Dump strictness analyser output | dynamic | ||
| Dump typechecker output | dynamic | ||
| Dump typechecker output as a syntax tree | dynamic | ||
| Trace typechecker | dynamic | ||
| Dump the code instrumented by HPC (Observing Code Coverage). | dynamic | ||
| Dump per-pass timing and allocation statistics | dynamic | ||
| Dump to files instead of stdout | dynamic | ||
| Dump type signatures | dynamic | ||
| Dump all considered inlinings | dynamic | ||
| Dump worker-wrapper output | dynamic | ||
| Show statistics for fast string usage when finished | dynamic | ||
| Print values of type Word# in hexadecimal. | dynamic | ||
| Start  | dynamic | ||
| Dump information about inlining decisions | dynamic | ||
| Turn on internal sanity checking | dynamic | ||
| Suppress unsolicited debugging output | dynamic | ||
| Don't generate bindings for Typeable methods | dynamic | ||
| Print single alternative case expressions as strict lets. | dynamic | ||
| Set the width of debugging output. For example  | dynamic | ||
| Turn on debug printing (more verbose) | dynamic | ||
| Set the depth for printing expressions in error msgs | dynamic | ||
| Dump information about potential rule application | dynamic | ||
| Print out each pass name as it happens | dynamic | ||
| STG pass sanity checking | dynamic | ||
| In dumps, suppress everything (except for uniques) that is suppressible. | dynamic | ||
| Suppress the printing of coercions in Core dumps to make them shorter | dynamic | ||
| Suppress extended information about identifiers where they are bound | dynamic | ||
| Suppress the printing of module qualification prefixes | dynamic | ||
| Suppress the printing of closure free variable lists in STG output | dynamic | ||
| Suppress "ticks" in the pretty-printer output. | dynamic | ||
| Suppress timestamps in dumps | dynamic | ||
| Suppress type applications | dynamic | ||
| Suppress type signatures | dynamic | ||
| Suppress the printing of the stable unfolding of a variable at its binding site | dynamic | ||
| Suppress the printing of uniques in debug output (easier to use
 | dynamic | ||
| Suppress the printing of variable kinds | dynamic | ||
| Dump evaluated TH declarations into *.th.hs files | dynamic | ||
| Set the increment for the generated  | dynamic | ||
| Show output from each core-to-core pass | dynamic | ||
| Show output from each STG-to-STG pass | dynamic | ||
| Compile with alignment checks for all info table dereferences. | dynamic | ||
| Add a default  | dynamic | ||
| Intruct LLVM to fill dead STG registers with garbage | dynamic | ||
| Align functions at given boundary. | dynamic | ||
| Produce DWARF debug information in compiled object files. ⟨n⟩ can be 0, 1, or 2, with higher numbers producing richer output. If ⟨n⟩ is omitted, level 2 is assumed. | dynamic | 
5.6.26. Miscellaneous compiler options¶
| Flag | Description | Type | Reverse | 
|---|---|---|---|
| Run interpreted code in a separate process | dynamic | ||
| Deprecated. Enable most language extensions; see Controlling extensions for exactly which ones. | dynamic | ||
| Disable Safe Haskell | dynamic | ||
| (GHC as a C compiler only) Use this  | dynamic | ||
| Set the minimum size of the heap to ⟨size⟩ | dynamic | ||
| When compiling with  | dynamic |