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

-fabstract-refinement-hole-fits

default: off. Toggles whether refinements where one or more of the holes are abstract are reported.

dynamic

-fno-abstract-refinement-hole-fits

-fdefer-diagnostics

Defer and group diagnostic messages by severity

dynamic

-fdiagnostics-as-json

Output diagnostics in Json format specified by JSON schema

dynamic

-fdiagnostics-color=⟨always|auto|never⟩

Use colors in error messages

dynamic

-fdiagnostics-show-caret

Whether to show snippets of original source code

dynamic

-fno-diagnostics-show-caret

-ferror-spans

Output full span in error messages

dynamic

-fhide-source-paths

hide module source and object paths

dynamic

-fkeep-going

Continue compilation as far as possible on errors

dynamic

-fmax-refinement-hole-fits=⟨n⟩

default: 6. Set the maximum number of refinement hole fits for typed holes to display in type error messages.

dynamic

-fno-max-refinement-hole-fits

-fmax-relevant-binds=⟨n⟩

default: 6. Set the maximum number of bindings to display in type error messages.

dynamic

-fno-max-relevant-binds

-fmax-valid-hole-fits=⟨n⟩

default: 6. Set the maximum number of valid hole fits for typed holes to display in type error messages.

dynamic

-fno-max-valid-hole-fits

-fno-show-valid-hole-fits

Disables showing a list of valid hole fits for typed holes in type error messages.

dynamic

-fno-sort-valid-hole-fits

Disables the sorting of the list of valid hole fits for typed holes in type error messages.

dynamic

-fsort-valid-hole-fits

-fprint-axiom-incomps

Display equation incompatibilities in closed type families

dynamic

-fno-print-axiom-incomps

-fprint-equality-relations

Distinguish between equality relations when printing

dynamic

-fno-print-equality-relations

-fprint-error-index-links=⟨always|auto|never⟩

Whether to emit diagnostic codes as ANSI hyperlinks to the Haskell Error Index.

dynamic

-fprint-expanded-synonyms

In type errors, also print type-synonym-expanded types.

dynamic

-fno-print-expanded-synonyms

-fprint-explicit-coercions

Print coercions in types

dynamic

-fno-print-explicit-coercions

-fprint-explicit-foralls

Print explicit forall quantification in types. See also ExplicitForAll

dynamic

-fno-print-explicit-foralls

-fprint-explicit-kinds

Print explicit kind foralls and kind arguments in types. See also KindSignatures

dynamic

-fno-print-explicit-kinds

-fprint-explicit-runtime-reps

Print RuntimeRep and Levity variables in types which are runtime-representation polymorphic.

dynamic

-fno-print-explicit-runtime-reps

-fprint-potential-instances

display all available instances in type error messages

dynamic

-fno-print-potential-instances

-fprint-redundant-promotion-ticks

Print redundant DataKinds promotion ticks

dynamic

-fno-print-redundant-promotion-ticks

-fprint-typechecker-elaboration

Print extra information from typechecker.

dynamic

-fno-print-typechecker-elaboration

-fprint-unicode-syntax

Use unicode syntax when printing expressions, types and kinds. See also UnicodeSyntax

dynamic

-fno-print-unicode-syntax

-frefinement-level-hole-fits=⟨n⟩

default: off. Sets the level of refinement of the refinement hole fits, where level n means that hole fits of up to n holes will be considered.

dynamic

-fno-refinement-level-hole-fits

-freverse-errors

Output errors in reverse order

dynamic

-fno-reverse-errors

-fshow-docs-of-hole-fits

Toggles whether to show the documentation of the valid hole fits in the output.

dynamic

-fno-show-docs-of-hole-fits

-fshow-error-context

Whether to show textual information about error context

dynamic

-fno-show-error-context

-fshow-hole-constraints

Show constraints when reporting typed holes.

dynamic

-fshow-hole-matches-of-hole-fits

Toggles whether to show the type of the additional holes in refinement hole fits.

dynamic

-fno-show-hole-matches-of-hole-fits

-fshow-provenance-of-hole-fits

Toggles whether to show the provenance of the valid hole fits in the output.

dynamic

-fno-show-provenance-of-hole-fits

-fshow-type-app-of-hole-fits

Toggles whether to show the type application of the valid hole fits in the output.

dynamic

-fno-show-type-app-of-hole-fits

-fshow-type-app-vars-of-hole-fits

Toggles whether to show what type each quantified variable takes in a valid hole fit.

dynamic

-fno-show-type-app-vars-of-hole-fits

-fshow-type-of-hole-fits

Toggles whether to show the type of the valid hole fits in the output.

dynamic

-fno-show-type-of-hole-fits

-fsort-by-size-hole-fits

Sort valid hole fits by size.

dynamic

-fno-sort-by-size-hole-fits

-fsort-by-subsumption-hole-fits

Sort valid hole fits by subsumption.

dynamic

-fno-sort-by-subsumption-hole-fits

-funclutter-valid-hole-fits

Unclutter the list of valid hole fits by not showing provenance nor type applications of suggestions.

dynamic

-Rghc-timing

Summarise timing stats for GHC (same as +RTS -tstderr).

dynamic

-v

verbose mode (equivalent to -v3)

dynamic

-v⟨n⟩

set verbosity level

dynamic

5.6.2. Alternative modes of operation

More details in Modes of operation

Flag Description Type Reverse

--frontend ⟨module⟩

run GHC with the given frontend plugin; see Frontend plugins for details.

mode

--help, -?

Display help

mode

--info

display information about the compiler

mode

--interactive

Interactive mode - normally used by just running ghci; see 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 Using ghc --make for details.

mode

--numeric-version

display GHC version (numeric only)

mode

--print-booter-version

display bootstrap compiler version

mode

--print-build-platform

display platform on which GHC was built

mode

--print-c-compiler-flags

C compiler flags used to build GHC

mode

--print-c-compiler-link-flags

C linker flags used to build GHC

mode

--print-debug-on

print whether GHC was built with -DDEBUG

mode

--print-global-package-db

display GHC's global package database directory

mode

--print-have-interpreter

display whether GHC was built with interactive support

mode

--print-have-native-code-generator

display whether target platform has NCG support

mode

--print-host-platform

display host platform of GHC

mode

--print-ld-flags

display linker flags used to compile GHC

mode

--print-leading-underscore

display use of leading underscores on symbol names

mode

--print-libdir

display GHC library directory

mode

--print-object-splitting-supported

display whether GHC supports object splitting

mode

--print-project-git-commit-id

display Git commit id GHC is built from

mode

--print-project-version

display GHC version

mode

--print-rts-ways

display which way RTS was built

mode

--print-stage

display stage number of GHC

mode

--print-support-smp

display whether GHC was compiled with SMP support

mode

--print-tables-next-to-code

display whether GHC was compiled with --enable-tables-next-to-code

mode

--print-target-platform

display target platform of GHC

mode

--print-unregisterised

display whether this GHC was built in unregisterised mode

mode

--run ⟨file⟩

Run a Haskell program.

mode

--show-iface ⟨file⟩

display the contents of an interface file.

mode

--show-options

display the supported command line options

mode

--supported-extensions, --supported-languages

display the supported language extensions

mode

--version, -V

display GHC version

mode

-e ⟨expr⟩

Evaluate expr; see Expression evaluation mode for details.

mode

-M

generate dependency information suitable for use in a Makefile; see Dependency generation for details.

mode

-shared

Create a shared object.

mode

5.6.3. Which phases to run

More details in Batch compiler mode

Flag Description Type Reverse

--merge-objs

Merge a set of objects into a GHCi library.

mode

-C

Stop after generating C (.hc file)

mode

-c

Stop after generating object (.o) file

mode

-E

Stop after preprocessing (.hspp file)

mode

-F

Enable the use of a pre-processor (set with -pgmF ⟨cmd⟩)

dynamic

-S

Stop after generating assembly (.s file)

mode

-x ⟨suffix⟩

Override default behaviour for source files

dynamic

5.6.4. Redirecting output

More details in Redirecting the compilation output(s)

Flag Description Type Reverse

-dep-makefile ⟨file⟩

Use ⟨file⟩ as the makefile

dynamic

-dep-suffix ⟨suffix⟩

Make dependencies that declare that files with suffix .⟨suf⟩⟨osuf⟩ depend on interface files with suffix .⟨suf⟩hi

dynamic

-dumpdir ⟨dir⟩

redirect dump files

dynamic

-dynhisuf ⟨suffix⟩

set the suffix to use for dynamic interface files

dynamic

-dyno ⟨file⟩

set dynamic output filename

dynamic

-dynohi ⟨file⟩

set the filename in which to put the dynamic interface

dynamic

-dynosuf ⟨suffix⟩

set the dynamic output file suffix

dynamic

-hcsuf ⟨suffix⟩

set the suffix to use for intermediate C files

dynamic

-hidir ⟨dir⟩

set directory for interface files

dynamic

-hiedir ⟨dir⟩

set directory for extended interface files

dynamic

-hiesuf ⟨suffix⟩

set the suffix to use for extended interface files

dynamic

-hisuf ⟨suffix⟩

set the suffix to use for interface files

dynamic

-o ⟨file⟩

set output filename

dynamic

-odir ⟨dir⟩

set directory for object files

dynamic

-ohi ⟨file⟩

set the filename in which to put the interface

dynamic

-osuf ⟨suffix⟩

set the output file suffix

dynamic

-outputdir ⟨dir⟩

set output directory

dynamic

-stubdir ⟨dir⟩

redirect FFI stub files

dynamic

5.6.5. Keeping intermediate files

More details in Keeping Intermediate Files

Flag Description Type Reverse

-keep-hc-file, -keep-hc-files

Retain intermediate .hc files.

dynamic

-keep-hi-files

Retain intermediate .hi files (the default).

dynamic

-no-keep-hi-files

-keep-hscpp-file, -keep-hscpp-files

Retain intermediate .hscpp files.

dynamic

-keep-llvm-file, -keep-llvm-files

Retain intermediate LLVM .ll files. Implies -fllvm.

dynamic

-keep-o-files

Retain intermediate .o files (the default).

dynamic

-no-keep-o-files

-keep-s-file, -keep-s-files

Retain intermediate .s files.

dynamic

-keep-tmp-files

Retain all intermediate temporary files.

dynamic

5.6.6. Temporary files

More details in Redirecting temporary files

Flag Description Type Reverse

-tmpdir ⟨dir⟩

set the directory for temporary files

dynamic

5.6.7. Finding imports

More details in The search path

Flag Description Type Reverse

-i

Empty the import directory list

dynamic

-i⟨dir⟩[:⟨dir⟩]*

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

--show-iface ⟨file⟩

See Modes of operation.

mode

-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

5.6.9. Extended interface file options

More details in Options related to extended interface files

Flag Description Type Reverse

-fvalidate-ide-info

Perform some sanity checks on the extended interface files

dynamic

-fwrite-ide-info

Write out extended interface files

dynamic

5.6.10. Recompilation checking

More details in The recompilation checker

Flag Description Type Reverse

-exclude-module=⟨file⟩

Regard ⟨file⟩ as "stable"; i.e., exclude it from having dependencies on it.

dynamic

-fforce-recomp

Turn off recompilation checking. This is implied by any -ddump-X option when compiling a single file (i.e. when using -c).

dynamic

-fno-force-recomp

-fignore-hpc-changes

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

-fno-ignore-hpc-changes

-fignore-optim-changes

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

-fno-ignore-optim-changes

-include-cpp-deps

Include preprocessor dependencies

dynamic

-include-pkg-deps

Regard modules imported from packages as unstable

dynamic

5.6.11. Interactive-mode options

More details in The .ghci and .haskeline files

Flag Description Type Reverse

-fbreak-on-error

Break on uncaught exceptions and errors

dynamic

-fno-break-on-error

-fbreak-on-exception

Break on any exception thrown

dynamic

-fno-break-on-exception

-fbreak-points

Insert breakpoints in the GHCi debugger

dynamic

-fno-break-points

-fghci-hist-size=⟨n⟩

Set the number of entries GHCi keeps for :history. See The GHCi Debugger.

dynamic

-fghci-leak-check

(Debugging only) check for space leaks when loading new modules in GHCi.

dynamic

-fno-ghci-leak-check

-fimplicit-import-qualified

Put in scope qualified identifiers for every loaded module

dynamic

-fno-implicit-import-qualified

-flocal-ghci-history

Use current directory for the GHCi command history file .ghci-history.

dynamic

-fno-local-ghci-history

-fno-it

No longer set the special variable it.

dynamic

-fno-no-it

-fprint-bind-result

Turn on printing of binding results in GHCi

dynamic

-fno-print-bind-result

-fprint-evld-with-show

Instruct :print to use Show instances where possible.

dynamic

-fshow-loaded-modules

Show the names of modules that GHCi loaded after a :load command.

dynamic

-ghci-script

Read additional .ghci files

dynamic

-ignore-dot-ghci

Disable reading of .ghci files

dynamic

-no-ignore-dot-ghci

-interactive-print ⟨name⟩

Select the function to use for printing evaluated expressions in GHCi

dynamic

5.6.12. Packages

More details in Packages

Flag Description Type Reverse

-clear-package-db

Clear the package db stack.

dynamic

-distrust ⟨pkg⟩

Expose package ⟨pkg⟩ and set it to be distrusted. See Safe Haskell.

dynamic

-distrust-all-packages

Distrust all packages by default. See Safe Haskell.

dynamic

-fpackage-trust

Enable Safe Haskell trusted package requirement for trustworthy modules.

dynamic

-global-package-db

Add the global package db to the stack.

dynamic

-hide-all-packages

Hide all packages by default

dynamic

-hide-package ⟨pkg⟩

Hide package ⟨pkg⟩

dynamic

-ignore-package ⟨pkg⟩

Ignore package ⟨pkg⟩

dynamic

-no-auto-link-packages

Don't automatically link in the base and rts packages.

dynamic

-no-global-package-db

Remove the global package db from the stack.

dynamic

-no-user-package-db

Remove the user's package db from the stack.

dynamic

-package ⟨pkg⟩

Expose package ⟨pkg⟩

dynamic

-package-db ⟨file⟩

Add ⟨file⟩ to the package db stack.

dynamic

-package-env ⟨file⟩|⟨name⟩

Use the specified package environment.

dynamic

-package-id ⟨unit-id⟩

Expose package by id ⟨unit-id⟩

dynamic

-this-unit-id ⟨unit-id⟩

Compile to be part of unit (i.e. package) ⟨unit-id⟩

dynamic

-trust ⟨pkg⟩

Expose package ⟨pkg⟩ and set it to be trusted. See Safe Haskell.

dynamic

-user-package-db

Add the user's package db to the stack.

dynamic

5.6.13. 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 editions and extensions.

5.6.14. Warnings

More details in Warnings and sanity-checking

Flag Description Type Reverse

-fenable-th-splice-warnings

Generate warnings for Template Haskell splices

dynamic

-fno-enable-th-splice-warnings

-fhelpful-errors

Make suggestions for mis-spelled names.

dynamic

-fno-helpful-errors

-fmax-pmcheck-models=⟨n⟩

soft limit on the number of parallel models the pattern match checker should check a pattern match clause against

dynamic

-fshow-warning-groups

show which group an emitted warning belongs to.

dynamic

-fno-show-warning-groups

-fvia-C

use the C code generator

dynamic

-W

enable normal warnings

dynamic

-Wno-extra

-w

disable all warnings

dynamic

-Wall

enable almost all warnings (details in Warnings and sanity-checking)

dynamic

-Wno-all

-Wall-missed-specialisations

warn when specialisation of any overloaded function fails.

dynamic

-Wno-all-missed-specialisations

-Wall-missed-specializations

alias for -Wall-missed-specialisations

dynamic

-Wno-all-missed-specializations

-Wambiguous-fields

warn about ambiguous field selectors or updates

dynamic

-Wauto-orphans

(deprecated) Does nothing

dynamic

-Wbadly-staged-types

warn when type binding is used at the wrong TH stage.

dynamic

-Wno-badly-staged-types

-Wcompat

enable future compatibility warnings (details in Warnings and sanity-checking)

dynamic

-Wno-compat

-Wcompat-unqualified-imports

(deprecated) Report unqualified imports of core libraries which are expected to cause compatibility problems in future releases.

dynamic

-Wno-compat-unqualified-imports

-Wcpp-undef

warn on uses of the #if directive on undefined identifiers

dynamic

-Wdata-kinds-tc

warn when an illegal use of a type or kind without DataKinds is caught by the typechecker

dynamic

-Wno-data-kinds-tc

-Wdefault

enable default flags

dynamic

-Wno-default

-Wdefaulted-exception-context

warn when an Control.Exception.Context.ExceptionContext implicit parameter is defaulted to Control.Exception.Context.emptyExceptionContext.

dynamic

-Wnop-defaulted-exception-context

-Wdeferred-out-of-scope-variables

Report warnings when variable out-of-scope errors are deferred until runtime. See -fdefer-out-of-scope-variables.

dynamic

-Wno-deferred-out-of-scope-variables

-Wdeferred-type-errors

Report warnings when deferred type errors are enabled. This option is enabled by default. See -fdefer-type-errors.

dynamic

-Wno-deferred-type-errors

-Wdeprecated-flags

warn about uses of commandline flags that are deprecated

dynamic

-Wno-deprecated-flags

-Wdeprecated-type-abstractions

warn when type abstractions in constructor patterns are used without enabling TypeApplications

dynamic

-Wno-deprecated-type-abstractions

-Wdeprecations

warn about uses of functions & types that have DEPRECATED pragmas, or WARNING pragmas with the deprecated category.

dynamic

-Wno-deprecations

-Wderiving-defaults

warn about default deriving when using both DeriveAnyClass and GeneralizedNewtypeDeriving

dynamic

-Wno-deriving-defaults

-Wderiving-typeable

warn when Typeable is derived

dynamic

-Wno-deriving-typeable

-Wdodgy-exports

warn about dodgy exports

dynamic

-Wno-dodgy-exports

-Wdodgy-foreign-imports

warn about dodgy foreign imports

dynamic

-Wno-dodgy-foreign-imports

-Wdodgy-imports

warn about dodgy imports

dynamic

-Wno-dodgy-imports

-Wduplicate-constraints

warn when a constraint appears duplicated in a type signature

dynamic

-Wno-duplicate-constraints

-Wduplicate-exports

warn when an entity is exported multiple times

dynamic

-Wno-duplicate-exports

-Wempty-enumerations

warn about enumerations that are empty

dynamic

-Wno-empty-enumerations

-Werror

make warnings fatal

dynamic

-Wwarn

-Weverything

enable all warnings supported by GHC

dynamic

-w

-Wextended-warnings

warn about uses of functions & types that have WARNING or DEPRECATED pragmas, across all categories

dynamic

-Wno-extended-warnings

-Wextra

alias for -W

dynamic

-Wno-extra

-Wforall-identifier

(deprecated) Does nothing

dynamic

-Wgadt-mono-local-binds

warn when pattern matching on a GADT without MonoLocalBinds

dynamic

-Wno-gadt-mono-local-binds

-Whi-shadowing

(deprecated) warn when a .hi file in the current directory shadows a library

dynamic

-Wno-hi-shadowing

-Widentities

warn about uses of Prelude numeric conversions that are probably the identity (and hence could be omitted)

dynamic

-Wno-identities

-Wimplicit-kind-vars

(deprecated) warn when kind variables are implicitly quantified over.

dynamic

-Wno-implicit-kind-vars

-Wimplicit-lift

warn about implicit lift in Template Haskell quotes

dynamic

-Wno-implicit-lift

-Wimplicit-prelude

warn when the Prelude is implicitly imported

dynamic

-Wno-implicit-prelude

-Wimplicit-rhs-quantification

warn when type variables on the RHS of a type synonym are implicitly quantified

dynamic

-Wno-implicit-rhs-quantification

-Winaccessible-code

warn about inaccessible code

dynamic

-Wno-inaccessible-code

-Wincomplete-export-warnings

warn when some but not all of exports for a name are warned about

dynamic

-Wno-incomplete-export-warnings

-Wincomplete-patterns

warn when a pattern match could fail

dynamic

-Wno-incomplete-patterns

-Wincomplete-record-selectors

warn when a record selector application could fail

dynamic

-Wno-incomplete-record-selectors

-Wincomplete-record-updates

warn when a record update could fail

dynamic

-Wno-incomplete-record-updates

-Wincomplete-uni-patterns

warn when a pattern match in a lambda expression, pattern binding or a lazy pattern could fail

dynamic

-Wno-incomplete-uni-patterns

-Winconsistent-flags

warn when command line options are inconsistent in some way.

dynamic

-Wno-inconsistent-flags

-Winferred-safe-imports

warn when an explicitly Safe Haskell module imports a Safe-Inferred one

dynamic

-Wno-inferred-safe-imports

-Winline-rule-shadowing

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

-Wno-inline-rule-shadowing

-Winvalid-haddock

warn when a Haddock comment occurs in an invalid position

dynamic

-Wno-invalid-haddock

-Wloopy-superclass-solve

(deprecated) warn when creating potentially-loopy superclass constraint evidence

dynamic

-Wno-loopy-superclass-solve

-Wmisplaced-pragmas

warn about uses of file header pragmas in the module body

dynamic

-Wno-misplaced-pragmas

-Wmissed-extra-shared-lib

Warn when GHCi can't load a shared lib.

dynamic

-Wno-missed-extra-shared-lib

-Wmissed-specialisations

warn when specialisation of an imported, overloaded function fails.

dynamic

-Wno-missed-specialisations

-Wmissed-specializations

alias for -Wmissed-specialisations

dynamic

-Wno-missed-specializations

-Wmissing-deriving-strategies

warn when deriving without mentioning a deriving strategy

dynamic

-Wno-missing-deriving-strategies

-Wmissing-export-lists

warn when a module declaration does not explicitly list all exports

dynamic

-Wno-missing-export-lists

-Wmissing-exported-pattern-synonym-signatures

warn about pattern synonyms without signatures, only if they are exported

dynamic

-Wno-missing-exported-pattern-synonym-signatures

-Wmissing-exported-signatures

warn about top-level functions without signatures, only if they are exported

dynamic

-Wno-missing-exported-signatures

-Wmissing-exported-sigs

(deprecated) warn about top-level functions without signatures, only if they are exported. takes precedence over -Wmissing-signatures

dynamic

-Wno-missing-exported-sigs

-Wmissing-fields

warn when fields of a record are uninitialised

dynamic

-Wno-missing-fields

-Wmissing-home-modules

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 exposed-modules, nor in other-modules.

dynamic

-Wno-missing-home-modules

-Wmissing-import-lists

warn when an import declaration does not explicitly list all the names brought into scope

dynamic

-Wno-missing-import-lists

-Wmissing-kind-signatures

warn when type declarations don't have kind signatures nor CUSKs

dynamic

-Wno-missing-kind-signatures

-Wmissing-local-signatures

warn about polymorphic local bindings without signatures

dynamic

-Wno-missing-local-signatures

-Wmissing-local-sigs

(deprecated) warn about polymorphic local bindings without signatures

dynamic

-Wno-missing-local-sigs

-Wmissing-methods

warn when class methods are undefined

dynamic

-Wno-missing-methods

-Wmissing-monadfail-instances

(deprecated) Warn when a failable pattern is used in a do-block that does not have a MonadFail instance.

dynamic

-Wno-missing-monadfail-instances

-Wmissing-pattern-synonym-signatures

warn when pattern synonyms do not have type signatures

dynamic

-Wno-missing-pattern-synonym-signatures

-Wmissing-poly-kind-signatures

warn when inferred polykinded type or class declaration don't have kind signatures nor CUSKs

dynamic

-Wno-missing-poly-kind-signatures

-Wmissing-role-annotations

warn when type declarations don't have role annotations

dynamic

-Wno-role-annotations-signatures

-Wmissing-safe-haskell-mode

warn when the Safe Haskell mode is not explicitly specified.

dynamic

-Wno-missing-safe-haskell-mode

-Wmissing-signatures

warn about top-level functions without signatures

dynamic

-Wno-missing-signatures

-Wmissing-space-after-bang

(deprecated) Does nothing

dynamic

-Wmonomorphism-restriction

warn when the Monomorphism Restriction is applied

dynamic

-Wno-monomorphism-restriction

-Wname-shadowing

warn when names are shadowed

dynamic

-Wno-name-shadowing

-Wnoncanonical-monad-instances

warn when Applicative or Monad instances have noncanonical definitions of return, pure, (>>), or (*>). See flag description in Warnings and sanity-checking for more details.

dynamic

-Wno-noncanonical-monad-instances

-Wnoncanonical-monadfail-instances

(deprecated) warn when Monad or MonadFail instances have noncanonical definitions of fail.

dynamic

-Wno-noncanonical-monadfail-instances

-Wnoncanonical-monoid-instances

warn when Semigroup or Monoid instances have noncanonical definitions of (<>) or mappend. See flag description in Warnings and sanity-checking for more details.

dynamic

-Wno-noncanonical-monoid-instances

-Wnot

(deprecated) Alias for -w

dynamic

-Woperator-whitespace

warn on prefix, suffix, and tight infix uses of infix operators

dynamic

-Wno-operator-whitespace

-Woperator-whitespace-ext-conflict

warn on uses of infix operators that would be parsed differently were a particular GHC extension enabled

dynamic

-Wno-operator-whitespace-ext-conflict

-Worphans

warn when the module contains orphan instance declarations or rewrite rules

dynamic

-Wno-orphans

-Woverflowed-literals

warn about literals that will overflow their type

dynamic

-Wno-overflowed-literals

-Woverlapping-patterns

warn about overlapping patterns

dynamic

-Wno-overlapping-patterns

-Wpartial-fields

warn when defining a partial record field.

dynamic

-Wno-partial-fields

-Wpartial-type-signatures

warn about holes in partial type signatures when PartialTypeSignatures is enabled. Not applicable when PartialTypeSignatures is not enabled, in which case errors are generated for such holes.

dynamic

-Wno-partial-type-signatures

-Wprepositive-qualified-module

Report imports with a leading/prepositive "qualified"

dynamic

-Wno-prepositive-qualified-module

-Wredundant-bang-patterns

Warn about redundant bang patterns.

dynamic

-Wno-redundant-bang-patterns

-Wredundant-constraints

Have the compiler warn about redundant constraints in type signatures.

dynamic

-Wno-redundant-constraints

-Wredundant-record-wildcards

Warn about record wildcard matches when the wildcard binds no patterns.

dynamic

-Wno-redundant-record-wildcards

-Wredundant-strictness-flags

Warn about redundant strictness flags.

dynamic

-Wno-redundant-strictness-flags

-Wsafe

warn if the module being compiled is regarded to be safe.

dynamic

-Wno-safe

-Wsemigroup

(deprecated) Warn when a Monoid is not Semigroup, and on non-Semigroup definitions of (<>)

dynamic

-Wno-semigroup

-Wsimplifiable-class-constraints

Warn about class constraints in a type signature that can be simplified using a top-level instance declaration.

dynamic

-Wno-simplifiable-class-constraints

-Wstar-binder

warn about binding the (*) type operator despite StarIsType

dynamic

-Wno-star-binder

-Wstar-is-type

warn when * is used to mean Data.Kind.Type

dynamic

-Wno-star-is-type

-Wtabs

warn if there are tabs in the source file

dynamic

-Wno-tabs

-Wterm-variable-capture

warn when an implicitly quantified type variable captures a term's name

dynamic

-Wtrustworthy-safe

warn if the module being compiled is marked as Trustworthy but it could instead be marked as Safe, a more informative bound.

dynamic

-Wno-safe

-Wtype-defaults

warn when defaulting happens

dynamic

-Wno-type-defaults

-Wtype-equality-out-of-scope

warn when type equality a ~ b is used despite being out of scope

dynamic

-Wno-type-equality-out-of-scope

-Wtype-equality-requires-operators

warn when type equality a ~ b is used despite being out of scope

dynamic

-Wno-type-equality-requires-operators

-Wtyped-holes

Report warnings when typed hole errors are deferred until runtime. See -fdefer-typed-holes.

dynamic

-Wno-typed-holes

-Wunbanged-strict-patterns

warn on pattern bind of unlifted variable that is neither bare nor banged

dynamic

-Wno-unbanged-strict-patterns

-Wunicode-bidirectional-format-characters

warn about the usage of unicode bidirectional layout override characters

dynamic

-Wunrecognised-pragmas

warn about uses of pragmas that GHC doesn't recognise

dynamic

-Wno-unrecognised-pragmas

-Wunrecognised-warning-flags

throw a warning when an unrecognised -W... flag is encountered on the command line.

dynamic

-Wno-unrecognised-warning-flags

-Wunsafe

warn if the module being compiled is regarded to be unsafe. See Safe Haskell

dynamic

-Wno-unsafe

-Wunsupported-calling-conventions

warn about use of an unsupported calling convention

dynamic

-Wno-unsupported-calling-conventions

-Wunsupported-llvm-version

Warn when using -fllvm with an unsupported version of LLVM.

dynamic

-Wno-unsupported-llvm-version

-Wunticked-promoted-constructors

warn if promoted constructors are not ticked

dynamic

-Wno-unticked-promoted-constructors

-Wunused-binds

warn about bindings that are unused. Alias for -Wunused-top-binds, -Wunused-local-binds and -Wunused-pattern-binds

dynamic

-Wno-unused-binds

-Wunused-do-bind

warn about do bindings that appear to throw away values of types other than ()

dynamic

-Wno-unused-do-bind

-Wunused-foralls

warn about type variables in user-written forall\s that are unused

dynamic

-Wno-unused-foralls

-Wunused-imports

warn about unnecessary imports

dynamic

-Wno-unused-imports

-Wunused-local-binds

warn about local bindings that are unused

dynamic

-Wno-unused-local-binds

-Wunused-matches

warn about variables in patterns that aren't used

dynamic

-Wno-unused-matches

-Wunused-packages

warn when package is requested on command line, but not needed.

dynamic

-Wno-unused-packages

-Wunused-pattern-binds

warn about pattern match bindings that are unused

dynamic

-Wno-unused-pattern-binds

-Wunused-record-wildcards

Warn about record wildcard matches when none of the bound variables are used.

dynamic

-Wno-unused-record-wildcards

-Wunused-top-binds

warn about top-level bindings that are unused

dynamic

-Wno-unused-top-binds

-Wunused-type-patterns

warn about unused type variables which arise from patterns in in type family and data family instances

dynamic

-Wno-unused-type-patterns

-Wview-pattern-signatures

warn when a view pattern is used with type signature without explicit parens

dynamic

-Wno-view-pattern-signatures

-Wwarn

make warnings non-fatal

dynamic

-Werror

-Wwarnings-deprecations

warn about uses of functions & types that have DEPRECATED pragmas, or WARNING pragmas with the deprecated category. Alias for -Wdeprecations.

dynamic

-Wno-warnings-deprecations

-Wwrong-do-bind

warn about do bindings that appear to throw away monadic values that you should have bound instead

dynamic

-Wno-wrong-do-bind

-Wx-⟨category⟩

warn about uses of functions & types that have WARNING pragmas with the given category

dynamic

-Wno-x-⟨category⟩

5.6.15. 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

-O, -O1

Enable level 1 optimisations

dynamic

-O0

-O0

Disable optimisations (default)

dynamic

-O2

Enable level 2 optimisations

dynamic

-O0

-O⟨n⟩

Any -On where n > 2 is the same as -O2.

dynamic

-O0

5.6.16. 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

-fasm-shortcutting

Enable shortcutting on assembly. Implied by -O2.

dynamic

-fno-asm-shortcutting

-fbinary-blob-threshold=⟨n⟩

default: 500K. Tweak assembly generator for binary blobs.

dynamic

-fblock-layout-cfg

Use the new cfg based block layout algorithm. Implied by -O.

dynamic

-fno-block-layout-cfg

-fblock-layout-weightless

Ignore cfg weights for code layout.

dynamic

-fno-block-layout-weightless

-fblock-layout-weights

Sets edge weights used by the new code layout algorithm.

dynamic

-fcall-arity

Enable call-arity optimisation. Implied by -O.

dynamic

-fno-call-arity

-fcase-folding

Enable constant folding in case expressions. Implied by -O.

dynamic

-fno-case-folding

-fcase-merge

Enable case-merging. Implied by -O.

dynamic

-fno-case-merge

-fcmm-control-flow

Enable control flow optimisation in the Cmm backend. Implied by -O.

dynamic

-fno-cmm-control-flow

-fcmm-elim-common-blocks

Enable Cmm common block elimination. Implied by -O.

dynamic

-fno-cmm-elim-common-blocks

-fcmm-sink

Enable Cmm sinking. Implied by -O.

dynamic

-fno-cmm-sink

-fcmm-static-pred

Enable static control flow prediction. Implied by -O.

dynamic

-fno-cmm-static-pred

-fcore-constant-folding

Enable constant folding in Core. Implied by -O.

dynamic

-fno-core-constant-folding

-fcpr-anal

Turn on Constructed Product Result analysis. Implied by -O.

dynamic

-fno-cpr-anal

-fcross-module-specialise

Turn on specialisation of overloaded functions imported from other modules. Implied by -O.

dynamic

-fno-cross-module-specialise

-fcse

Enable common sub-expression elimination. Implied by -O.

dynamic

-fno-cse

-fdicts-cheap

Make dictionary-valued expressions seem cheap to the optimiser.

dynamic

-fno-dicts-cheap

-fdicts-strict

Make dictionaries strict. Implied by -O2.

dynamic

-fno-dicts-strict

-fdmd-tx-dict-sel

(deprecated) Use a special demand transformer for dictionary selectors.

dynamic

-fno-dmd-tx-dict-sel

-fdmd-unbox-width=⟨n⟩

default: 3. Boxity analysis pretends that returned records with this many fields can be unboxed.

dynamic

-fdo-clever-arg-eta-expansion

Enable sophisticated argument eta-expansion. Implied by -O2.

dynamic

-fno-do-clever-arg-eta-expansion

-fdo-eta-reduction

Enable eta-reduction. Always enabled by default.

dynamic

-fno-do-eta-reduction

-fdo-lambda-eta-expansion

Enable lambda eta-expansion. Always enabled by default.

dynamic

-fno-do-lambda-eta-expansion

-feager-blackholing

Turn on eager blackholing

dynamic

-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

-fexcess-precision

Enable excess intermediate precision

dynamic

-fno-excess-precision

-fexitification

Enables exitification optimisation. Implied by -O.

dynamic

-fno-exitification

-fexpose-all-unfoldings

Expose all unfoldings, even for very large or recursive functions.

dynamic

-fno-expose-all-unfoldings

-fexpose-overloaded-unfoldings

Expose function unfoldings whose type contains constraints, even for very large or recursive functions.

dynamic

-fno-expose-overloaded-unfoldings

-ffloat-in

Turn on the float-in transformation. Implied by -O.

dynamic

-fno-float-in

-ffull-laziness

Turn on full laziness (floating bindings outwards). Implied by -O.

dynamic

-fno-full-laziness

-ffun-to-thunk

(deprecated) superseded by -ffull-laziness.

dynamic

-fno-fun-to-thunk

-fignore-asserts

Ignore assertions in the source. Implied by -O.

dynamic

-fno-ignore-asserts

-fignore-interface-pragmas

Ignore pragmas in interface files. Implied by -O0 only.

dynamic

-fno-ignore-interface-pragmas

-finline-generics

Annotate methods of derived Generic and Generic1 instances with INLINE[1] pragmas based on heuristics. Implied by -O.

dynamic

-fno-inline-generics

-finline-generics-aggressively

Annotate methods of all derived Generic and Generic1 instances with INLINE[1] pragmas.

dynamic

-fno-inline-generics-aggressively

-fkeep-auto-rules

Keep all "auto" rules, generated by specialisation

dynamic

-fno-keep-auto-rules

-flate-dmd-anal

Run demand analysis again, at the end of the simplification pipeline

dynamic

-fno-late-dmd-anal

-flate-specialise

Run a late specialisation pass

dynamic

-fno-late-specialise

-fliberate-case

Turn on the liberate-case transformation. Implied by -O2.

dynamic

-fno-liberate-case

-fliberate-case-threshold=⟨n⟩

default: 2000. Set the size threshold for the liberate-case transformation to ⟨n⟩

dynamic

-fno-liberate-case-threshold

-fllvm-pass-vectors-in-regs

(deprecated) Does nothing

dynamic

-flocal-float-out

Enable local floating definitions out of let-binds.

dynamic

-fno-local-float-out

-flocal-float-out-top-level

Enable local floating to float top-level bindings

dynamic

-fno-local-float-out-top-level

-floopification

Turn saturated self-recursive tail-calls into local jumps in the generated assembly. Implied by -O.

dynamic

-fno-loopification

-fmax-forced-spec-args=⟨n⟩

default: 333. Maximum number of value arguments for forced SpecConstr specializations.

dynamic

-fmax-inline-alloc-size=⟨n⟩

default: 128. Set the maximum size of inline array allocations to ⟨n⟩ bytes (default: 128).

dynamic

-fmax-inline-memcpy-insns=⟨n⟩

default: 32. Inline memcpy calls if they would generate no more than ⟨n⟩ pseudo instructions.

dynamic

-fmax-inline-memset-insns=⟨n⟩

default: 32. Inline memset calls if they would generate no more than ⟨n⟩ pseudo instructions

dynamic

-fmax-simplifier-iterations=⟨n⟩

default: 4. Set the max iterations for the simplifier.

dynamic

-fmax-uncovered-patterns=⟨n⟩

default: 4. Set the maximum number of patterns to display in warnings about non-exhaustive ones.

dynamic

-fmax-worker-args=⟨n⟩

default: 10. Maximum number of value arguments for a worker.

dynamic

-fno-opt-coercion

Turn off the coercion optimiser

dynamic

-fno-pre-inlining

Turn off pre-inlining

dynamic

-fno-state-hack

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

-fobject-determinism

Produce fully deterministic object code

dynamic

-fno-object-determinism

-fomit-interface-pragmas

Don't generate interface pragmas. Implied by -O0 only.

dynamic

-fno-omit-interface-pragmas

-fomit-yields

Omit heap checks when no allocation is being performed.

dynamic

-fno-omit-yields

-foptimal-applicative-do

Use a slower but better algorithm for ApplicativeDo

dynamic

-fno-optimal-applicative-do

-fpedantic-bottoms

Make GHC be more precise about its treatment of bottom (but see also -fno-state-hack). In particular, GHC will not eta-expand through a case expression.

dynamic

-fno-pedantic-bottoms

-fpolymorphic-specialisation

Allow specialisation to abstract over free type variables

dynamic

-fno-polymorphic-specialisation

-fregs-graph

Use the graph colouring register allocator for register allocation in the native code generator.

dynamic

-fno-regs-graph

-fregs-iterative

Use the iterative coalescing graph colouring register allocator in the native code generator.

dynamic

-fno-regs-iterative

-fsimpl-tick-factor=⟨n⟩

default: 100. Set the percentage factor for simplifier ticks.

dynamic

-fsimplifier-phases=⟨n⟩

default: 2. Set the number of phases for the simplifier. Ignored with -O0.

dynamic

-fsolve-constant-dicts

When solving constraints, try to eagerly solve super classes using available dictionaries. Implied by -O.

dynamic

-fno-solve-constant-dicts

-fspec-constr

Turn on the SpecConstr transformation. Implied by -O2.

dynamic

-fno-spec-constr

-fspec-constr-count=⟨n⟩

default: 3.* Set to ⟨n⟩ the maximum number of specialisations that will be created for any one function by the SpecConstr transformation.

dynamic

-fno-spec-constr-count

-fspec-constr-keen

Specialize a call with an explicit constructor argument, even if the argument is not scrutinised in the body of the function

dynamic

-fno-spec-constr-keen

-fspec-constr-threshold=⟨n⟩

default: 2000. Set the size threshold for the SpecConstr transformation to ⟨n⟩.

dynamic

-fno-spec-constr-threshold

-fspecialise

Turn on specialisation of overloaded functions. Implied by -O.

dynamic

-fno-specialise

-fspecialise-aggressively

Turn on specialisation of overloaded functions regardless of size, if unfolding is available

dynamic

-fno-specialise-aggressively

-fspecialise-incoherents

Enable specialisation on incoherent instances

dynamic

-fno-specialise-incoherents

-fstatic-argument-transformation

Turn on the static argument transformation.

dynamic

-fno-static-argument-transformation

-fstg-cse

Enable common sub-expression elimination on the STG intermediate language. Implied by -O.

dynamic

-fno-stg-cse

-fstg-lift-lams

Enable late lambda lifting on the STG intermediate language. Implied by -O2.

dynamic

-fno-stg-lift-lams

-fstg-lift-lams-known

Allow turning known into unknown calls while performing late lambda lifting.

dynamic

-fno-stg-lift-lams-known

-fstg-lift-lams-non-rec-args

Create top-level non-recursive functions with at most <n> parameters while performing late lambda lifting.

dynamic

-fstg-lift-lams-non-rec-args-any

-fstg-lift-lams-rec-args

Create top-level recursive functions with at most <n> parameters while performing late lambda lifting.

dynamic

-fstg-lift-lams-rec-args-any

-fstrictness

Turn on demand analysis. Implied by -O. Implies -fworker-wrapper

dynamic

-fno-strictness

-fstrictness-before=⟨n⟩

Run an additional demand analysis before simplifier phase ⟨n⟩

dynamic

-funbox-small-strict-fields

Flatten strict constructor fields with a pointer-sized representation. Implied by -O.

dynamic

-fno-unbox-small-strict-fields

-funbox-strict-fields

Flatten strict constructor fields

dynamic

-fno-unbox-strict-fields

-funfolding-case-scaling=⟨n⟩

default: 30. Apply a penalty of (inlining_cost * 1/n) for each level of case nesting.

dynamic

-funfolding-case-threshold=⟨n⟩

default: 2. Reduce inlining for cases nested deeper than n.

dynamic

-funfolding-creation-threshold=⟨n⟩

default: 750. Tweak unfolding settings.

dynamic

-funfolding-dict-discount=⟨n⟩

default: 30. Tweak unfolding settings.

dynamic

-funfolding-fun-discount=⟨n⟩

default: 60. Tweak unfolding settings.

dynamic

-funfolding-keeness-factor=⟨n⟩

This has been deprecated in GHC 9.0.1.

dynamic

-funfolding-use-threshold=⟨n⟩

default: 90. Tweak unfolding settings.

dynamic

-fworker-wrapper

Enable the worker/wrapper transformation. Implied by -O and by -fstrictness.

dynamic

-fworker-wrapper-cbv

Enable w/w splits for wrappers whos sole purpose is evaluating arguments.

dynamic

-fwrite-if-compression=⟨n⟩

default: 2. Tweak the level of interface file compression.

dynamic

5.6.17. Profiling options

More details in Profiling

Flag Description Type Reverse

-auto

(deprecated) Alias for -fprof-auto-exported

dynamic

-auto-all

(deprecated) Alias for -fprof-auto

dynamic

-caf-all

(deprecated) Alias for -fprof-cafs

dynamic

-fno-prof-count-entries

Do not collect entry counts

dynamic

-fprof-count-entries

-fprof-auto

Auto-add SCC\ s to all bindings not marked INLINE

dynamic

-fno-prof-auto

-fprof-auto-calls

Auto-add SCC\ s to all call sites

dynamic

-fno-prof-auto

-fprof-auto-exported

Auto-add SCC\ s to all exported bindings not marked INLINE

dynamic

-fno-prof-auto

-fprof-auto-top

Auto-add SCC\ s to all top-level bindings not marked INLINE

dynamic

-fno-prof-auto

-fprof-cafs

Auto-add SCC\ s to all CAFs

dynamic

-fno-prof-cafs

-fprof-callers=⟨name⟩

Auto-add SCC\ s to all call-sites of the named function.

dynamic

-fprof-late

Auto-add SCC\ s to all top level bindings after the core pipeline has run.

dynamic

-fno-prof-late

-fprof-late-inline

Auto-add SCC\ s to all top level bindings after the optimizer has run and retain them when inlining.

dynamic

-fno-prof-late-inline

-fprof-late-overloaded

Auto-add SCC\ s to all top level overloaded bindings after the core pipeline has run.

dynamic

-fno-prof-late-overloaded

-fprof-late-overloaded-calls

Auto-add SCC\ s to all call sites that include dictionary arguments after the core pipeline has run.

dynamic

-fno-prof-late-overloaded-calls

-fprof-manual

Process manual SCC annotations.

dynamic

-fno-prof-manual

-no-auto

(deprecated) Alias for -fno-prof-auto

dynamic

-no-auto-all

(deprecated) Alias for -fno-prof-auto

dynamic

-no-caf-all

(deprecated) Alias for -fno-prof-cafs

dynamic

-prof

Turn on profiling

dynamic

-ticky

Turn on ticky-ticky profiling

dynamic

-ticky-allocd

Track the number of times each closure type is allocated.

dynamic

-ticky-ap-thunk

Don't use standard AP thunks on order to get more reliable entry counters.

dynamic

-ticky-dyn-thunk

Track allocations of dynamic thunks

dynamic

-ticky-LNE

Treat join point binders similar to thunks/functions.

dynamic

-ticky-tag-checks

Emit dummy ticky counters to record how many tag-inference checks tag inference avoided.

dynamic

5.6.18. Program coverage options

More details in Observing Code Coverage

Flag Description Type Reverse

-fhpc

Turn on Haskell program coverage instrumentation

dynamic

-hpcdir⟨dir⟩

Set the directory where GHC places .mix files.

dynamic

5.6.19. C pre-processor options

More details in Options affecting the C pre-processor

Flag Description Type 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⟩

-I⟨dir⟩

Add ⟨dir⟩ to the directory search list for #include files

dynamic

-U⟨symbol⟩

Undefine a symbol in the C pre-processor

dynamic

5.6.20. Code generation options

More details in Options affecting code generation

Flag Description Type Reverse

-dynamic-too

Build dynamic object files as well as static object files during compilation

dynamic

-fasm

Use the native code generator

dynamic

-fllvm

-fbyte-code

Generate byte-code

dynamic

-fbyte-code-and-object-code

Generate object code and byte-code

dynamic

-fexpose-internal-symbols

Produce symbols for all functions, including internal functions.

dynamic

-fexternal-dynamic-refs

Generate code for linking against dynamic libraries

dynamic

-fllvm

Compile using the LLVM code generator

dynamic

-fasm

-fno-code

Omit code generation

dynamic

-fobject-code

Generate object code

dynamic

-fPIC

Generate position-independent code (where available)

dynamic

-fPIE

Generate code for a position-independent executable (where available)

dynamic

-fprefer-byte-code

Use byte-code if it is available to evaluate TH splices

dynamic

-fwrite-if-simplified-core

Write an interface file containing the simplified core of the module.

dynamic

-fwrite-interface

Always write interface files

dynamic

5.6.21. Linking options

More details in Options affecting linking

Flag Description Type Reverse

-c

Stop after generating object (.o) file

mode

-debug

Use the debugging runtime

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/OS X only)

dynamic

-dynamic

Build dynamically-linked object files and executables

dynamic

-dynload

Selects one of a number of modes for finding shared libraries at runtime.

dynamic

-eventlog

Enable runtime event tracing

dynamic

-fcompact-unwind

Instruct the linker to produce a __compact_unwind section.

dynamic

-fkeep-cafs

Do not garbage-collect CAFs (top-level expressions) at runtime

dynamic

-flink-rts

Link the runtime when generating a shared or static library

dynamic

-fno-embed-manifest

Do not embed the manifest in the executable (Windows only)

dynamic

-fno-gen-manifest

Do not generate a manifest file (Windows only)

dynamic

-fno-shared-implib

Don't generate an import library for a DLL (Windows only)

dynamic

-framework ⟨name⟩

On Darwin/OS X/iOS only, link in the framework ⟨name⟩. This option corresponds to the -framework option for Apple's Linker.

dynamic

-framework-path ⟨dir⟩

On Darwin/OS X/iOS only, add ⟨dir⟩ to the list of directories searched for frameworks. This option corresponds to the -F option for Apple's Linker.

dynamic

-fsplit-sections, -split-sections

Split sections for link-time dead-code stripping

dynamic

-fno-split-sections

-fuse-rpaths

Set the rpath based on -L flags

dynamic

-fwhole-archive-hs-libs

When linking a binary executable, this inserts the flag -Wl,--whole-archive before any -l flags for Haskell libraries, and -Wl,--no-whole-archive afterwards

dynamic

-L ⟨dir⟩

Add ⟨dir⟩ to the list of directories searched for libraries

dynamic

-l ⟨lib⟩

Link in library ⟨lib⟩

dynamic

-main-is ⟨thing⟩

Set main module and function

dynamic

-no-hs-main

Don't assume this program contains main

dynamic

-no-pie

Don't instruct the linker to produce a position-independent executable.

dynamic

-pie

-no-rtsopts-suggestions

Don't print RTS suggestions about linking with -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩].

dynamic

-package ⟨name⟩

Expose package ⟨pkg⟩

dynamic

-pie

Instruct the linker to produce a position-independent executable.

dynamic

-no-pie

-rdynamic

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 -optl -rdynamic on Linux, and -optl -export-all-symbols on Windows.

dynamic

-rtsopts[=⟨none|some|all|ignore|ignoreAll⟩]

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, if -rtsopts is not passed); all means that all RTS flags are permitted (the default, if -rtsopts is passed with no argument); ignore means RTS flags can be given, but are treated as regular arguments and passed to the Haskell program as arguments; ignoreAll is the same as ignore, but GHCRTS is also ignored. -rtsopts does not affect -with-rtsopts behavior; flags passed via -with-rtsopts are used regardless of -rtsopts.

dynamic

-shared

Generate a shared library (as opposed to an executable)

dynamic

-single-threaded

Use the single-threaded runtime

dynamic

-threaded

-static

Use static Haskell libraries

dynamic

-staticlib

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

-threaded

Use the threaded runtime

dynamic

-single-threaded

-with-rtsopts=⟨opts⟩

Set the default RTS options to ⟨opts⟩.

dynamic

5.6.22. Plugin options

More details in Compiler Plugins

Flag Description Type Reverse

-fclear-plugins

Clear the list of active plugins

dynamic

-fplugin-library=⟨file-path⟩;⟨unit-id⟩;⟨module⟩;⟨args⟩

Load a pre-compiled static plugin from an external library

dynamic

-fplugin-opt=⟨module⟩:⟨args⟩

Give arguments to a plugin module; module must be specified with -fplugin=⟨module⟩

dynamic

-fplugin-trustworthy

Trust the used plugins and no longer mark the compiled module as unsafe

dynamic

-fplugin=⟨module⟩

Load a plugin exported by a given module

dynamic

-hide-all-plugin-packages

Hide all packages for plugins by default

dynamic

-plugin-package ⟨pkg⟩

Expose ⟨pkg⟩ for plugins

dynamic

-plugin-package-id ⟨pkg-id⟩

Expose ⟨pkg-id⟩ for plugins

dynamic

5.6.23. Replacing phases

More details in Replacing the program for one or more phases

Flag Description Type Reverse

-pgma ⟨cmd⟩

Use ⟨cmd⟩ as the assembler

dynamic

-pgmc ⟨cmd⟩

Use ⟨cmd⟩ as the C compiler

dynamic

-pgmCmmP ⟨cmd⟩

Use ⟨cmd⟩ as the C-- C pre-processor

dynamic

-pgmcxx ⟨cmd⟩

Use ⟨cmd⟩ as the C++ compiler

dynamic

-pgmF ⟨cmd⟩

Use ⟨cmd⟩ as the pre-processor (with -F only)

dynamic

-pgmi ⟨cmd⟩

Use ⟨cmd⟩ as the external interpreter command.

dynamic

-pgminstall_name_tool ⟨cmd⟩

Use ⟨cmd⟩ as the program to inject runpath into mach-o dylibs on macOS

dynamic

-pgmJSP ⟨cmd⟩

Use ⟨cmd⟩ as the JavaScript C pre-processor (only for javascript-backend)

dynamic

-pgmL ⟨cmd⟩

Use ⟨cmd⟩ as the literate pre-processor

dynamic

-pgml ⟨cmd⟩

Use ⟨cmd⟩ as the linker

dynamic

-pgmlas ⟨cmd⟩

Use ⟨cmd⟩ as the LLVM assembler

dynamic

-pgmlc ⟨cmd⟩

Use ⟨cmd⟩ as the LLVM compiler

dynamic

-pgmlm ⟨cmd⟩

Use ⟨cmd⟩ as the linker when merging object files

dynamic

-pgmlo ⟨cmd⟩

Use ⟨cmd⟩ as the LLVM optimiser

dynamic

-pgmotool ⟨cmd⟩

Use ⟨cmd⟩ as the program to inspect mach-o dylibs on macOS

dynamic

-pgmP ⟨cmd⟩

Use ⟨cmd⟩ as the C pre-processor (with -cpp only)

dynamic

-pgms ⟨cmd⟩

Use ⟨cmd⟩ as the splitter

dynamic

-pgmwindres ⟨cmd⟩

Use ⟨cmd⟩ as the program for embedding manifests on Windows.

dynamic

5.6.24. Forcing options to particular phases

More details in Forcing options to a particular phase

Flag Description Type Reverse

-opta ⟨option⟩

pass ⟨option⟩ to the assembler

dynamic

-optc ⟨option⟩

pass ⟨option⟩ to the C compiler

dynamic

-optCmmP ⟨option⟩

pass ⟨option⟩ to the C-- C pre-processor.

dynamic

-optcxx ⟨option⟩

pass ⟨option⟩ to the C++ compiler

dynamic

-optF ⟨option⟩

pass ⟨option⟩ to the custom pre-processor

dynamic

-opti ⟨option⟩

pass ⟨option⟩ to the interpreter sub-process.

dynamic

-optJSP ⟨option⟩

pass ⟨option⟩ to JavaScript C pre-processor (only for javascript-backend)

dynamic

-optL ⟨option⟩

pass ⟨option⟩ to the literate pre-processor

dynamic

-optl ⟨option⟩

pass ⟨option⟩ to the linker

dynamic

-optlas ⟨option⟩

pass ⟨option⟩ to the LLVM assembler

dynamic

-optlc ⟨option⟩

pass ⟨option⟩ to the LLVM compiler

dynamic

-optlm ⟨option⟩

pass ⟨option⟩ to the linker when merging object files.

dynamic

-optlo ⟨option⟩

pass ⟨option⟩ to the LLVM optimiser

dynamic

-optP ⟨option⟩

pass ⟨option⟩ to cpp (with -cpp only)

dynamic

-optwindres ⟨option⟩

pass ⟨option⟩ to windres.

dynamic

-pgmc-supports-no-pie

(deprecated) Indicate that the linker supports -no-pie

dynamic

-pgml-supports-no-pie

Indicate that the linker supports -no-pie

dynamic

5.6.25. Platform-specific options

More details in Platform-specific Flags

Flag Description Type Reverse

-mavx

(x86 only) Enable support for AVX SIMD extensions

dynamic

-mavx2

(x86 only) Enable support for AVX2 SIMD extensions

dynamic

-mavx512cd

(x86 only) Enable support for AVX512-CD SIMD extensions

dynamic

-mavx512er

(x86 only) Enable support for AVX512-ER SIMD extensions

dynamic

-mavx512f

(x86 only) Enable support for AVX512-F SIMD extensions

dynamic

-mavx512pf

(x86 only) Enable support for AVX512-PF SIMD extensions

dynamic

-mbmi

(x86 only) Use BMI1 for bit manipulation operations

dynamic

-mbmi2

(x86 only) Use BMI2 for bit manipulation operations

dynamic

-mfma

Use native FMA instructions for fused multiply-add floating-point operations

dynamic

-msse

(x86 only) Use SSE for floating-point operations

dynamic

-msse2

(x86 only) Use SSE2 for floating-point operations

dynamic

-msse3

(x86 only) Use SSE3 for floating-point operations

dynamic

-msse4

(x86 only) Use SSE4 for floating-point operations

dynamic

-msse4.2

(x86 only) Use SSE4.2 for floating-point operations

dynamic

5.6.26. Compiler debugging options

More details in Debugging the compiler

Flag Description Type Reverse

-dasm-lint

ASM pass sanity checking

dynamic

-dcmm-lint

C-\- pass sanity checking

dynamic

-dcore-lint

Turn on internal sanity checking

dynamic

-ddisable-js-c-sources

Disable the link with C sources compiled to JavaScript

dynamic

-ddisable-js-minifier

Generate pretty-printed JavaScript code instead of minified (compacted) code.

dynamic

-ddump-asm

Dump final assembly

dynamic

-ddump-asm-conflicts

Dump register conflicts from the register allocator.

dynamic

-ddump-asm-liveness

Dump assembly augmented with register liveness

dynamic

-ddump-asm-native

Dump initial assembly

dynamic

-ddump-asm-regalloc

Dump the result of register allocation

dynamic

-ddump-asm-regalloc-stages

Dump the build/spill stages of the -fregs-graph register allocator.

dynamic

-ddump-asm-stats

Dump statistics from the register allocator.

dynamic

-ddump-bcos

Dump interpreter byte code

dynamic

-ddump-c-backend

Dump C code produced by the C (unregisterised) backend.

dynamic

-ddump-call-arity

Dump output of the call arity analysis pass.

dynamic

-ddump-cfg-weights

Dump the assumed weights of the CFG.

dynamic

-ddump-cmm

Dump the final C-\- output

dynamic

-ddump-cmm-caf

Dump the results of the C-\- CAF analysis pass.

dynamic

-ddump-cmm-cbe

Dump the results of common block elimination

dynamic

-ddump-cmm-cfg

Dump the results of the C-\- control flow optimisation pass.

dynamic

-ddump-cmm-cps

Dump the results of the CPS pass

dynamic

-ddump-cmm-from-stg

Dump STG-to-C-\- output

dynamic

-ddump-cmm-info

Dump the results of the C-\- info table augmentation pass.

dynamic

-ddump-cmm-opt

Dump the results of C-\- to C-\- optimising passes

dynamic

-ddump-cmm-proc

Dump the results of proc-point analysis

dynamic

-ddump-cmm-procmap

Dump the results of the C-\- proc-point map pass.

dynamic

-ddump-cmm-raw

Dump raw C-\-

dynamic

-ddump-cmm-sink

Dump the results of the C-\- sinking pass.

dynamic

-ddump-cmm-sp

Dump the results of the C-\- stack layout pass.

dynamic

-ddump-cmm-split

Dump the results of the C-\- proc-point splitting pass.

dynamic

-ddump-cmm-switch

Dump the results of switch lowering passes

dynamic

-ddump-cmm-thread-sanitizer

Dump the results of the C-\- ThreadSanitizer elaboration pass.

dynamic

-ddump-cmm-verbose

Write output from main C-\- pipeline passes to files

dynamic

-ddump-cmm-verbose-by-proc

Show output from main C-\- pipeline passes (grouped by proc)

dynamic

-ddump-core-stats

Print a one-line summary of the size of the Core program at the end of the optimisation pipeline

dynamic

-ddump-cpr-signatures

Dump CPR signatures

dynamic

-ddump-cpranal

Dump CPR analysis output

dynamic

-ddump-cs-trace

Trace constraint solver

dynamic

-ddump-cse

Dump CSE output

dynamic

-ddump-debug

Dump generated DWARF debug information

dynamic

-ddump-deriv

Dump deriving output

dynamic

-ddump-dmd-signatures

Dump top-level demand signatures

dynamic

-ddump-dmdanal

Dump demand analysis output

dynamic

-ddump-ds, -ddump-ds-preopt

Dump desugarer output.

dynamic

-ddump-ec-trace

Trace exhaustiveness checker

dynamic

-ddump-exitify

Dump output of the exitification pass.

dynamic

-ddump-faststrings

Dump the whole FastString table when finished

dynamic

-ddump-file-prefix=⟨str⟩

Set the prefix of the filenames used for debugging output.

dynamic

-ddump-float-in

Dump float in output

dynamic

-ddump-foreign

Dump foreign export stubs

dynamic

-ddump-full-laziness, -ddump-float-out

Dump full laziness pass output

dynamic

-ddump-hie

Dump the hie file syntax tree

dynamic

-ddump-hpc

An alias for -ddump-ticked.

dynamic

-ddump-if-trace

Trace interface files

dynamic

-ddump-inlinings

Dump inlinings performed by the simplifier.

dynamic

-ddump-js

Dump final JavaScript code

dynamic

-ddump-json

(deprecated) Use -fdiagnostics-as-json instead

dynamic

-ddump-late-cc

Dump core with late cost centres added

dynamic

-ddump-liberate-case

Dump liberate case output

dynamic

-ddump-llvm

Dump LLVM intermediate code.

dynamic

-ddump-mod-map

Dump the state of the module mapping database.

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-parsed-ast

Dump parser output as a syntax tree

dynamic

-ddump-prep

Dump prepared core

dynamic

-ddump-rn

Dump renamer output

dynamic

-ddump-rn-ast

Dump renamer output as a syntax tree

dynamic

-ddump-rn-stats

Renamer stats

dynamic

-ddump-rn-trace

Trace renamer

dynamic

-ddump-rtti

Trace runtime type inference

dynamic

-ddump-rule-firings

Dump rule firing info

dynamic

-ddump-rule-rewrites

Dump detailed rule firing info

dynamic

-ddump-rules

Dump rewrite rules

dynamic

-ddump-simpl

Dump final simplifier output

dynamic

-ddump-simpl-iterations

Dump output from each simplifier iteration

dynamic

-ddump-simpl-stats

Dump simplifier stats

dynamic

-ddump-simpl-trace

Dump trace messages in simplifier

dynamic

-ddump-spec

Dump specialiser output

dynamic

-ddump-spec-constr

Dump specialiser output from SpecConstr

dynamic

-ddump-splices

Dump TH spliced expressions, and what they evaluate to

dynamic

-ddump-static-argument-transformation

Dump static argument transformation output

dynamic

-ddump-stg

(deprecated) Alias for -ddump-stg-from-core

dynamic

-ddump-stg-cg

Show output after Stg2Stg

dynamic

-ddump-stg-final

Show output of last STG pass.

dynamic

-ddump-stg-from-core

Show CoreToStg output

dynamic

-ddump-stg-from-js-sinker

Show JavaScript sinker output

dynamic

-ddump-stg-tags

Show output of the tag inference pass.

dynamic

-ddump-stg-unarised

Show unarised STG

dynamic

-ddump-str-signatures

(deprecated) Alias for -ddump-dmd-signatures

dynamic

-ddump-stranal

(deprecated) Alias for -ddump-dmdanal

dynamic

-ddump-tc

Dump typechecker output

dynamic

-ddump-tc-ast

Dump typechecker output as a syntax tree

dynamic

-ddump-tc-trace

Trace typechecker

dynamic

-ddump-ticked

Dump the code instrumented by HPC (Observing Code Coverage).

dynamic

-ddump-timings

Dump per-pass timing and allocation statistics

dynamic

-ddump-to-file

Dump to files instead of stdout

dynamic

-ddump-types

Dump type signatures

dynamic

-ddump-verbose-inlinings

Dump all considered inlinings

dynamic

-ddump-view-pattern-commoning

Dump commoned view patterns

dynamic

-ddump-worker-wrapper

Dump worker-wrapper output

dynamic

-dfaststring-stats

Show statistics for fast string usage when finished

dynamic

-dhex-word-literals

Print values of type Word# in hexadecimal.

dynamic

-dinitial-unique=⟨s⟩

Start UniqSupply allocation from ⟨s⟩.

dynamic

-dinline-check=⟨str⟩

Dump information about inlining decisions

dynamic

-dipe-stats

Show statistics about IPE information

dynamic

-dkeep-comments

Include comments in the parser. Useful in combination with -ddump-parsed-ast.

dynamic

-dlinear-core-lint

Turn on internal sanity checking

dynamic

-dlint

Enable several common internal sanity checkers

dynamic

-dno-debug-output

Suppress unsolicited debugging output

dynamic

-ddebug-output

-dno-typeable-binds

Don't generate bindings for Typeable methods

dynamic

-dppr-case-as-let

Print single alternative case expressions as strict lets.

dynamic

-dppr-cols=⟨n⟩

Set the width of debugging output. For example -dppr-cols200

dynamic

-dppr-debug

Turn on debug printing (more verbose)

dynamic

-dppr-user-length

Set the depth for printing expressions in error msgs

dynamic

-drule-check=⟨str⟩

Dump information about potential rule application

dynamic

-dshow-passes

Print out each pass name as it happens

dynamic

-dstg-lint

STG pass sanity checking

dynamic

-dsuppress-all

In dumps, suppress everything (except for uniques) that is suppressible.

dynamic

-dsuppress-coercion-types

Suppress the printing of coercion types in Core dumps to make them shorter

dynamic

-dsuppress-coercions

Suppress the printing of coercions in Core dumps to make them shorter

dynamic

-dsuppress-core-sizes

Suppress the printing of core size stats per binding (since 9.4)

dynamic

-dsuppress-idinfo

Suppress extended information about identifiers where they are bound

dynamic

-dsuppress-module-prefixes

Suppress the printing of module qualification prefixes

dynamic

-dsuppress-stg-free-vars

Suppress the printing of closure free variable lists in STG output

dynamic

-dsuppress-stg-reps

Suppress rep annotations on STG args.

dynamic

-dsuppress-ticks

Suppress "ticks" in the pretty-printer output.

dynamic

-dsuppress-timestamps

Suppress timestamps in dumps

dynamic

-dsuppress-type-applications

Suppress type applications

dynamic

-dsuppress-type-signatures

Suppress type signatures

dynamic

-dsuppress-unfoldings

Suppress the printing of the stable unfolding of a variable at its binding site

dynamic

-dsuppress-uniques

Suppress the printing of uniques in debug output (easier to use diff)

dynamic

-dsuppress-var-kinds

Suppress the printing of variable kinds

dynamic

-dtag-inference-checks

Affirm tag inference results are correct at runtime.

dynamic

-dth-dec-file

Dump evaluated TH declarations into *.th.hs files

dynamic

-dunique-increment=⟨i⟩

Set the increment for the generated Unique's to ⟨i⟩.

dynamic

-dverbose-core2core

Show output from each core-to-core pass

dynamic

-dverbose-stg2stg

Show output from each STG-to-STG pass

dynamic

-falignment-sanitisation

Compile with alignment checks for all info table dereferences.

dynamic

-fcatch-nonexhaustive-cases

Add a default error alternative to case expressions without a default alternative.

dynamic

-fcheck-prim-bounds

Instrument array primops with bounds checks.

dynamic

-fcmm-thread-sanitizer

Enable ThreadSanitizer instrumentation of memory accesses.

dynamic

-fdistinct-constructor-tables

Generate a fresh info table for each usage of a data constructor.

dynamic

-fdump-with-ways

Include the tag of the enabled ways in the extension of dump files.

dynamic

-finfo-table-map

Embed a lookup table in the generated binary which maps the address of an info table to the source position the closure originated from.

dynamic

-finfo-table-map-with-fallback

Include info tables with no source location information in the info table map.

dynamic

-fno-info-table-map-with-fallback

-finfo-table-map-with-stack

Include info tables for STACK closures in the info table map.

dynamic

-fno-info-table-map-with-stack

-fllvm-fill-undef-with-garbage

Intruct LLVM to fill dead STG registers with garbage

dynamic

-fno-info-table-map-with-fallback

Omit info tables with no source location information from the info table map.

dynamic

-finfo-table-map-with-fallback

-fno-info-table-map-with-stack

Omit info tables for STACK closures from the info table map.

dynamic

-finfo-table-map-with-stack

-forig-thunk-info

Generate stg_orig_thunk_info stack frames on thunk entry

dynamic

-fproc-alignment

Align functions at given boundary.

dynamic

-funoptimized-core-for-interpreter

Disable optimizations with the interpreter

dynamic

-fno-unoptimized-core-for-interpreter

-g, -g⟨n⟩

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.27. Miscellaneous compiler options

Flag Description Type Reverse

-ddump-mod-cycles

Dump module cycles

dynamic

-fdefer-out-of-scope-variables

Convert variable out of scope variables errors into warnings. Implied by -fdefer-type-errors. See also -Wdeferred-out-of-scope-variables.

dynamic

-fno-defer-out-of-scope-variables

-fdefer-type-errors

Turn type errors into warnings, deferring the error until runtime. Implies -fdefer-typed-holes and -fdefer-out-of-scope-variables. See also -Wdeferred-type-errors.

dynamic

-fno-defer-type-errors

-fdefer-typed-holes

Convert typed hole errors into warnings, deferring the error until runtime. Implied by -fdefer-type-errors. See also -Wtyped-holes.

dynamic

-fno-defer-typed-holes

-fexternal-interpreter

Run interpreted code in a separate process

dynamic

-ffamily-application-cache

Use a cache when reducing type family applications

dynamic

-fno-family-application-cache

-fglasgow-exts

Deprecated. Enable most language extensions; see Controlling editions and extensions for exactly which ones.

dynamic

-fno-glasgow-exts

-fno-safe-haskell

Disable Safe Haskell

dynamic

-ghcversion-file ⟨path to ghcversion.h⟩

(GHC as a C compiler only) Use this ghcversion.h file

dynamic

-H ⟨size⟩

Set the minimum size of the heap to ⟨size⟩

dynamic

-hidden-module ⟨module name⟩

A module which should not be visible outside its unit.

dynamic

-j[⟨n⟩]

When compiling with --make, compile ⟨n⟩ modules in parallel.

dynamic

-jsem

When compiling with --make, coordinate with other processes through the semaphore ⟨sem⟩ to compile modules in parallel.

dynamic

-reexported-module ⟨reexport-spec⟩

A module which should be reexported from this unit.

dynamic

-this-package-name ⟨unit-id⟩

The name of the package which this module would be part of when installed.

dynamic

-unit @⟨filename⟩

Specify the options to build a specific unit.

dynamic

-working-dir ⟨dir⟩

Specify the directory a unit is expected to be compiled in.

dynamic