4.20. Flag reference

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

4.20.1. Verbosity options

More details in Section 4.6, “Verbosity options”

-vverbose mode (equivalent to -v3)dynamic-
-vnset verbosity leveldynamic-
-fprint-explicit-forallsprint explicit forall quantification in typesdynamic-fno-print-explicit-foralls
-fprint-explicit-kindsprint explicit kind foralls and kind arguments in typesdynamic-fno-print-explicit-kinds
-ferror-spansoutput full span in error messagesdynamic-
-HsizeSet the minimum heap size to sizestatic-
-Rghc-timingSummarise timing stats for GHC (same as +RTS -tstderr)static-

4.20.2. Alternative modes of operation

More details in Section 4.5, “Modes of operation”

--help,-?Disply helpmode-
--interactiveInteractive mode - normally used by just running ghci; see Chapter 2, Using GHCi for details.mode-
--makeBuild a multi-module Haskell program, automatically figuring out dependencies. Likely to be much easier, and faster, than using make; see Section 4.5.1, “Using ghc --make for details..mode-
-e exprEvaluate expr; see Section 4.5.2, “Expression evaluation mode” for details.mode-
--show-ifaceDisplay the contents of an interface file.mode-
-MGenerate dependency information suitable for use in a Makefile; see Section 4.7.11, “Dependency generation” for details.mode-
--supported-extensions, --supported-languagesdisplay the supported language extensionsmode-
--show-optionsdisplay the supported command line optionsmode-
--infodisplay information about the compilermode-
--version, -Vdisplay GHC versionmode-
--numeric-versiondisplay GHC version (numeric only)mode-
--print-libdirdisplay GHC library directorymode-

4.20.3. Which phases to run

Section 4.5.3, “Batch compiler mode”

-EStop after preprocessing (.hspp file)mode-
-CStop after generating C (.hc file)mode-
-SStop after generating assembly (.s file)mode-
-cDo not linkdynamic-
-x suffixOverride default behaviour for source filesstatic-

4.20.4. Redirecting output

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

-hcsuf suffixset the suffix to use for intermediate C filesdynamic-
-hidir dirset directory for interface filesdynamic-
-hisuf suffixset the suffix to use for interface filesdynamic-
-o filenameset output filenamedynamic-
-odir dirset directory for object filesdynamic-
-ohi filenameset the filename in which to put the interfacedynamic 
-osuf suffixset the output file suffixdynamic-
-stubdir dirredirect FFI stub filesdynamic-
-dumpdir dirredirect dump filesdynamic-
-outputdir dirset output directorydynamic-

4.20.5. Keeping intermediate files

Section 4.7.5, “Keeping Intermediate Files”

-keep-hc-file or -keep-hc-filesretain intermediate .hc filesdynamic-
-keep-llvm-file or -keep-llvm-filesretain intermediate LLVM .ll filesdynamic-
-keep-s-file or -keep-s-filesretain intermediate .s filesdynamic-
-keep-tmp-filesretain all intermediate temporary filesdynamic-

4.20.6. Temporary files

Section 4.7.6, “Redirecting temporary files”

-tmpdirset the directory for temporary filesdynamic-

4.20.7. Finding imports

Section 4.7.3, “The search path”

-idir1:dir2:...add dir, dir2, etc. to import pathstatic/:set-
-iEmpty the import directory liststatic/:set-

4.20.8. Interface file options

Section 4.7.7, “Other options related to interface files”

-ddump-hiDump the new interface to stdoutdynamic-
-ddump-hi-diffsShow the differences vs. the old interfacedynamic-
-ddump-minimal-importsDump a minimal set of importsdynamic-
--show-iface fileSee Section 4.5, “Modes of operation”.  

4.20.9. Recompilation checking

Section 4.7.8, “The recompilation checker”

-fforce-recompTurn 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

4.20.10. Interactive-mode options

Section 2.9, “The .ghci file”

-ignore-dot-ghciDisable reading of .ghci filesdynamic-
-ghci-scriptRead additional .ghci filesdynamic-
-fbreak-on-exceptionBreak on any exception throwndynamic-fno-break-on-exception
-fbreak-on-errorBreak on uncaught exceptions and errorsdynamic-fno-break-on-error
-fghci-hist-size=nSet the number of entries GHCi keeps for :historydynamic(default is 50)
-fprint-evld-with-showEnable usage of Show instances in :printdynamic-fno-print-evld-with-show
-fprint-bind-resultTurn on printing of binding results in GHCidynamic-fno-print-bind-result
-fno-print-bind-contentsTurn off printing of binding contents in GHCidynamic-
-fno-implicit-import-qualifiedTurn off implicit qualified import of everything in GHCidynamic-
-interactive-printSelect the function to use for printing evaluated expressions in GHCidynamic-

4.20.11. Packages

Section 4.9, “ Packages ”

-package-name PCompile to be part of package Pstatic-
-package PExpose package Pstatic/:set-
-hide-all-packagesHide all packages by defaultstatic-
-hide-package nameHide package Pstatic/:set-
-ignore-package nameIgnore package Pstatic/:set-
-package-db fileAdd file to the package db stack.static-
-clear-package-dbClear the package db stack.static-
-no-global-package-dbRemove the global package db from the stack.static-
-global-package-dbAdd the global package db to the stack.static-
-no-user-package-dbRemove the user's package db from the stack.static-
-user-package-dbAdd the user's package db to the stack.static-
-no-auto-link-packagesDon't automatically link in the base and rts packages.dynamic-
-trust PExpose package P and set it to be trustedstatic/:set-
-distrust PExpose package P and set it to be distrustedstatic/:set-
-distrust-all Distrust all packages by defaultstatic/:set-

4.20.12. Language options

Language options can be enabled either by a command-line option -Xblah, or by a {-# LANGUAGE blah #-} pragma in the file itself. See Section 7.1, “Language options”

-fglasgow-extsDeprecated. Enable most language extensions; see Section 7.1, “Language options” for exactly which ones.dynamic-fno-glasgow-exts
-firrefutable-tuplesMake tuple pattern matching irrefutabledynamic-fno-irrefutable-tuples
-fcontext-stack=Nnset the limit for context reduction. Default is 20.dynamic 
-ftype-function-depth=Nnset the limit for type function reductions. Default is 200.dynamic 
-XAllowAmbiguousTypesAllow the user to write ambiguous types, and the type inference engine to infer them. dynamic-XNoAllowAmbiguousTypes
-XArrowsEnable arrow notation extensiondynamic-XNoArrows
-XAutoDeriveTypeableAutomatically derive Typeable instances for every datatype and type class declaration. Implies -XDeriveDataTypeable.dynamic-XNoAutoDeriveTypeable
-XConstraintKindsEnable a kind of constraints.dynamic-XNoConstraintKinds
-XDataKindsEnable datatype promotion.dynamic-XNoDataKinds
-XDeriveDataTypeableEnable deriving for the Data and Typeable classes.dynamic-XNoDeriveDataTypeable
-XDeriveGenericEnable deriving for the Generic class.dynamic-XNoDeriveGeneric
-XGeneralizedNewtypeDerivingEnable newtype deriving.dynamic-XNoGeneralizedNewtypeDeriving
-XDisambiguateRecordFieldsEnable record field disambiguationdynamic-XNoDisambiguateRecordFields
-XEmptyCaseAllow empty case alternatives dynamic-XNoEmptyCase
-XExtendedDefaultRulesUse GHCi's extended default rules in a normal moduledynamic-XNoExtendedDefaultRules
-XForeignFunctionInterfaceEnable foreign function interface.dynamic-XNoForeignFunctionInterface
-XGADTsEnable generalised algebraic data types. dynamic-XNoGADTs
-XGADTSyntaxEnable generalised algebraic data type syntax. dynamic-XNoGADTSyntax
-XGenericsDeprecated, does nothing. No longer enables generic classes. See also GHC's support for generic programming.dynamic-XNoGenerics
-XImplicitParamsEnable Implicit Parameters.dynamic-XNoImplicitParams
-XNoImplicitPreludeDon't implicitly import Preludedynamic-XImplicitPrelude
-XIncoherentInstancesEnable incoherent instances. Implies -XOverlappingInstances dynamic-XNoIncoherentInstances
-XNoMonomorphismRestrictionDisable the monomorphism restrictiondynamic-XMonomorphismRrestriction
-XNegativeLiteralsEnable support for negative literalsdynamic-XNoNegativeLiterals
-XNoNPlusKPatternsDisable support for n+k patternsdynamic-XNPlusKPatterns
-XNumDecimalsEnable support for 'fractional' integer literalsdynamic-XNoNumDecimals
-XOverlappingInstancesEnable overlapping instancesdynamic-XNoOverlappingInstances
-XOverloadedListsEnable overloaded lists. dynamic-XNoOverloadedLists
-XOverloadedStringsEnable overloaded string literals. dynamic-XNoOverloadedStrings
-XQuasiQuotesEnable quasiquotation.dynamic-XNoQuasiQuotes
-XRelaxedPolyRecRelaxed checking for mutually-recursive polymorphic functionsdynamic-XNoRelaxedPolyRec
-XNoTraditionalRecordSyntaxDisable support for traditional record syntax (as supported by Haskell 98) C {f = x}dynamic-XTraditionalRecordSyntax
-XTypeFamiliesEnable type families.dynamic-XNoTypeFamilies
-XUndecidableInstancesEnable undecidable instancesdynamic-XNoUndecidableInstances
-XPolyKindsEnable kind polymorphism. Implies -XKindSignatures.dynamic-XNoPolyKinds
-XMonoLocalBindsEnable do not generalise local bindings. Implied by -XTypeFamilies and -XGADTs. dynamic-XNoMonoLocalBinds
-XRebindableSyntaxEmploy rebindable syntaxdynamic-XNoRebindableSyntax
-XScopedTypeVariablesEnable lexically-scoped type variables. dynamic-XNoScopedTypeVariables
-XTemplateHaskellEnable Template Haskell.dynamic-XNoTemplateHaskell
-XBangPatternsEnable bang patterns.dynamic-XNoBangPatterns
-XCPPEnable the C preprocessor.dynamic-XNoCPP
-XPatternGuardsEnable pattern guards.dynamic-XNoPatternGuards
-XViewPatternsEnable view patterns.dynamic-XNoViewPatterns
-XUnicodeSyntaxEnable unicode syntax.dynamic-XNoUnicodeSyntax
-XMagicHashAllow "#" as a postfix modifier on identifiers.dynamic-XNoMagicHash
-XExplicitForAllEnable explicit universal quantification. Implied by -XScopedTypeVariables, -XLiberalTypeSynonyms, -XRankNTypes, -XExistentialQuantification dynamic-XNoExplicitForAll
-XPolymorphicComponentsEnable polymorphic components for data constructors.dynamic, synonym for -XRankNTypes-XNoPolymorphicComponents
-XRank2TypesEnable rank-2 types.dynamic, synonym for -XRankNTypes-XNoRank2Types
-XRankNTypesEnable rank-N types.dynamic-XNoRankNTypes
-XImpredicativeTypesEnable impredicative types.dynamic-XNoImpredicativeTypes
-XExistentialQuantificationEnable existential quantification.dynamic-XNoExistentialQuantification
-XKindSignaturesEnable kind signatures.dynamic-XNoKindSignatures
-XEmptyDataDeclsEnable empty data declarations.dynamic-XNoEmptyDataDecls
-XParallelListCompEnable parallel list comprehensions.dynamic-XNoParallelListComp
-XTransformListCompEnable generalised list comprehensions.dynamic-XNoTransformListComp
-XMonadComprehensionsEnable monad comprehensions.dynamic-XNoMonadComprehensions
-XUnliftedFFITypesEnable unlifted FFI types.dynamic-XNoUnliftedFFITypes
-XInterruptibleFFIEnable interruptible FFI.dynamic-XNoInterruptibleFFI
-XLiberalTypeSynonymsEnable liberalised type synonyms.dynamic-XNoLiberalTypeSynonyms
-XTypeOperatorsEnable type operators.dynamic-XNoTypeOperators
-XExplicitNamespacesEnable using the keyword type to specify the namespace of entries in imports and exports (Section 7.3.27, “Explicit namespaces in import/export”). Implied by -XTypeOperators and -XTypeFamilies.dynamic-XNoExplicitNamespaces
-XRecursiveDoEnable recursive do (mdo) notation.dynamic-XNoRecursiveDo
-XParallelArraysEnable parallel arrays.dynamic-XNoParallelArrays
-XRecordWildCardsEnable record wildcards.dynamic-XNoRecordWildCards
-XNamedFieldPunsEnable record puns.dynamic-XNoNamedFieldPuns
-XDisambiguateRecordFieldsEnable record field disambiguation. dynamic-XNoDisambiguateRecordFields
-XUnboxedTuplesEnable unboxed tuples.dynamic-XNoUnboxedTuples
-XStandaloneDerivingEnable standalone deriving.dynamic-XNoStandaloneDeriving
-XTypeSynonymInstancesEnable type synonyms in instance heads.dynamic-XNoTypeSynonymInstances
-XFlexibleContextsEnable flexible contexts.dynamic-XNoFlexibleContexts
-XFlexibleInstancesEnable flexible instances. Implies -XTypeSynonymInstances dynamic-XNoFlexibleInstances
-XConstrainedClassMethodsEnable constrained class methods.dynamic-XNoConstrainedClassMethods
-XDefaultSignaturesEnable default signatures.dynamic-XNoDefaultSignatures
-XMultiParamTypeClassesEnable multi parameter type classes.dynamic-XNoMultiParamTypeClasses
-XNullaryTypeClassesEnable nullary (no parameter) type classes.dynamic-XNoNullaryTypeClasses
-XFunctionalDependenciesEnable functional dependencies.dynamic-XNoFunctionalDependencies
-XPackageImportsEnable package-qualified imports.dynamic-XNoPackageImports
-XLambdaCaseEnable lambda-case expressions.dynamic-XNoLambdaCase
-XMultiWayIfEnable multi-way if-expressions.dynamic-XNoMultiWayIf
-XSafeEnable the Safe Haskell Safe mode.dynamic-
-XTrustworthyEnable the Safe Haskell Trustworthy mode.dynamic-
-XUnsafeEnable Safe Haskell Unsafe mode.dynamic-
-fpackage-trustEnable Safe Haskell trusted package requirement for trustworthy modules.dynamic-

4.20.13. Warnings

Section 4.8, “Warnings and sanity-checking”

-Wenable normal warningsdynamic-w
-wdisable all warningsdynamic-
-Wallenable almost all warnings (details in Section 4.8, “Warnings and sanity-checking”)dynamic-w
-Werrormake warnings fataldynamic-Wwarn
-Wwarnmake warnings non-fataldynamic-Werror
-fdefer-type-errorsDefer as many type errors as possible until runtime.dynamic-fno-defer-type-errors
-fhelpful-errorsMake suggestions for mis-spelled names.dynamic-fno-helpful-errors
-fwarn-deprecated-flagswarn about uses of commandline flags that are deprecateddynamic-fno-warn-deprecated-flags
-fwarn-duplicate-constraintswarn when a constraint appears duplicated in a type signaturedynamic-fno-warn-duplicate-constraints
-fwarn-duplicate-exportswarn when an entity is exported multiple timesdynamic-fno-warn-duplicate-exports
-fwarn-hi-shadowingwarn when a .hi file in the current directory shadows a librarydynamic-fno-warn-hi-shadowing
-fwarn-identitieswarn about uses of Prelude numeric conversions that are probably the identity (and hence could be omitted)dynamic-fno-warn-identities
-fwarn-implicit-preludewarn when the Prelude is implicitly importeddynamic-fno-warn-implicit-prelude
-fwarn-incomplete-patternswarn when a pattern match could faildynamic-fno-warn-incomplete-patterns
-fwarn-incomplete-uni-patternswarn when a pattern match in a lambda expression or pattern binding could faildynamic-fno-warn-incomplete-uni-patterns
-fwarn-incomplete-record-updateswarn when a record update could faildynamic-fno-warn-incomplete-record-updates
-fwarn-lazy-unlifted-bindings(deprecated) warn when a pattern binding looks lazy but must be strictdynamic-fno-warn-lazy-unlifted-bindings
-fwarn-missing-fieldswarn when fields of a record are uninitialiseddynamic-fno-warn-missing-fields
-fwarn-missing-import-listswarn when an import declaration does not explicitly list all the names brought into scopedynamic-fnowarn-missing-import-lists
-fwarn-missing-methodswarn when class methods are undefineddynamic-fno-warn-missing-methods
-fwarn-missing-signatureswarn about top-level functions without signaturesdynamic-fno-warn-missing-signatures
-fwarn-missing-local-sigswarn about polymorphic local bindings without signaturesdynamic-fno-warn-missing-local-sigs
-fwarn-monomorphism-restrictionwarn when the Monomorphism Restriction is applieddynamic-fno-warn-monomorphism-restriction
-fwarn-name-shadowingwarn when names are shadoweddynamic-fno-warn-name-shadowing
-fwarn-orphans, -fwarn-auto-orphanswarn when the module contains orphan instance declarations or rewrite rulesdynamic-fno-warn-orphans, -fno-warn-auto-orphans
-fwarn-overlapping-patternswarn about overlapping patternsdynamic-fno-warn-overlapping-patterns
-fwarn-tabswarn if there are tabs in the source filedynamic-fno-warn-tabs
-fwarn-type-defaultswarn when defaulting happensdynamic-fno-warn-type-defaults
-fwarn-unrecognised-pragmaswarn about uses of pragmas that GHC doesn't recognisedynamic-fno-warn-unrecognised-pragmas
-fwarn-unused-bindswarn about bindings that are unuseddynamic-fno-warn-unused-binds
-fwarn-unused-importswarn about unnecessary importsdynamic-fno-warn-unused-imports
-fwarn-unused-matcheswarn about variables in patterns that aren't useddynamic-fno-warn-unused-matches
-fwarn-unused-do-bindwarn about do bindings that appear to throw away values of types other than ()dynamic-fno-warn-unused-do-bind
-fwarn-wrong-do-bindwarn about do bindings that appear to throw away monadic values that you should have bound insteaddynamic-fno-warn-wrong-do-bind
-fwarn-unsafewarn if the module being compiled is regarded to be unsafe. Should be used to check the safety status of modules when using safe inference.dynamic-fno-warn-unsafe
-fwarn-safewarn if the module being compiled is regarded to be safe. Should be used to check the safety status of modules when using safe inference.dynamic-fno-warn-safe
-fwarn-warnings-deprecationswarn about uses of functions & types that have warnings or deprecated pragmasdynamic-fno-warn-warnings-deprecations
-fwarn-ampwarn on definitions conflicting with the Applicative-Monad Proposal (AMP)dynamic-fno-warn-amp
-fwarn-typed-holesEnable holes in expressions.dynamic-fno-warn-typed-holes

4.20.14. Optimisation levels

These options are described in more detail in Section 4.10, “Optimisation (code improvement)”

-OEnable default optimisation (level 1)dynamic-O0
-OnSet optimisation level ndynamic-O0

4.20.15. Individual optimisations

These options are described in more detail in Section 4.10.2, “-f*: platform-independent flags”.

-fcase-mergeEnable case-merging. Implied by -O.dynamic-fno-case-merge
-fcseTurn on common sub-expression elimination. Implied by -O.dynamic-fno-cse
-fdicts-strictMake dictionaries strictstatic-fno-dicts-strict
-fdo-eta-reductionEnable eta-reduction. Implied by -O.dynamic-fno-do-eta-reduction
-fdo-lambda-eta-expansionEnable lambda eta-reductiondynamic-fno-do-lambda-eta-expansion
-feager-blackholingTurn on eager blackholingdynamic-
-fenable-rewrite-rulesSwitch on all rewrite rules (including rules generated by automatic specialisation of overloaded functions). Implied by -O. dynamic-fno-enable-rewrite-rules
-fvectoriseEnable vectorisation of nested data parallelismdynamic-fno-vectorise
-favoid-vectEnable vectorisation avoidance (EXPERIMENTAL)dynamic-fno-avoid-vect
-fexcess-precisionEnable excess intermediate precisiondynamic-fno-excess-precision
-ffloat-inTurn on the float-in transformation. Implied by -O.dynamic-fno-float-in
-ffull-lazinessTurn on full laziness (floating bindings outwards). Implied by -O.dynamic-fno-full-laziness
-ffun-to-thunkAllow worker-wrapper to convert a function closure into a thunk if the function does not use any of its arguments. Off by default.dynamic-fno-fun-to-thunk
-fignore-assertsIgnore assertions in the sourcedynamic-fno-ignore-asserts
-fignore-interface-pragmasIgnore pragmas in interface filesdynamic-fno-ignore-interface-pragmas
-floopificationTurn saturated self-recursive tail-calls into local jumps in the generated assembly.dynamic-fno-loopification
-flate-dmd-analRun demand analysis again, at the end of the simplification pipelinedynamic-fno-late-dmd-anal
-fliberate-caseTurn on the liberate-case transformation. Implied by -O2.dynamic-fno-liberate-case
-fliberate-case-threshold=nSet the size threshold for the liberate-case transformation to n (default: 200)static-fno-liberate-case-threshold
-fmax-relevant-bindings=NSet the maximum number of bindings to display in type error messages (default 6).dynamic-fno-max-relevant-bindings
-fmax-simplifier-iterations=NSet the max iterations for the simplifierdynamic-
-fmax-worker-args=NIf a worker has that many arguments, none will be unpacked anymore (default: 10)dynamic-
-fno-opt-coercionTurn off the coercion optimiserstatic-
-fno-pre-inliningTurn off pre-inliningdynamic-
-fno-state-hackTurn 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-
-fpedantic-bottomsMake 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
-fomit-interface-pragmasDon't generate interface pragmasdynamic-fno-omit-interface-pragmas
-fsimplifier-phasesSet the number of phases for the simplifier (default 2). Ignored with -O0.dynamic-
-fsimpl-tick-factor=nSet the percentage factor for simplifier ticks (default 100)dynamic-
-fspec-constrTurn on the SpecConstr transformation. Implied by -O2.dynamic-fno-spec-constr
-fspec-constr-threshold=nSet the size threshold for the SpecConstr transformation to n (default: 200)static-fno-spec-constr-threshold
-fspec-constr-count=nSet to n (default: 3) the maximum number of specialisations that will be created for any one function by the SpecConstr transformationstatic-fno-spec-constr-count
-fspecialiseTurn on specialisation of overloaded functions. Implied by -O.dynamic-fno-specialise
-fstrictnessTurn on strictness analysis. Implied by -O.dynamic-fno-strictness
-fstrictness=before=nRun an additional strictness analysis before simplifier phase ndynamic-
-fstatic-argument-transformationTurn on the static argument transformation. Implied by -O2.dynamic-fno-static-argument-transformation
-funbox-strict-fieldsFlatten strict constructor fieldsdynamic-fno-unbox-strict-fields
-funbox-small-strict-fieldsFlatten strict constructor fields with a pointer-sized representationdynamic-fno-unbox-small-strict-fields
-funfolding-creation-thresholdTweak unfolding settingsdynamic-fno-unfolding-creation-threshold
-funfolding-fun-discountTweak unfolding settingsdynamic-fno-unfolding-fun-discount
-funfolding-keeness-factorTweak unfolding settingsdynamic-fno-unfolding-keeness-factor
-funfolding-use-thresholdTweak unfolding settingsdynamic-fno-unfolding-use-threshold

4.20.16. Profiling options

Chapter 5, Profiling

-profTurn on profilingstatic-
-fprof-autoAuto-add SCCs to all bindings not marked INLINEdynamic-fno-prof-auto
-fprof-auto-topAuto-add SCCs to all top-level bindings not marked INLINEdynamic-fno-prof-auto
-fprof-auto-exportedAuto-add SCCs to all exported bindings not marked INLINEdynamic-fno-prof-auto
-fprof-cafsAuto-add SCCs to all CAFsdynamic-fno-prof-cafs
-fno-prof-count-entriesDo not collect entry countsdynamic-fprof-count-entries
-tickyTurn on ticky-ticky profilingstatic-

4.20.17. Program coverage options

Section 5.7, “Observing Code Coverage”

-fhpcTurn on Haskell program coverage instrumentationdynamic-
-hpcdir dirDirectory to deposit .mix files during compilation (default is .hpc)dynamic-

4.20.18. Haskell pre-processor options

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

-F Enable the use of a pre-processor (set with -pgmF) dynamic-

4.20.19. C pre-processor options

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

-cppRun the C pre-processor on Haskell source filesdynamic-
-Dsymbol[=value]Define a symbol in the C pre-processordynamic-Usymbol
-UsymbolUndefine a symbol in the C pre-processordynamic-
-IdirAdd dir to the directory search list for #include filesdynamic-

4.20.20. Code generation options

Section 4.12.5, “Options affecting code generation”

-fasmUse the native code generatordynamic-fllvm
-fllvmCompile using the LLVM code generatordynamic-fasm
-fno-codeOmit code generationdynamic-
-fbyte-codeGenerate byte-codedynamic-
-fobject-codeGenerate object codedynamic-

4.20.21. Linking options

Section 4.12.6, “Options affecting linking”

-sharedGenerate a shared library (as opposed to an executable)dynamic-
-staticlibOn 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-
-fPICGenerate position-independent code (where available)dynamic-
-dynamicUse dynamic Haskell libraries (if available)static-
-dynamic-tooBuild dynamic object files as well as static object files during compilationstatic-
-dynoSet the output path for the dynamically linked objectsstatic-
-dynosufSet the output suffix for dynamic object filesstatic-
-dynloadSelects one of a number of modes for finding shared libraries at runtime.static-
-framework nameOn Darwin/OS X/iOS only, link in the framework name. This option corresponds to the -framework option for Apple's Linker.dynamic-
-framework-path nameOn 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-
-llibLink in library libdynamic-
-LdirAdd dir to the list of directories searched for librariesdynamic-
-main-isSet main module and functiondynamic-
--mk-dllDLL-creation mode (Windows only)dynamic-
-no-hs-mainDon't assume this program contains maindynamic-
-rtsopts, -rtsopts={none,some,all}Control whether the RTS behaviour can be tweaked via command-line flags and the GHCRTS environment variable. Using none means no RTS flags can be given; some means only a minimum of safe options can be given (the default), and all (or no argument at all) means that all RTS flags are permitted.dynamic-
-with-rtsopts=optsSet the default RTS options to opts.dynamic-
-no-linkOmit linkingdynamic-
-split-objsSplit objects (for libraries)dynamic-
-staticUse static Haskell librariesstatic-
-threadedUse the threaded runtimestatic-
-debugUse the debugging runtimestatic-
-eventlogEnable runtime event tracingstatic-
-fno-gen-manifestDo not generate a manifest file (Windows only)dynamic-
-fno-embed-manifestDo not embed the manifest in the executable (Windows only)dynamic-
-fno-shared-implibDon't generate an import library for a DLL (Windows only)dynamic-
-dylib-install-name 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-

4.20.22. Plugin options

Section 9.3, “Compiler Plugins”

-fplugin=moduleLoad a plugin exported by a given modulestatic-
-fplugin-opt=module:argsGive arguments to a plugin module; module must be specified with -fpluginstatic-

4.20.23. Replacing phases

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

-pgmL cmdUse cmd as the literate pre-processordynamic-
-pgmP cmdUse cmd as the C pre-processor (with -cpp only)dynamic-
-pgmc cmdUse cmd as the C compilerdynamic-
-pgms cmdUse cmd as the splitterdynamic-
-pgma cmdUse cmd as the assemblerdynamic-
-pgml cmdUse cmd as the linkerdynamic-
-pgmdll cmdUse cmd as the DLL generatordynamic-
-pgmF cmdUse cmd as the pre-processor (with -F only)dynamic-
-pgmwindres cmdUse cmd as the program for embedding manifests on Windows.dynamic-
-pgmlibtool cmdUse cmd as the command for libtool (with -staticlib only).dynamic-

4.20.24. Forcing options to particular phases

Section 4.12.2, “Forcing options to a particular phase”

-optL optionpass option to the literate pre-processordynamic-
-optP optionpass option to cpp (with -cpp only)dynamic-
-optF optionpass option to the custom pre-processordynamic-
-optc optionpass option to the C compilerdynamic-
-optlo optionpass option to the LLVM optimiserdynamic-
-optlc optionpass option to the LLVM compilerdynamic-
-optm optionpass option to the manglerdynamic-
-opta optionpass option to the assemblerdynamic-
-optl optionpass option to the linkerdynamic-
-optdll optionpass option to the DLL generatordynamic-
-optwindres optionpass option to windres.dynamic-

4.20.25. Platform-specific options

Section 4.16, “Platform-specific Flags”

-msse2(x86 only) Use SSE2 for floating pointdynamic-
-monly-[432]-regs(x86 only) give some registers back to the C compilerdynamic-

4.20.26. External core file options

Section 4.18, “Generating and compiling External Core Files”

-fext-coreGenerate .hcr external Core filesdynamic-

4.20.27. Compiler debugging options

Section 4.19, “Debugging the compiler”

-dcore-lintTurn on internal sanity checkingdynamic-
-ddump-to-fileDump to files instead of stdoutdynamic-
-ddump-asmDump assemblydynamic-
-ddump-bcosDump interpreter byte codedynamic-
-ddump-cmmDump C-- outputdynamic-
-ddump-core-statsPrint a one-line summary of the size of the Core program at the end of the optimisation pipeline dynamic-
-ddump-cpranalDump output from CPR analysisdynamic-
-ddump-cseDump CSE outputdynamic-
-ddump-derivDump deriving outputdynamic-
-ddump-dsDump desugarer outputdynamic-
-ddump-flatCDump “flat” Cdynamic-
-ddump-foreignDump foreign export stubsdynamic-
-ddump-hpcDump after instrumentation for program coveragedynamic-
-ddump-inliningsDump inlining infodynamic-
-ddump-llvmDump LLVM intermediate codedynamic-
-ddump-occur-analDump occurrence analysis outputdynamic-
-ddump-opt-cmmDump the results of C-- to C-- optimising passesdynamic-
-ddump-parsedDump parse treedynamic-
-ddump-prepDump prepared coredynamic-
-ddump-rnDump renamer outputdynamic-
-ddump-rule-firingsDump rule firing infodynamic-
-ddump-rule-rewritesDump detailed rule firing infodynamic-
-ddump-rulesDump rulesdynamic-
-ddump-vectDump vectoriser input and outputdynamic-
-ddump-simplDump final simplifier outputdynamic-
-ddump-simpl-phasesDump output from each simplifier phasedynamic-
-ddump-simpl-iterationsDump output from each simplifier iterationdynamic-
-ddump-specDump specialiser outputdynamic-
-ddump-splicesDump TH spliced expressions, and what they evaluate todynamic-
-ddump-stgDump final STGdynamic-
-ddump-stranalDump strictness analyser outputdynamic-
-ddump-strsigsDump strictness signaturesdynamic-
-ddump-tcDump typechecker outputdynamic-
-ddump-typesDump type signaturesdynamic-
-ddump-worker-wrapperDump worker-wrapper outputdynamic-
-ddump-if-traceTrace interface filesdynamic-
-ddump-tc-traceTrace typecheckerdynamic-
-ddump-vt-traceTrace vectoriserdynamic-
-ddump-rn-traceTrace renamerdynamic-
-ddump-rn-statsRenamer statsdynamic-
-ddump-simpl-statsDump simplifier statsdynamic-
-dno-debug-outputSuppress unsolicited debugging outputstatic-
-dppr-debugTurn on debug printing (more verbose)static-
-dppr-nopragsDon't output pragma info in dumpsstatic-
-dppr-user-lengthSet the depth for printing expressions in error msgsdynamic-
-dppr-colsNNNSet the width of debugging output. For example -dppr-cols200dynamic-
-dppr-case-as-letPrint single alternative case expressions as strict lets.dynamic-
-dsuppress-allIn core dumps, suppress everything (except for uniques) that is suppressible.dynamic-
-dsuppress-uniquesSuppress the printing of uniques in debug output (easier to use diff)dynamic-
-dsuppress-idinfoSuppress extended information about identifiers where they are bounddynamic-
-dsuppress-module-prefixesSuppress the printing of module qualification prefixesdynamic-
-dsuppress-type-signaturesSuppress type signaturesdynamic-
-dsuppress-type-applicationsSuppress type applicationsdynamic-
-dsuppress-coercionsSuppress the printing of coercions in Core dumps to make them shorterdynamic-
-dsource-statsDump haskell source statsdynamic-
-dcmm-lintC-- pass sanity checkingdynamic-
-dstg-lintSTG pass sanity checkingdynamic-
-dstg-statsDump STG statsdynamic-
-dverbose-core2coreShow output from each core-to-core passdynamic-
-dverbose-stg2stgShow output from each STG-to-STG passdynamic-
-dshow-passesPrint out each pass name as it happensdynamic-
-dfaststring-statsShow statistics for fast string usage when finisheddynamic-

4.20.28. Misc compiler options

-j NWhen compiling with --make, compile N modules in parallel.dynamic-
-fno-hi-version-checkDon't complain about .hi file mismatchesstatic-
-dno-black-holingTurn off black holing (probably doesn't work)static-
-fhistory-sizeSet simplification history sizedynamic-
-funregisterisedUnregisterised compilation (use -unreg instead)static-
-fno-ghci-historyDo not use the load/store the GHCi command history from/to ghci_history.dynamic-
-fno-ghci-sandboxTurn off the GHCi sandbox. Means computations are run in the main thread, rather than a forked thread.dynamic-