Flag referenceThis section is a quick-reference for GHC's command-line
flags. For each flag, we also list its static/dynamic status (see
), and the flag's opposite
(if available).Verbosity optionsMore details in FlagDescriptionStatic/DynamicReverseverbose mode (equivalent to )dynamic-nset verbosity leveldynamic-Print explicit forall quantification in types. See also dynamic-fno-print-explicit-forallsPrint explicit kind foralls and kind arguments in types. See also dynamic-fno-print-explicit-kindsUse unicode syntax when printing expressions, types and kinds. See also dynamic-fno-print-unicode-syntaxoutput full span in error messagesdynamic-sizeSet the minimum heap size to sizedynamic-Summarise timing stats for GHC (same as +RTS -tstderr)dynamic-Alternative modes of operationMore details in FlagDescriptionStatic/DynamicReverse,Disply helpmode-Interactive mode - normally used by just running ghci;
see for details.mode-Build a multi-module Haskell program, automatically figuring out dependencies. Likely to be much easier, and faster, than using make;
see for details..mode-Evaluate expr;
see for details.mode-Display the contents of an interface file.mode-Generate dependency information suitable for use in a Makefile;
see for details.mode-, display the supported language extensionsmode-display the supported command line optionsmode-display information about the compilermode-display GHC versionmode-display GHC version (numeric only)mode-display GHC library directorymode-Which phases to runFlagDescriptionStatic/DynamicReverseStop after preprocessing (.hspp file)mode-Stop after generating C (.hc file)mode-Stop after generating assembly (.s file)mode-Stop after generating object (.o) filemode-suffixOverride default behaviour for source filesdynamic-Redirecting outputFlagDescriptionStatic/DynamicReversesuffixset the suffix to use for intermediate C filesdynamic-dirset directory for interface filesdynamic-suffixset the suffix to use for interface filesdynamic-filenameset output filenamedynamic-dirset directory for object filesdynamic-filenameset the filename in which to put the interfacedynamicsuffixset the output file suffixdynamic-dirredirect FFI stub filesdynamic-dirredirect dump filesdynamic-dirset output directorydynamic-Keeping intermediate filesFlagDescriptionStatic/DynamicReverse or
retain intermediate .hc filesdynamic- or
retain intermediate LLVM .ll filesdynamic- or
retain intermediate .s filesdynamic-retain all intermediate temporary filesdynamic-Temporary filesFlagDescriptionStatic/DynamicReverseset the directory for temporary filesdynamic-Finding importsFlagDescriptionStatic/DynamicReversedir1:dir2:...add dir,
dir2, etc. to import pathdynamic/:set-Empty the import directory listdynamic/:set-Interface file optionsFlagDescriptionStatic/DynamicReverseDump the new interface to stdoutdynamic-Show the differences vs. the old interfacedynamic-Dump a minimal set of importsdynamic-fileSee .Recompilation checkingFlagDescriptionStatic/DynamicReverseTurn off recompilation checking. This is implied by any
option when compiling a single
file (i.e. when using -c).dynamicInteractive-mode optionsFlagDescriptionStatic/DynamicReverseDisable reading of .ghci filesdynamic-Read additional .ghci filesdynamic-Break on uncaught exceptions and errorsdynamicBreak on any exception throwndynamicSet the number of entries GHCi keeps for :historydynamicEnable usage of Show instances in :printdynamicTurn on printing of binding results in GHCidynamicTurn off printing of binding contents in GHCidynamic-Turn off
implicit qualified import of everything in GHCidynamic-Select the function
to use for printing evaluated expressions in GHCidynamic-PackagesFlagDescriptionStatic/DynamicReversePCompile to be part of package Pdynamic-PExpose package Pdynamic/:set-Hide all packages by defaultdynamic-nameHide package Pdynamic/:set-nameIgnore package Pdynamic/:set-fileAdd file to the package db stack.dynamic-Clear the package db stack.dynamic-Remove the global package db from the stack.dynamic-Add the global package db to the stack.dynamic-Remove the user's package db from the stack.dynamic-Add the user's package db to the stack.dynamic-Don't automatically link in the base and rts packages.dynamic-PExpose package P and set it to be
trusteddynamic/:set-PExpose package P and set it to be
distrusteddynamic/:set-Distrust all packages by defaultdynamic/:set-Language optionsLanguage options can be enabled either by a command-line option
, or by a {-# LANGUAGE blah #-}
pragma in the file itself. See . Some
options are enabled using flags.FlagDescriptionStatic/DynamicReversenSet the iteration limit for the type-constraint solver.
The default limit is 4. Typically one iteration
suffices; so please yell if you find you need to set
it higher than the default. Zero means infinity. dynamicnSet the limit for type simplification.
Default is 200; zero means infinity.dynamicnDeprecated. Use n instead.dynamicDeprecated. Enable most language extensions; see for exactly which ones.dynamicMake tuple pattern matching irrefutabledynamicEnable Safe Haskell trusted package requirement for trustworthy modules.dynamicnDeprecated. Use n instead.dynamicAllow the user to write ambiguous types,
and the type inference engine to infer them.
dynamicEnable arrow
notation extensiondynamicAs of GHC 7.10, this option is not needed, and should
not be used. Automatically derive Typeable instances for every datatype and type class declaration.
Implies .dynamicEnable bang patterns.dynamicEnable support for binary literals.dynamicEnable the CAPI calling convention.dynamicEnable constrained class methods.dynamicEnable a kind of constraints.dynamicEnable the C preprocessor.dynamicEnable datatype promotion.dynamicEnable default signatures.dynamicEnable deriving for any
class.dynamicEnable deriving for the Data class.
Implied by .dynamicEnable deriving for the Functor class.
Implied by .dynamicEnable deriving for the Foldable class.
Implied by .dynamicEnable deriving for the Generic class.dynamicEnable deriving for the Traversable class.
Implies and .dynamicEnable record field disambiguation.
Implied by .dynamicAllow empty case alternatives.dynamicEnable empty data declarations.dynamicEnable existential quantification.dynamicEnable explicit universal quantification.
Implied by ,
,
and
.
dynamicEnable using the keyword type to specify the namespace of
entries in imports and exports ().
Implied by and .dynamicUse GHCi's extended default rules in a normal module.dynamicEnable flexible contexts.
Implied by .dynamicEnable flexible instances.
Implies . Implied by .dynamicEnable foreign function interface.dynamicEnable functional dependencies.
Implies .dynamicEnable generalised algebraic data types.
Implies and .dynamicEnable generalised algebraic data type syntax.
dynamicEnable newtype deriving.dynamicDeprecated, does nothing. No longer enables generic classes.
See also GHC's support for
generic programming.dynamicEnable Implicit Parameters.
Implies and .dynamicDon't implicitly import Prelude.
Implied by .dynamicEnable impredicative types.
Implies .dynamicEnable incoherent instances.
Implies .dynamicEnable instance signatures.dynamicEnable interruptible FFI.dynamicEnable kind signatures.
Implied by and .dynamicEnable lambda-case expressions.dynamicEnable liberalised type synonyms.dynamicAllow "#" as a postfix modifier on identifiers.dynamicEnable monad comprehensions.dynamicEnable do not generalise local bindings.
Implied by and .
dynamicDisable the monomorphism restriction.dynamicEnable multi parameter type classes.
Implied by .dynamicEnable multi-way if-expressions.dynamicEnable record puns.dynamicEnable named wildcards.dynamicEnable support for negative literals.dynamicDisable support for n+k patterns.dynamicDeprecated, does nothing. nullary (no parameter) type classes are now enabled using .dynamicEnable support for 'fractional' integer literals.dynamicEnable overlapping instances.dynamicEnable overloaded lists.
dynamicEnable overloaded string literals.
dynamicEnable package-qualified imports.dynamicEnable parallel arrays.
Implies .dynamicEnable parallel list comprehensions.
Implied by .dynamicEnable partial type signatures.dynamicEnable pattern guards.dynamicEnable pattern synonyms.dynamicEnable kind polymorphism.
Implies .dynamicEnable polymorphic components for data constructors.dynamic, synonym for Enable postfix operators.dynamicEnable quasiquotation.dynamicEnable rank-2 types.dynamic, synonym for Enable rank-N types.
Implied by .dynamicEmploy rebindable syntax.
Implies .dynamicEnable record wildcards.
Implies .dynamicEnable recursive do (mdo) notation.dynamic(deprecated) Relaxed checking for
mutually-recursive polymorphic functions.dynamicEnable role annotations.dynamicEnable the Safe Haskell Safe mode.dynamicEnable lexically-scoped type variables.
dynamicEnable standalone deriving.dynamicEnable Template Haskell.dynamicDisable support for traditional record syntax (as supported by Haskell 98) C {f = x}dynamicEnable generalised list comprehensions.dynamicEnable the Safe Haskell Trustworthy mode.dynamicEnable tuple sections.dynamicEnable type families.
Implies ,
and .dynamicEnable type operators.
Implies .dynamicEnable type synonyms in instance heads.
Implied by .dynamicEnable unboxed tuples.dynamicEnable undecidable instances.dynamicEnable unicode syntax.dynamicEnable unlifted FFI types.dynamicEnable Safe Haskell Unsafe mode.dynamicEnable view patterns.dynamicWarningsFlagDescriptionStatic/DynamicReverseenable normal warningsdynamicdisable all warningsdynamic-enable almost all warnings (details in )dynamicmake warnings fataldynamic-Wwarnmake warnings non-fataldynamic-Werror
Turn type errors into warnings,
deferring the error until runtime. Implies
.
dynamic
Convert typed hole errors
into warnings, deferring the
error until runtime. Implied by
. See also
.
dynamicMake suggestions for mis-spelled names.dynamicwarn about uses of commandline flags that are deprecateddynamicwarn when a constraint appears duplicated in a type signaturedynamicwarn when an entity is exported multiple timesdynamicwarn when a .hi file in the
current directory shadows a librarydynamicwarn about uses of Prelude numeric conversions that are probably
the identity (and hence could be omitted)dynamicwarn when the Prelude is implicitly importeddynamicwarn when a pattern match could faildynamicwarn when a pattern match in a lambda expression or pattern binding could faildynamicwarn when a record update could faildynamic(deprecated) warn when a pattern binding looks lazy but must be strictdynamicwarn when fields of a record are uninitialiseddynamicwarn when an import declaration does not explicitly
list all the names brought into scopedynamicwarn when class methods are undefineddynamicwarn about top-level functions without signaturesdynamicwarn about top-level functions without signatures, only if they are exported. takes precedence over -fwarn-missing-signaturesdynamicwarn about polymorphic local bindings without signaturesdynamicwarn when the Monomorphism Restriction is applieddynamicwarn when names are shadoweddynamicwarn when the module contains orphan instance declarations
or rewrite rulesdynamicwarn about overlapping patternsdynamicwarn if there are tabs in the source filedynamicwarn when defaulting happensdynamicwarn about uses of pragmas that GHC doesn't recognisedynamicwarn if promoted constructors are not ticked dynamicwarn about bindings that are unused.
Alias for ,
and
dynamicwarn about top-level bindings that are unuseddynamicwarn about local bindings that are unuseddynamicwarn about pattern match bindings that are unuseddynamicwarn about unnecessary importsdynamicwarn about variables in patterns that aren't useddynamicwarn about do bindings that appear to throw away values of types other than ()dynamicwarn about do bindings that appear to throw away monadic values that you should have bound insteaddynamicwarn if the module being compiled is regarded to be unsafe.
Should be used to check the safety status of modules when using safe
inference. Works on all module types, even those using explicit
Safe Haskell modes (such as
) and so can be used to have the
compiler check any assumptions made.dynamicwarn if the module being compiled is regarded to be safe.
Should be used to check the safety status of modules when using safe
inference. Works on all module types, even those using explicit
Safe Haskell modes (such as
) and so can be used to have the
compiler check any assumptions made.dynamicwarn if the module being compiled is marked as
but it could instead be marked as
, a more informative bound. Can be used to
detect once a Safe Haskell bound can be improved as dependencies
are updated.dynamicwarn about uses of functions & types that have warnings or deprecated pragmasdynamic(deprecated) warn on definitions conflicting with the Applicative-Monad Proposal (AMP)dynamic
Report warnings when typed hole
errors are deferred until
runtime. See .
dynamic
warn about holes in partial type signatures when
is enabled. Not
applicable when is not
enabled, in which case errors are generated for such holes.
See .
dynamic
warn when encountering a request to derive an instance of
class Typeable. As of GHC 7.10, such
declarations are unnecessary and are ignored by the compiler
because GHC has a custom solver for discharging this type of
constraint.
dynamicOptimisation levelsThese options are described in more detail in FlagDescriptionStatic/DynamicReverseDisable optimisations (default)dynamic or Enable level 1 optimisationsdynamicEnable level 2 optimisationsdynamicEnable level 2 optimisations, set
and .dynamic-See for a list of optimisations enabled on level 1 and level 2.Individual optimisationsThese options are described in more detail in .
If a flag is implied by then it is also implied by
(unless flag description explicitly says otherwise).
If a flag is implied by only then the flag is not
implied by and .
FlagDescriptionStatic/DynamicReverseEnable call-arity optimisation. Implied by .dynamicEnable case-merging. Implied by .dynamicEnable Cmm common block elimination. Implied by .dynamicEnable Cmm sinking. Implied by .dynamicSwitch off CPR analysis in the demand analyser.static-Enable common sub-expression elimination. Implied by .dynamicMake dictionary-valued expressions seem cheap to the optimiser.dynamicMake dictionaries strictdynamicUse a special demand transformer for dictionary selectors.
Always enabled by default.
dynamicEnable eta-reduction. Implied by .dynamicEnable lambda eta-expansion. Always enabled by default.dynamicTurn on eager blackholingdynamic-Switch on all rewrite rules (including rules
generated by automatic specialisation of overloaded functions).
Implied by . dynamicEnable excess intermediate precisiondynamicExpose all unfoldings, even for very large or recursive functions.dynamicTurn on the float-in transformation. Implied by .dynamicTurn on full laziness (floating bindings outwards). Implied by .dynamicAllow worker-wrapper to convert a function closure into a
thunk if the function does not use any of its arguments. Off by
default.dynamicIgnore assertions in the source. Implied by .dynamicIgnore pragmas in interface files. Implied by only.dynamicRun demand analysis again, at the end of the simplification
pipelinedynamicTurn on the liberate-case transformation. Implied by .dynamic-fno-liberate-case=nSet the size threshold for the liberate-case transformation to n (default: 2000)dynamisTurn saturated self-recursive tail-calls into local jumps in the generated assembly.
Implied by .dynamic=nSet the maximum size of inline array allocations to
n bytes (default: 128). GHC
will allocate non-pinned arrays of statically known size
in the current nursery block if they're no bigger than
n bytes, ignoring GC overheap.
This value should be quite a bit smaller than the block
size (typically: 4096).dynamic-
=nInline memcpy calls if they would generate no more
than n pseudo instructions
(default: 32).
dynamic-
=nInline memset calls if they would generate no more
than n pseudo instructions
(default: 32).
dynamic-Set the maximum number of bindings to display in type error messages (default 6).dynamicSet the max iterations for the simplifier (default 4).dynamic-If a worker has that many arguments, none will be
unpacked anymore (default: 10)dynamic-Turn off the coercion optimiserstatic-Turn off pre-inliningdynamic-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-Don't generate interface pragmas. Implied by only.dynamicOmit heap checks when no allocation is being performed.dynamicMake GHC be more precise about its treatment of bottom (but see also
). In particular, GHC will not
eta-expand through a case expression.dynamicUse the graph colouring register allocator for register allocation
in the native code generator. Implied by .dynamicUse the iterative coalescing graph colouring register allocator
in the native code generator.dynamicSet the number of phases for the simplifier (default 2).
Ignored with .dynamic-Set the percentage factor for simplifier ticks (default 100)dynamic-Turn on the SpecConstr transformation. Implied by .dynamic=nSet to n (default: 3) the maximum number of
specialisations that will be created for any one function
by the SpecConstr transformationdynamic=nSet the size threshold for the SpecConstr transformation
to n (default: 2000)dynamicTurn on specialisation of overloaded functions. Implied by .dynamicTurn on the static argument transformation.dynamicTurn on strictness analysis. Implied by .dynamic=nRun an additional strictness analysis before simplifier
phase ndynamic-Flatten strict constructor fields with a
pointer-sized representation. Implied by .dynamicFlatten strict constructor fieldsdynamicTweak unfolding settings. Default: 750dynamic-Tweak unfolding settings. Default: 30dynamic-Tweak unfolding settings. Default: 60dynamic-Tweak unfolding settings. Default: 1.5dynamic-Tweak unfolding settings. Default: 60dynamic-Enable vectorisation avoidance. Always enabled by default.dynamicEnable vectorisation of nested data parallelismdynamicProfiling optionsFlagDescriptionStatic/DynamicReverseTurn on profilingdynamic-Auto-add SCCs to all bindings
not marked INLINEdynamicAuto-add SCCs to all top-level
bindings not marked INLINEdynamicAuto-add SCCs to all exported
bindings not marked INLINEdynamicAuto-add SCCs to all CAFsdynamicDo not collect entry countsdynamicTurn on ticky-ticky profilingdynamic-Program coverage optionsFlagDescriptionStatic/DynamicReverseTurn on Haskell program coverage instrumentationdynamicDirectory to deposit .mix files during compilation (default is .hpc)dynamicHaskell pre-processor optionsFlagDescriptionStatic/DynamicReverse
Enable the use of a pre-processor
(set with )
dynamic-C pre-processor optionsFlagDescriptionStatic/DynamicReverseRun the C pre-processor on Haskell source filesdynamic-symbol=valueDefine a symbol in the C pre-processordynamicsymbolsymbolUndefine a symbol in the C pre-processordynamic-dirAdd dir to the
directory search list for #include filesdynamic-Code generation optionsFlagDescriptionStatic/DynamicReverseUse the native code
generatordynamic-fllvmCompile using the LLVM code
generatordynamic-fasmOmit code generationdynamic-Always write interface filesdynamic-Generate byte-codedynamic-Generate object codedynamic-Linking optionsFlagDescriptionStatic/DynamicReverseGenerate a shared library (as opposed to an executable)dynamic-On Darwin/OS X/iOS only, generate a standalone static library
(as opposed to an executable).
This is the usual way to compile for iOS.
dynamic-Generate position-independent code (where available)dynamic-Use dynamic Haskell libraries (if available)dynamic-Build dynamic object files as well as static object files during compilationdynamic-Set the output path for the dynamically linked objectsdynamic-Set the output suffix for dynamic object filesdynamic-Selects one of a number of modes for finding shared
libraries at runtime.dynamic-nameOn Darwin/OS X/iOS only, link in the framework name.
This option corresponds to the option for Apple's Linker.dynamic-nameOn Darwin/OS X/iOS only, add dir to the list of
directories searched for frameworks.
This option corresponds to the option for Apple's Linker.dynamic-libLink in library libdynamic-dirAdd dir to the list of
directories searched for librariesdynamic-Set main module and functiondynamic-DLL-creation mode (Windows only)dynamic-Don't assume this program contains maindynamic-, 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-Set the default RTS options to
opts.dynamic-Don't print RTS suggestions about linking with
-rtsopts.
dynamic-Omit linkingdynamic-Split objects (for libraries)dynamic-Use static Haskell librariesdynamic-Use the threaded runtimedynamic-Use the debugging runtimedynamic-For linking, this simply implies ;
see .dynamic-Enable runtime event tracingdynamic-Do not generate a manifest file (Windows only)dynamic-Do not embed the manifest in the executable (Windows only)dynamic-Don't generate an import library for a DLL (Windows only)dynamic-pathSet 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-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-Plugin optionsFlagDescriptionStatic/DynamicReverse=moduleLoad a plugin exported by a given moduledynamic-=module:argsGive arguments to a plugin module; module must be specified with dynamic-Replacing phasesFlagDescriptionStatic/DynamicReversecmdUse cmd as the literate pre-processordynamic-cmdUse cmd as the C
pre-processor (with only)dynamic-cmdUse cmd as the C compilerdynamic-cmdUse cmd as the LLVM optimiserdynamic-cmdUse cmd as the LLVM compilerdynamic-cmdUse cmd as the splitterdynamic-cmdUse cmd as the assemblerdynamic-cmdUse cmd as the linkerdynamic-cmdUse cmd as the DLL generatordynamic-cmdUse cmd as the pre-processor
(with only)dynamic-cmdUse cmd as the program for
embedding manifests on Windows.dynamic-cmdUse cmd as the command for libtool
(with only).dynamic-Forcing options to particular phasesFlagDescriptionStatic/DynamicReverseoptionpass option to the literate pre-processordynamic-optionpass option to cpp (with
only)dynamic-optionpass option to the
custom pre-processordynamic-optionpass option to the C compilerdynamic-optionpass option to the LLVM optimiserdynamic-optionpass option to the LLVM compilerdynamic-optionpass option to the assemblerdynamic-optionpass option to the linkerdynamic-optionpass option to the DLL generatordynamic-optionpass option to windres.dynamic-Platform-specific optionsFlagDescriptionStatic/DynamicReverse(x86 only) Use SSE2 for floating pointdynamic-Compiler debugging optionsFlagDescriptionStatic/DynamicReverseTurn on internal sanity checkingdynamic-Dump to files instead of stdoutdynamic-Dump assemblydynamic-Dump interpreter byte codedynamic-Dump C-- outputdynamic-Print a one-line summary of the size of the Core program
at the end of the optimisation pipeline dynamic-Dump CSE outputdynamic-Dump deriving outputdynamic-Dump desugarer outputdynamic-Dump foreign export stubsdynamic-Dump after instrumentation for program coveragedynamic-Dump inlining infodynamic-Dump LLVM intermediate codedynamic-Dump occurrence analysis outputdynamic-Dump the results of C-- to C-- optimising passesdynamic-Dump parse treedynamic-Dump prepared coredynamic-Dump renamer outputdynamic-Dump rule firing infodynamic-Dump detailed rule firing infodynamic-Dump rulesdynamic-Dump vectoriser input and outputdynamic-Dump final simplifier outputdynamic-Dump output from each simplifier iterationdynamic-Dump specialiser outputdynamic-Dump TH spliced expressions, and what they evaluate todynamic-Dump final STGdynamic-Dump strictness analyser outputdynamic-Dump strictness signaturesdynamic-Dump typechecker outputdynamic-Show evaluated TH declarations in a .th.hs filedynamic-Dump type signaturesdynamic-Dump worker-wrapper outputdynamic-Trace interface filesdynamic-Trace typecheckerdynamic-Trace vectoriserdynamic-Trace renamerdynamic-Renamer statsdynamic-Dump simplifier statsdynamic-Suppress unsolicited debugging outputstatic-Turn on debug printing (more verbose)static-Set the depth for printing expressions in error msgsdynamic-Set the width of debugging output. For example dynamic-Print single alternative case expressions as strict lets.dynamic-In core dumps, suppress everything (except for uniques) that is suppressible.dynamic-Suppress the printing of uniques in debug output (easier to use diff)dynamic-Suppress extended information about identifiers where they are bounddynamic-Suppress the printing of module qualification prefixesdynamic-Suppress type signaturesdynamic-Suppress type applicationsdynamic-Suppress the printing of coercions in Core dumps to make them shorterdynamic-Dump haskell source statsdynamic-C-- pass sanity checkingdynamic-STG pass sanity checkingdynamic-Dump STG statsdynamic-Show output from each core-to-core passdynamic-Show output from each STG-to-STG passdynamic-Print out each pass name as it happensdynamic-Show statistics for fast string usage when finisheddynamic-Report sites with rules that could have fired but didn't.
Takes a string argument.dynamic-Misc compiler optionsFlagDescriptionStatic/DynamicReverseWhen compiling with --make, compile N modules in parallel.dynamic-Don't complain about .hi file mismatchesdynamic-Set simplification history sizedynamic-Do not use the load/store the GHCi command history from/to ghci_history.dynamic-Turn off the GHCi sandbox. Means computations are run in the main thread, rather than a forked thread.dynamic-