4.19. Flag reference
Prev | Chapter 4. Using GHC | Next

## 4.19. Flag reference

This section is a quick-reference for GHC's command-line flags. For each flag, we also list its static/dynamic status (see Section 4.3, “Static, Dynamic, and Mode options”), and the flag's opposite (if available).

### 4.19.1. Help and verbosity options

Section 4.6, “Help and verbosity options”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-?` | help | mode | -
`-help` | help | mode | -
`-n` | do a dry run | dynamic | -
`-v` | verbose mode (equivalent to `-v3`) | dynamic | -
`-v` `n` | set verbosity level | dynamic | -
`-V` | display GHC version | mode | -
`––supported-extensions` or `––supported-languages` | display the supported languages and language extensions | mode | -
`––info` | display information about the compiler | mode | -
`––version` | display GHC version | mode | -
`––numeric-version` | display GHC version (numeric only) | mode | -
`––print-libdir` | display GHC library directory | mode | -
`-ferror-spans` | output full span in error messages | static | -
`-H` `size` | Set the minimum heap size to `size` | static | -
`-Rghc-timing` | Summarise timing stats for GHC (same as `+RTS -tstderr`) | static | -

### 4.19.2. Which phases to run

Section 4.5.3, “Batch compiler mode”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-E` | Stop after preprocessing (`.hspp` file) | mode | -
`-C` | Stop after generating C (`.hc` file) | mode | -
`-S` | Stop after generating assembly (`.s` file) | mode | -
`-c` | Do not link | dynamic | -
`-x` `suffix` | Override default behaviour for source files | static | -

### 4.19.3. Alternative modes of operation

Section 4.5, “Modes of operation”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`--interactive` | Interactive mode - normally used by just running ghci; see Chapter 2, Using GHCi for details. | mode | -
`--make` | Build a multi-module Haskell program, automatically figuring out dependencies. Likely to be much easier, and faster, than using make; see Section 4.5.1, “Using ghc `––make`” for details.. | mode | -
`-e `expr`` | Evaluate `expr`; see Section 4.5.2, “Expression evaluation mode” for details. | mode | -
`-M` | Generate dependency information suitable for use in a `Makefile`; see Section 4.7.11, “Dependency generation” for details. | mode | -

### 4.19.4. Redirecting output

Section 4.7.4, “Redirecting the compilation output(s)”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-hcsuf` `suffix` | set the suffix to use for intermediate C files | dynamic | -
`-hidir` `dir` | set directory for interface files | dynamic | -
`-hisuf` `suffix` | set the suffix to use for interface files | dynamic | -
`-o` `filename` | set output filename | dynamic | -
`-odir` `dir` | set directory for object files | dynamic | -
`-ohi` `filename` | set the filename in which to put the interface | dynamic |
`-osuf` `suffix` | set the output file suffix | dynamic | -
`-stubdir` `dir` | redirect FFi stub files | dynamic | -
`-outputdir` `dir` | set output directory | dynamic | -

### 4.19.5. Keeping intermediate files

Section 4.7.5, “Keeping Intermediate Files”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-keep-hc-file` or `-keep-hc-files` | retain intermediate `.hc` files | dynamic | -
`-keep-llvm-file` or `-keep-llvm-files` | retain intermediate LLVM `.ll` files | dynamic | -
`-keep-s-file` or `-keep-s-files` | retain intermediate `.s` files | dynamic | -
`-keep-raw-s-file` or `-keep-raw-s-files` | retain intermediate `.raw_s` files | dynamic | -
`-keep-tmp-files` | retain all intermediate temporary files | dynamic | -

### 4.19.6. Temporary files

Section 4.7.6, “Redirecting temporary files”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-tmpdir` | set the directory for temporary files | dynamic | -

### 4.19.7. Finding imports

Section 4.7.3, “The search path”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-i` `dir1`:`dir2`:... | add `dir`, `dir2`, etc. to import path | static/`:set` | -
`-i` | Empty the import directory list | static/`:set` | -

### 4.19.8. Interface file options

Section 4.7.7, “Other options related to interface files”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-ddump-hi` | Dump the new interface to stdout | dynamic | -
`-ddump-hi-diffs` | Show the differences vs. the old interface | dynamic | -
`-ddump-minimal-imports` | Dump a minimal set of imports | dynamic | -
`--show-iface` `file` | See Section 4.5, “Modes of operation”. |  |

### 4.19.9. Recompilation checking

Section 4.7.8, “The recompilation checker”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fforce-recomp` | Turn off recompilation checking; implied by any `-ddump-X` option | dynamic | `-fno-force-recomp`

### 4.19.10. Interactive-mode options

Section 2.9, “The `.ghci` file”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-ignore-dot-ghci` | Disable reading of `.ghci` files | static | -
`-read-dot-ghci` | Enable reading of `.ghci` files | static | -
`-fbreak-on-exception` | Break on any exception thrown | dynamic | `-fno-break-on-exception`
`-fbreak-on-error` | Break on uncaught exceptions and errors | dynamic | `-fno-break-on-error`
`-fprint-evld-with-show` | Enable usage of Show instances in `:print` | dynamic | `-fno-print-evld-with-show`
`-fprint-bind-result` | Turn on printing of binding results in GHCi | dynamic | `-fno-print-bind-result`
`-fno-print-bind-contents` | Turn off printing of binding contents in GHCi | dynamic | -
`-fno-implicit-import-qualified` | Turn off implicit qualified import of everything in GHCi | dynamic | -

### 4.19.11. Packages

Section 4.9, “ Packages ”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-package-name` `P` | Compile to be part of package `P` | dynamic | -
`-package` `P` | Expose package `P` | static/`:set` | -
`-hide-all-packages` | Hide all packages by default | static | -
`-hide-package` `name` | Hide package `P` | static/`:set` | -
`-ignore-package` `name` | Ignore package `P` | static/`:set` | -
`-package-conf` `file` | Load more packages from `file` | static | -
`-no-user-package-conf` | Don't load the user's package config file. | static | -
`-no-auto-link-packages` | Don't automatically link in the haskell98 package. | dynamic | -

### 4.19.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 Section 7.1, “Language options”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fglasgow-exts` | Enable most language extensions | dynamic | `-fno-glasgow-exts`
`-XOverlappingInstances` | Enable overlapping instances | dynamic | `-XNoOverlappingInstances`
`-XIncoherentInstances` | Enable incoherent instances. Implies `-XOverlappingInstances` | dynamic | `-XNoIncoherentInstances`
`-XUndecidableInstances` | Enable undecidable instances | dynamic | `-XNoUndecidableInstances`
`-fcontext-stack=N` `n` | set the limit for context reduction. Default is 20. | dynamic |
`-XArrows` | Enable arrow notation extension | dynamic | `-XNoArrows`
`-XDisambiguateRecordFields` | Enable record field disambiguation | dynamic | `-XNoDisambiguateRecordFields`
`-XForeignFunctionInterface` | Enable foreign function interface (implied by `-fglasgow-exts`) | dynamic | `-XNoForeignFunctionInterface`
`-XGenerics` | Enable generic classes | dynamic | `-XNoGenerics`
`-XImplicitParams` | Enable Implicit Parameters. Implied by `-fglasgow-exts`. | dynamic | `-XNoImplicitParams`
`-firrefutable-tuples` | Make tuple pattern matching irrefutable | dynamic | `-fno-irrefutable-tuples`
`-XNoImplicitPrelude` | Don't implicitly `import Prelude` | dynamic | `-XImplicitPrelude`
`-XRebindableSyntax` | Employ rebindable syntax | dynamic | `-XNoRebindableSyntax`
`-XNoMonomorphismRestriction` | Disable the monomorphism restriction | dynamic | `-XMonomorphismRrestriction`
`-XNoNPlusKPatterns` | Disable support for `n+k` patterns | dynamic | `-XNPlusKPatterns`
`-XNoMonoPatBinds` | Make pattern bindings polymorphic | dynamic | `-XMonoPatBinds`
`-XRelaxedPolyRec` | Relaxed checking for mutually-recursive polymorphic functions | dynamic | `-XNoRelaxedPolyRec`
`-XExtendedDefaultRules` | Use GHCi's extended default rules in a normal module | dynamic | `-XNoExtendedDefaultRules`
`-XOverloadedStrings` | Enable overloaded string literals. | dynamic | `-XNoOverloadedStrings`
`-XGADTs` | Enable generalised algebraic data types. | dynamic | `-XNoGADTs`
`-XTypeFamilies` | Enable type families. | dynamic | `-XNoTypeFamilies`
`-XScopedTypeVariables` | Enable lexically-scoped type variables. Implied by `-fglasgow-exts`. | dynamic | `-XNoScopedTypeVariables`
`-XMonoLocalBinds` | Enable do not generalise local bindings. | dynamic | `-XNoMonoLocalBinds`
`-XTemplateHaskell` | Enable Template Haskell. No longer implied by `-fglasgow-exts`. | dynamic | `-XNoTemplateHaskell`
`-XQuasiQuotes` | Enable quasiquotation. | dynamic | `-XNoQuasiQuotes`
`-XBangPatterns` | Enable bang patterns. | dynamic | `-XNoBangPatterns`
`-XCPP` | Enable the C preprocessor. | dynamic | `-XNoCPP`
`-XPatternGuards` | Enable pattern guards. | dynamic | `-XNoPatternGuards`
`-XViewPatterns` | Enable view patterns. | dynamic | `-XNoViewPatterns`
`-XUnicodeSyntax` | Enable unicode syntax. | dynamic | `-XNoUnicodeSyntax`
`-XMagicHash` | Allow "#" as a postfix modifier on identifiers. | dynamic | `-XNoMagicHash`
`-XNewQualifiedOperators` | Enable new qualified operator syntax | dynamic | `-XNoNewQualifiedOperators`
`-XExplicitForALl` | Enable explicit universal quantification. Implied by `-XScopedTypeVariables`, `-XLiberalTypeSynonyms`, `-XRank2Types`, `-XRankNTypes`, `-XPolymorphicComponents`, `-XExistentialQuantification` | dynamic | `-XNoExplicitForAll`
`-XPolymorphicComponents` | Enable polymorphic components for data constructors. | dynamic | `-XNoPolymorphicComponents`
`-XRank2Types` | Enable rank-2 types. | dynamic | `-XNoRank2Types`
`-XRankNTypes` | Enable rank-N types. | dynamic | `-XNoRankNTypes`
`-XImpredicativeTypes` | Enable impredicative types. | dynamic | `-XNoImpredicativeTypes`
`-XExistentialQuantification` | Enable existential quantification. | dynamic | `-XNoExistentialQuantification`
`-XKindSignatures` | Enable kind signatures. | dynamic | `-XNoKindSignatures`
`-XEmptyDataDecls` | Enable empty data declarations. | dynamic | `-XNoEmptyDataDecls`
`-XParallelListComp` | Enable parallel list comprehensions. | dynamic | `-XNoParallelListComp`
`-XTransformListComp` | Enable generalised list comprehensions. | dynamic | `-XNoTransformListComp`
`-XUnliftedFFITypes` | Enable unlifted FFI types. | dynamic | `-XNoUnliftedFFITypes`
`-XLiberalTypeSynonyms` | Enable liberalised type synonyms. | dynamic | `-XNoLiberalTypeSynonyms`
`-XTypeOperators` | Enable type operators. | dynamic | `-XNoTypeOperators`
`-XDoRec` | Enable recursive do notation. | dynamic | `-XNoDoRec`
`-XRecursiveDo` | Enable recursive do (mdo) notation. This is deprecated; please use recursive do notation instead. | dynamic | `-XNoRecursiveDo`
`-XPArr` | Enable parallel arrays. | dynamic | `-XNoPArr`
`-XRecordWildCards` | Enable record wildcards. | dynamic | `-XNoRecordWildCards`
`-XNamedFieldPuns` | Enable record puns. | dynamic | `-XNoNamedFieldPuns`
`-XDisambiguateRecordFields` | Enable record field disambiguation. | dynamic | `-XNoDisambiguateRecordFields`
`-XUnboxedTuples` | Enable unboxed tuples. | dynamic | `-XNoUnboxedTuples`
`-XStandaloneDeriving` | Enable standalone deriving. | dynamic | `-XNoStandaloneDeriving`
`-XDeriveDataTypeable` | Enable deriving for the Data and Typeable classes. | dynamic | `-XNoDeriveDataTypeable`
`-XGeneralizedNewtypeDeriving` | Enable newtype deriving. | dynamic | `-XNoGeneralizedNewtypeDeriving`
`-XTypeSynonymInstances` | Enable type synonyms in instance heads. | dynamic | `-XNoTypeSynonymInstances`
`-XFlexibleContexts` | Enable flexible contexts. | dynamic | `-XNoFlexibleContexts`
`-XFlexibleInstances` | Enable flexible instances. | dynamic | `-XNoFlexibleInstances`
`-XConstrainedClassMethods` | Enable constrained class methods. | dynamic | `-XNoConstrainedClassMethods`
`-XMultiParamTypeClasses` | Enable multi parameter type classes. | dynamic | `-XNoMultiParamTypeClasses`
`-XFunctionalDependencies` | Enable functional dependencies. | dynamic | `-XNoFunctionalDependencies`
`-XPackageImports` | Enable package-qualified imports. | dynamic | `-XNoPackageImports`

### 4.19.13. Warnings

Section 4.8, “Warnings and sanity-checking”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-W` | enable normal warnings | dynamic | `-w`
`-w` | disable all warnings | dynamic | -
`-Wall` | enable almost all warnings (details in Section 4.8, “Warnings and sanity-checking”) | dynamic | `-w`
`-Werror` | make warnings fatal | dynamic | -Wwarn
`-Wwarn` | make warnings non-fatal | dynamic | -Werror
`-fwarn-unrecognised-pragmas` | warn about uses of pragmas that GHC doesn't recognise | dynamic | `-fno-warn-unrecognised-pragmas`
`-fwarn-warnings-deprecations` | warn about uses of functions & types that have warnings or deprecated pragmas | dynamic | `-fno-warn-warnings-deprecations`
`-fwarn-deprecated-flags` | warn about uses of commandline flags that are deprecated | dynamic | `-fno-warn-deprecated-flags`
`-fwarn-duplicate-exports` | warn when an entity is exported multiple times | dynamic | `-fno-warn-duplicate-exports`
`-fwarn-hi-shadowing` | warn when a `.hi` file in the current directory shadows a library | dynamic | `-fno-warn-hi-shadowing`
`-fwarn-implicit-prelude` | warn when the Prelude is implicitly imported | dynamic | `-fno-warn-implicit-prelude`
`-fwarn-incomplete-patterns` | warn when a pattern match could fail | dynamic | `-fno-warn-incomplete-patterns`
`-fwarn-incomplete-record-updates` | warn when a record update could fail | dynamic | `-fno-warn-incomplete-record-updates`
`-fwarn-lazy-unlifted-bindings` | warn when a pattern binding looks lazy but must be strict | dynamic | `-fno-warn-lazy-unlifted-bindings`
`-fwarn-missing-fields` | warn when fields of a record are uninitialised | dynamic | `-fno-warn-missing-fields`
`-fwarn-missing-import-lists` | warn when an import declaration does not explicitly list all the names brought into scope | dynamic | `-fnowarn-missing-import-lists`
`-fwarn-missing-methods` | warn when class methods are undefined | dynamic | `-fno-warn-missing-methods`
`-fwarn-missing-signatures` | warn about top-level functions without signatures | dynamic | `-fno-warn-missing-signatures`
`-fwarn-name-shadowing` | warn when names are shadowed | dynamic | `-fno-warn-name-shadowing`
`-fwarn-orphans` | warn when the module contains orphan instance declarations or rewrite rules | dynamic | `-fno-warn-orphans`
`-fwarn-overlapping-patterns` | warn about overlapping patterns | dynamic | `-fno-warn-overlapping-patterns`
`-fwarn-tabs` | warn if there are tabs in the source file | dynamic | `-fno-warn-tabs`
`-fwarn-type-defaults` | warn when defaulting happens | dynamic | `-fno-warn-type-defaults`
`-fwarn-monomorphism-restriction` | warn when the Monomorphism Restriction is applied | dynamic | `-fno-warn-monomorphism-restriction`
`-fwarn-unused-binds` | warn about bindings that are unused | dynamic | `-fno-warn-unused-binds`
`-fwarn-unused-imports` | warn about unnecessary imports | dynamic | `-fno-warn-unused-imports`
`-fwarn-unused-matches` | warn about variables in patterns that aren't used | dynamic | `-fno-warn-unused-matches`
`-fwarn-unused-do-bind` | warn about do bindings that appear to throw away values of types other than `()` | dynamic | `-fno-warn-unused-do-bind`
`-fwarn-wrong-do-bind` | warn about do bindings that appear to throw away monadic values that you should have bound instead | dynamic | `-fno-warn-wrong-do-bind`

### 4.19.14. Optimisation levels

Section 4.10, “Optimisation (code improvement)”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-O` | Enable default optimisation (level 1) | dynamic | `-O0`
`-O` `n` | Set optimisation level `n` | dynamic | `-O0`

### 4.19.15. Individual optimisations

Section 4.10.2, “`-f*`: platform-independent flags”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fcase-merge` | Enable case-merging. Implied by `-O`. | dynamic | `-fno-case-merge`
`-fdicts-strict` | Make dictionaries strict | static | `-fno-dicts-strict`
`-fmethod-sharing` | Share specialisations of overloaded functions (default) | dynamic | `-fno-method-sharing`
`-fdo-eta-reduction` | Enable eta-reduction. Implied by `-O`. | dynamic | `-fno-do-eta-reduction`
`-fdo-lambda-eta-expansion` | Enable lambda eta-reduction | dynamic | `-fno-do-lambda-eta-expansion`
`-fexcess-precision` | Enable excess intermediate precision | dynamic | `-fno-excess-precision`
`-fignore-asserts` | Ignore assertions in the source | dynamic | `-fno-ignore-asserts`
`-fignore-interface-pragmas` | Ignore pragmas in interface files | dynamic | `-fno-ignore-interface-pragmas`
`-fomit-interface-pragmas` | Don't generate interface pragmas | dynamic | `-fno-omit-interface-pragmas`
`-fmax-worker-args` | If a worker has that many arguments, none will be unpacked anymore (default: 10) | static | -
`-fsimplifier-phases` | Set the number of phases for the simplifier (default 2). Ignored with `-O0`. | dynamic | -
`-fmax-simplifier-iterations` | Set the max iterations for the simplifier | dynamic | -
`-fno-state-hack` | Turn off the "state hack" whereby any lambda with a real-world state token as argument is considered to be single-entry. Hence OK to inline things inside it. | static | -
`-fcse` | Turn on common sub-expression elimination. Implied by `-O`. | dynamic | -fno-cse
`-fspecialise` | Turn on specialisation of overloaded functions. Implied by `-O`. | dynamic | -fno-specialise
`-ffull-laziness` | Turn on full laziness (floating bindings outwards). Implied by `-O`. | dynamic | -fno-full-laziness
`-ffloat-in` | Turn on the float-in transformation. Implied by `-O`. | dynamic | -fno-float-in
`-fenable-rewrite-rules` | Switch on all rewrite rules (including rules generated by automatic specialisation of overloaded functions). Implied by `-O`. | dynamic | `-fno-enable-rewrite-rules`
`-fstrictness` | Turn on strictness analysis. Implied by `-O`. | dynamic | -fno-strictness
`-fstrictness=before`=`n` | Run an additional strictness analysis before simplifier phase `n` | dynamic | -
`-fspec-constr` | Turn on the SpecConstr transformation. Implied by `-O2`. | dynamic | -fno-spec-constr
`-fspec-constr-threshold`=`n` | Set the size threshold for the SpecConstr transformation to `n` (default: 200) | static | `-fno-spec-constr-threshold`
`-fspec-constr-count`=`n` | Set to `n` (default: 3) the maximum number of specialisations that will be created for any one function by the SpecConstr transformation | static | `-fno-spec-constr-count`
`-fliberate-case` | Turn on the liberate-case transformation. Implied by `-O2`. | dynamic | -fno-liberate-case
`-fstatic-argument-transformation` | Turn on the static argument transformation. Implied by `-O2`. | dynamic | -fno-static-argument-transformation
`-fliberate-case-threshold`=`n` | Set the size threshold for the liberate-case transformation to `n` (default: 200) | static | `-fno-liberate-case-threshold`
`-funbox-strict-fields` | Flatten strict constructor fields | dynamic | `-fno-unbox-strict-fields`
`-funfolding-creation-threshold` | Tweak unfolding settings | static | `-fno-unfolding-creation-threshold`
`-funfolding-fun-discount` | Tweak unfolding settings | static | `-fno-unfolding-fun-discount`
`-funfolding-keeness-factor` | Tweak unfolding settings | static | `-fno-unfolding-keeness-factor`
`-funfolding-use-threshold` | Tweak unfolding settings | static | `-fno-unfolding-use-threshold`
`-fno-pre-inlining` | Turn off pre-inlining | static | -
`-feager-blackholing` | Turn on eager blackholing | dynamic | -

### 4.19.16. Profiling options

Chapter 5, Profiling

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-auto` | Auto-add `_scc_`s to all exported functions not marked INLINE | dynamic | `-no-auto`
`-auto-all` | Auto-add `_scc_`s to all top-level functions not marked INLINE | dynamic | `-no-auto-all`
`-caf-all` | Auto-add `_scc_`s to all CAFs | dynamic | `-no-caf-all`
`-prof` | Turn on profiling | static | -
`-ticky` | Turn on ticky-ticky profiling | static | -

### 4.19.17. Program coverage options

Section 5.6, “Observing Code Coverage”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fhpc` | Turn on Haskell program coverage instrumentation | static | `-`
`-hpcdir dir` | Directory to deposit .mix files during compilation (default is .hpc) | dynamic | `-`

### 4.19.18. Haskell pre-processor options

Section 4.11.4, “Options affecting a Haskell pre-processor”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-F` | Enable the use of a pre-processor (set with `-pgmF`) | dynamic | -

### 4.19.19. C pre-processor options

Section 4.11.3, “Options affecting the C pre-processor”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-cpp` | Run the C pre-processor on Haskell source files | dynamic | -
`-D` `symbol`[=`value`] | Define a symbol in the C pre-processor | dynamic | `-U` `symbol`
`-U` `symbol` | Undefine a symbol in the C pre-processor | dynamic | -
`-I` `dir` | Add `dir` to the directory search list for `#include` files | dynamic | -

### 4.19.20. Code generation options

Section 4.11.5, “Options affecting code generation”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fasm` | Use the native code generator | dynamic | -fvia-C
`-fvia-C` | Compile via C | dynamic | -fasm
`-fllvm` | Compile via LLVM | dynamic | -fasm
`-fno-code` | Omit code generation | dynamic | -
`-fbyte-code` | Generate byte-code | dynamic | -
`-fobject-code` | Generate object code | dynamic | -

### 4.19.21. Linking options

Section 4.11.6, “Options affecting linking”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-shared` | Generate a shared library (as opposed to an executable) | dynamic | -
`-fPIC` | Generate position-independent code (where available) | static | -
`-dynamic` | Use dynamic Haskell libraries (if available) | static | -
`-dynload` | Selects one of a number of modes for finding shared libraries at runtime. | static | -
`-framework` `name` | On Darwin/MacOS X only, link in the framework `name`. This option corresponds to the `-framework` option for Apple's Linker. | dynamic | -
`-framework-path` `name` | On Darwin/MacOS X only, add `dir` to the list of directories searched for frameworks. This option corresponds to the `-F` option for Apple's Linker. | dynamic | -
`-l` `lib` | Link in library `lib` | dynamic | -
`-L` `dir` | Add `dir` to the list of directories searched for libraries | dynamic | -
`-main-is` | Set main module and function | dynamic | -
`--mk-dll` | DLL-creation mode (Windows only) | dynamic | -
`-no-hs-main` | Don't assume this program contains `main` | dynamic | -
`-rtsopts`, `-rtsopts={none,some,all}` | Control whether the RTS behaviour can be tweaked via command-line flags and the `GHCRTS` environment variable. Using `none` means no RTS flags can be given; `some` means only a minimum of safe options can be given (the default), and `all` (or no argument at all) means that all RTS flags are permitted. | dynamic | -
`-with-rtsopts=`opts`` | Set the default RTS options to `opts`. | dynamic | -
`-no-link` | Omit linking | dynamic | -
`-split-objs` | Split objects (for libraries) | dynamic | -
`-static` | Use static Haskell libraries | static | -
`-threaded` | Use the threaded runtime | static | -
`-debug` | Use the debugging runtime | static | -
`-eventlog` | Enable runtime event tracing | static | -
`-fno-gen-manifest` | Do not generate a manifest file (Windows only) | dynamic | -
`-fno-embed-manifest` | Do not embed the manifest in the executable (Windows only) | dynamic | -
`-fno-shared-implib` | Don't generate an import library for a DLL (Windows only) | dynamic | -
`-dylib-install-name` `path` | Set the install name (via `-install_name` passed to Apple's linker), specifying the full install path of the library file. Any libraries or executables that link with it later will pick up that path as their runtime search location for it. (Darwin/MacOS X only) | dynamic | -

### 4.19.22. Replacing phases

Section 4.11.1, “Replacing the program for one or more phases”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-pgmL` `cmd` | Use `cmd` as the literate pre-processor | dynamic | -
`-pgmP` `cmd` | Use `cmd` as the C pre-processor (with `-cpp` only) | dynamic | -
`-pgmc` `cmd` | Use `cmd` as the C compiler | dynamic | -
`-pgmm` `cmd` | Use `cmd` as the mangler | dynamic | -
`-pgms` `cmd` | Use `cmd` as the splitter | dynamic | -
`-pgma` `cmd` | Use `cmd` as the assembler | dynamic | -
`-pgml` `cmd` | Use `cmd` as the linker | dynamic | -
`-pgmdll` `cmd` | Use `cmd` as the DLL generator | dynamic | -
`-pgmF` `cmd` | Use `cmd` as the pre-processor (with `-F` only) | dynamic | -
`-pgmwindres` `cmd` | Use `cmd` as the program for embedding manifests on Windows. | dynamic | -

### 4.19.23. Forcing options to particular phases

Section 4.11.2, “Forcing options to a particular phase”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-optL` `option` | pass `option` to the literate pre-processor | dynamic | -
`-optP` `option` | pass `option` to cpp (with `-cpp` only) | dynamic | -
`-optF` `option` | pass `option` to the custom pre-processor | dynamic | -
`-optc` `option` | pass `option` to the C compiler | dynamic | -
`-optlo` `option` | pass `option` to the LLVM optimiser | dynamic | -
`-optlc` `option` | pass `option` to the LLVM compiler | dynamic | -
`-optm` `option` | pass `option` to the mangler | dynamic | -
`-opta` `option` | pass `option` to the assembler | dynamic | -
`-optl` `option` | pass `option` to the linker | dynamic | -
`-optdll` `option` | pass `option` to the DLL generator | dynamic | -
`-optwindres` `option` | pass `option` to `windres`. | dynamic | -

### 4.19.24. Platform-specific options

Section 4.15, “Platform-specific Flags”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-msse2` | (x86 only) Use SSE2 for floating point | dynamic | -
`-monly-[432]-regs` | (x86 only) give some registers back to the C compiler | dynamic | -

### 4.19.25. External core file options

Section 4.17, “Generating and compiling External Core Files”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fext-core` | Generate `.hcr` external Core files | dynamic | -

### 4.19.26. Compiler debugging options

Section 4.18, “Debugging the compiler”

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-dcore-lint` | Turn on internal sanity checking | dynamic | -
`-ddump-asm` | Dump assembly | dynamic | -
`-ddump-bcos` | Dump interpreter byte code | dynamic | -
`-ddump-cmm` | Dump C-- output | dynamic | -
`-ddump-cpranal` | Dump output from CPR analysis | dynamic | -
`-ddump-cse` | Dump CSE output | dynamic | -
`-ddump-deriv` | Dump deriving output | dynamic | -
`-ddump-ds` | Dump desugarer output | dynamic | -
`-ddump-flatC` | Dump “flat” C | dynamic | -
`-ddump-foreign` | Dump `foreign export` stubs | dynamic | -
`-ddump-hpc` | Dump after instrumentation for program coverage | dynamic | -
`-ddump-inlinings` | Dump inlining info | dynamic | -
`-ddump-llvm` | Dump LLVM intermediate code | dynamic | -
`-ddump-occur-anal` | Dump occurrence analysis output | dynamic | -
`-ddump-opt-cmm` | Dump the results of C-- to C-- optimising passes | dynamic | -
`-ddump-parsed` | Dump parse tree | dynamic | -
`-ddump-prep` | Dump prepared core | dynamic | -
`-ddump-rn` | Dump renamer output | dynamic | -
`-ddump-rules` | Dump rules | dynamic | -
`-ddump-simpl` | Dump final simplifier output | dynamic | -
`-ddump-simpl-phases` | Dump output from each simplifier phase | dynamic | -
`-ddump-simpl-iterations` | Dump output from each simplifier iteration | dynamic | -
`-ddump-spec` | Dump specialiser output | dynamic | -
`-ddump-splices` | Dump TH spliced expressions, and what they evaluate to | dynamic | -
`-ddump-stg` | Dump final STG | dynamic | -
`-ddump-stranal` | Dump strictness analyser output | dynamic | -
`-ddump-tc` | Dump typechecker output | dynamic | -
`-ddump-types` | Dump type signatures | dynamic | -
`-ddump-worker-wrapper` | Dump worker-wrapper output | dynamic | -
`-ddump-if-trace` | Trace interface files | dynamic | -
`-ddump-tc-trace` | Trace typechecker | dynamic | -
`-ddump-rn-trace` | Trace renamer | dynamic | -
`-ddump-rn-stats` | Renamer stats | dynamic | -
`-ddump-simpl-stats` | Dump simplifier stats | dynamic | -
`-dno-debug-output` | Suppress unsolicited debugging output | static | -
`-dppr-debug` | Turn on debug printing (more verbose) | static | -
`-dsuppress-uniques` | Suppress the printing of uniques in debug output (easier to use diff. | static | -
`-dsuppress-coercions` | Suppress the printing of coercions in Core dumps to make them shorter. | static | -
`-dsuppress-module-prefixes` | Suppress the printing of module qualification prefixes in Core dumps to make them easier to read. | static | -
`-dppr-noprags` | Don't output pragma info in dumps | static | -
`-dppr-user-length` | Set the depth for printing expressions in error msgs | static | -
`-dsource-stats` | Dump haskell source stats | dynamic | -
`-dcmm-lint` | C-- pass sanity checking | dynamic | -
`-dstg-lint` | STG pass sanity checking | dynamic | -
`-dstg-stats` | Dump STG stats | dynamic | -
`-dverbose-core2core` | Show output from each core-to-core pass | dynamic | -
`-dverbose-stg2stg` | Show output from each STG-to-STG pass | dynamic | -
`-dshow-passes` | Print out each pass name as it happens | dynamic | -
`-dfaststring-stats` | Show statistics for fast string usage when finished | dynamic | -

### 4.19.27. Misc compiler options

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fno-hi-version-check` | Don't complain about `.hi` file mismatches | static | -
`-dno-black-holing` | Turn off black holing (probably doesn't work) | static | -
`-fhistory-size` | Set simplification history size | static | -
`-funregisterised` | Unregisterised compilation (use `-unreg` instead) | static | -
`-fno-asm-mangling` | Turn off assembly mangling (use `-unreg` instead) | dynamic | -
`-fno-ghci-sandbox` | Turn off the GHCi sandbox. Means computations are run in teh main thread, rather than a forked thread. | dynamic | -

Prev | Up | Next
4.18. Debugging the compiler | Home | Chapter 5. Profiling