Scroll to navigation

GHC(1) Glasgow Haskell Compiler GHC(1)

NAME

ghc - the Glasgow Haskell Compiler

SYNOPSIS

ghc [option|filename]
ghci [option|filename]


DESCRIPTION

This manual page documents briefly the ghc and ghci commands. Note that ghci is not yet available on all architectures. Extensive documentation is available in various other formats including PDF <https://downloads.haskell.org/ghc/latest/docs/users_guide.pdf> and HTML <https://downloads.haskell.org/ghc/latest/docs/html/>.

Each of GHC's command line options is classified as either static or dynamic. A static flag may only be specified on the command line, whereas a dynamic flag may also be given in an OPTIONS pragma in a source file or set from the GHCi command-line with :set .

As a rule of thumb, all the language options are dynamic, as are the warning options and the debugging options.

The rest are static, with the notable exceptions of -v, -cpp, -fasm, -fvia-C, -fllvm, and -#include. The OPTIONS sections lists the status of each flag.

Common suffixes of file names for Haskell are:

.hs
Haskell source code; preprocess, compile
.lhs
literate Haskell source; unlit, preprocess, compile
.hi
Interface file; contains information about exported symbols
.hc
intermediate C files
.⟨way⟩_o
object files for "way" ⟨way⟩; common ways are:
dynamically-linked
built with profiling

.⟨way⟩_hi
interface files for "way" ⟨way⟩; common ways are:

OPTIONS

-dynamic-too -fasm -fllvm -fbyte-code -fbyte-code-and-object-code -fexpose-internal-symbols -fexternal-dynamic-refs -fllvm -fasm -fno-code -fobject-code -fPIC -fPIE -fprefer-byte-code -fwrite-if-simplified-core -fwrite-interface -split-objs
-dasm-lint -dcmm-lint -dcore-lint -ddump-asm -ddump-asm-conflicts -ddump-asm-liveness -ddump-asm-native -ddump-asm-regalloc -ddump-asm-regalloc-stages -ddump-asm-stats -ddump-bcos -ddump-c-backend -ddump-call-arity -ddump-cfg-weights -ddump-cmm -ddump-cmm-caf -ddump-cmm-cbe -ddump-cmm-cfg -ddump-cmm-cps -ddump-cmm-from-stg -ddump-cmm-info -ddump-cmm-opt -ddump-cmm-proc -ddump-cmm-procmap -ddump-cmm-raw -ddump-cmm-sink -ddump-cmm-sp -ddump-cmm-split -ddump-cmm-switch -ddump-cmm-thread-sanitizer -ddump-cmm-verbose -ddump-cmm-verbose-by-proc -ddump-core-stats -ddump-cpr-signatures -ddump-cpranal -ddump-cs-trace -ddump-cse -ddump-debug -ddump-deriv -ddump-ds -ddump-ds-preopt -ddump-ec-trace -ddump-exitify -ddump-faststrings -ddump-file-prefix=⟨str⟩ -ddump-foreign -ddump-hie -ddump-hpc -ddump-if-trace -ddump-inlinings -ddump-js -ddump-json -ddump-late-cc -ddump-llvm -ddump-mod-map -ddump-occur-anal -ddump-opt-cmm -ddump-parsed -ddump-parsed-ast -ddump-prep -ddump-rn -ddump-rn-ast -ddump-rn-stats -ddump-rn-trace -ddump-rtti -ddump-rule-firings -ddump-rule-rewrites -ddump-rules -ddump-simpl -ddump-simpl-iterations -ddump-simpl-stats -ddump-simpl-trace -ddump-spec -ddump-splices -ddump-stg -ddump-stg-cg -ddump-stg-final -ddump-stg-from-core -ddump-stg-tags -ddump-stg-unarised -ddump-str-signatures -ddump-stranal -ddump-tc -ddump-tc-ast -ddump-tc-trace -ddump-ticked -ddump-timings -ddump-to-file -ddump-types -ddump-verbose-inlinings -ddump-view-pattern-commoning -ddump-worker-wrapper -dfaststring-stats -dhex-word-literals -dinitial-unique=⟨s⟩ -dinline-check=⟨str⟩ -dipe-stats -dkeep-comments -dlinear-core-lint -dlint -dno-debug-output -ddebug-output -dno-typeable-binds -dppr-case-as-let -dppr-cols=⟨n⟩ -dppr-debug -dppr-user-length -drule-check=⟨str⟩ -dshow-passes -dstg-lint -dsuppress-all -dsuppress-coercion-types -dsuppress-coercions -dsuppress-core-sizes -dsuppress-idinfo -dsuppress-module-prefixes -dsuppress-stg-free-vars -dsuppress-stg-reps -dsuppress-ticks -dsuppress-timestamps -dsuppress-type-applications -dsuppress-type-signatures -dsuppress-unfoldings -dsuppress-uniques -dsuppress-var-kinds -dtag-inference-checks -dth-dec-file -dunique-increment=⟨i⟩ -dverbose-core2core -dverbose-stg2stg -falignment-sanitisation -fcatch-nonexhaustive-cases -fcheck-prim-bounds -fcmm-thread-sanitizer -fdistinct-constructor-tables -fdump-with-ways -finfo-table-map -finfo-table-map-with-fallback -fno-info-table-map-with-fallback -finfo-table-map-with-stack -fno-info-table-map-with-stack -fllvm-fill-undef-with-garbage -fno-info-table-map-with-fallback -finfo-table-map-with-fallback -fno-info-table-map-with-stack -finfo-table-map-with-stack -fproc-alignment -g -g⟨n⟩
-cpp -D⟨symbol⟩[=⟨value⟩] -U⟨symbol⟩ -I⟨dir⟩ -U⟨symbol⟩
-i -i⟨dir⟩[:⟨dir⟩]*
-fbreak-on-error -fno-break-on-error -fbreak-on-exception -fno-break-on-exception -fghci-hist-size=⟨n⟩ -fghci-leak-check -fno-ghci-leak-check -fimplicit-import-qualified -fno-implicit-import-qualified -flocal-ghci-history -fno-local-ghci-history -fno-it -fno-no-it -fprint-bind-result -fno-print-bind-result -fprint-evld-with-show -fshow-loaded-modules -ghci-script -ignore-dot-ghci -no-ignore-dot-ghci -interactive-print ⟨name⟩
--show-iface ⟨file⟩ -ddump-hi -ddump-hi-diffs -ddump-minimal-imports
-keep-hc-file -keep-hc-files -keep-hi-files -no-keep-hi-files -keep-hscpp-file -keep-hscpp-files -keep-llvm-file -keep-llvm-files -keep-o-files -no-keep-o-files -keep-s-file -keep-s-files -keep-tmp-files
-XAllowAmbiguousTypes -XApplicativeDo -XArrows -XBangPatterns -XBinaryLiterals -XBlockArguments -XCApiFFI -XConstrainedClassMethods -XConstraintKinds -XCPP -XCUSKs -XDataKinds -XDatatypeContexts -XDeepSubsumption -XDefaultSignatures -XDeriveAnyClass -XDeriveDataTypeable -XDeriveFoldable -XDeriveFunctor -XDeriveGeneric -XDeriveLift -XDeriveTraversable -XDerivingStrategies -XDerivingVia -XDisambiguateRecordFields -XDuplicateRecordFields -XEmptyCase -XEmptyDataDecls -XEmptyDataDeriving -XExistentialQuantification -XExplicitForAll -XExplicitNamespaces -XExtendedDefaultRules -XFieldSelectors -XFlexibleContexts -XFlexibleInstances -XForeignFunctionInterface -XFunctionalDependencies -XGADTs -XGADTSyntax -XGeneralisedNewtypeDeriving -XGeneralizedNewtypeDeriving -XGHC2021 -XGHCForeignImportPrim -XHaskell2010 -XHaskell98 -XHexFloatLiterals -XImplicitParams -XImportQualifiedPost -XImpredicativeTypes -XIncoherentInstances -XInstanceSigs -XInterruptibleFFI -XKindSignatures -XLambdaCase -XLexicalNegation -XLiberalTypeSynonyms -XLinearTypes -XMagicHash -XMonadComprehensions -XMonoLocalBinds -XMultiParamTypeClasses -XMultiWayIf -XNamedFieldPuns -XNamedWildCards -XNegativeLiterals -XNoImplicitPrelude -XNoMonomorphismRestriction -XNondecreasingIndentation -XNoPatternGuards -XNoTraditionalRecordSyntax -XNPlusKPatterns -XNullaryTypeClasses -XNumDecimals -XNumericUnderscores -XOverlappingInstances -XOverloadedLabels -XOverloadedLists -XOverloadedRecordDot -XOverloadedRecordUpdate -XOverloadedStrings -XPackageImports -XParallelListComp -XPartialTypeSignatures -XPatternSynonyms -XPolyKinds -XPostfixOperators -XQualifiedDo -XQuantifiedConstraints -XQuasiQuotes -XRank2Types -XRankNTypes -XRebindableSyntax -XRecordWildCards -XRecursiveDo -XRoleAnnotations -XSafe -XScopedTypeVariables -XStandaloneDeriving -XStandaloneKindSignatures -XStarIsType -XStaticPointers -XStrict -XStrictData -XTemplateHaskell -XTemplateHaskellQuotes -XTransformListComp -XTrustworthy -XTupleSections -XTypeApplications -XTypeData -XTypeFamilies -XTypeFamilyDependencies -XTypeInType -XTypeOperators -XTypeSynonymInstances -XUnboxedSums -XUnboxedTuples -XUndecidableInstances -XUndecidableSuperClasses -XUnicodeSyntax -XUnliftedDatatypes -XUnliftedFFITypes -XUnliftedNewtypes -XUnsafe -XViewPatterns
-c -debug -dylib-install-name ⟨path⟩ -dynamic -dynload -eventlog -fcompact-unwind -fkeep-cafs -flink-rts -fno-embed-manifest -fno-gen-manifest -fno-shared-implib -framework ⟨name⟩ -framework-path ⟨dir⟩ -fsplit-sections -split-sections -fno-split-sections -fuse-rpaths -fwhole-archive-hs-libs -L ⟨dir⟩ -l ⟨lib⟩ -main-is ⟨thing⟩ -no-hs-main -no-pie -pie -no-rtsopts-suggestions -package ⟨name⟩ -pie -no-pie -rdynamic -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩] -shared -static -staticlib -threaded -with-rtsopts=⟨opts⟩
-ddump-mod-cycles -fexternal-interpreter -ffamily-application-cache -fno-family-application-cache -fglasgow-exts -fno-glasgow-exts -fno-safe-haskell -ghcversion-file ⟨path to ghcversion.h⟩ -H ⟨size⟩ -hidden-module ⟨module name⟩ -j[⟨n⟩] -reexported-module ⟨module name⟩ -this-package-name ⟨unit-id⟩ -unit @⟨filename⟩ -working-dir ⟨dir⟩
--frontend ⟨module⟩ --help -? --info --interactive --make --numeric-version --print-booter-version --print-build-platform --print-c-compiler-flags --print-c-compiler-link-flags --print-debug-on --print-global-package-db --print-have-interpreter --print-have-native-code-generator --print-host-platform --print-ld-flags --print-leading-underscore --print-libdir --print-object-splitting-supported --print-project-git-commit-id --print-project-version --print-rts-ways --print-stage --print-support-smp --print-tables-next-to-code --print-target-platform --print-unregisterised --run ⟨file⟩ --show-iface ⟨file⟩ --show-options --supported-extensions --supported-languages --version -V -e ⟨expr⟩ -M -shared
-fasm-shortcutting -fno-asm-shortcutting -fbinary-blob-threshold=⟨n⟩ -fblock-layout-cfg -fno-block-layout-cfg -fblock-layout-weightless -fno-block-layout-weightless -fblock-layout-weights -fcall-arity -fno-call-arity -fcase-folding -fno-case-folding -fcase-merge -fno-case-merge -fcmm-control-flow -fno-cmm-control-flow -fcmm-elim-common-blocks -fno-cmm-elim-common-blocks -fcmm-sink -fno-cmm-sink -fcmm-static-pred -fno-cmm-static-pred -fcore-constant-folding -fno-core-constant-folding -fcpr-anal -fno-cpr-anal -fcross-module-specialise -fno-cross-module-specialise -fcse -fno-cse -fdicts-cheap -fno-dicts-cheap -fdicts-strict -fno-dicts-strict -fdmd-tx-dict-sel -fno-dmd-tx-dict-sel -fdmd-unbox-width=⟨n⟩ -fdo-eta-reduction -fno-do-eta-reduction -fdo-lambda-eta-expansion -fno-do-lambda-eta-expansion -feager-blackholing -fenable-rewrite-rules -fno-enable-rewrite-rules -fexcess-precision -fno-excess-precision -fexitification -fno-exitification -fexpose-all-unfoldings -fno-expose-all-unfoldings -ffloat-in -fno-float-in -ffull-laziness -fno-full-laziness -ffun-to-thunk -fno-fun-to-thunk -fignore-asserts -fno-ignore-asserts -fignore-interface-pragmas -fno-ignore-interface-pragmas -finline-generics -fno-inline-generics -finline-generics-aggressively -fno-inline-generics-aggressively -flate-dmd-anal -fno-late-dmd-anal -flate-specialise -fno-late-specialise -fliberate-case -fno-liberate-case -fliberate-case-threshold=⟨n⟩ -fno-liberate-case-threshold -fllvm-pass-vectors-in-regs -flocal-float-out -fno-local-float-out -flocal-float-out-top-level -fno-local-float-out-top-level -floopification -fno-loopification -fmax-inline-alloc-size=⟨n⟩ -fmax-inline-memcpy-insns=⟨n⟩ -fmax-inline-memset-insns=⟨n⟩ -fmax-simplifier-iterations=⟨n⟩ -fmax-uncovered-patterns=⟨n⟩ -fmax-worker-args=⟨n⟩ -fno-opt-coercion -fno-pre-inlining -fno-state-hack -fomit-interface-pragmas -fno-omit-interface-pragmas -fomit-yields -fno-omit-yields -foptimal-applicative-do -fno-optimal-applicative-do -fpedantic-bottoms -fno-pedantic-bottoms -fpolymorphic-specialisation -fno-polymorphic-specialisation -fregs-graph -fno-regs-graph -fregs-iterative -fno-regs-iterative -fsimpl-tick-factor=⟨n⟩ -fsimplifier-phases=⟨n⟩ -fsolve-constant-dicts -fno-solve-constant-dicts -fspec-constr -fno-spec-constr -fspec-constr-count=⟨n⟩ -fno-spec-constr-count -fspec-constr-keen -fno-spec-constr-keen -fspec-constr-threshold=⟨n⟩ -fno-spec-constr-threshold -fspecialise -fno-specialise -fspecialise-aggressively -fno-specialise-aggressively -fstatic-argument-transformation -fno-static-argument-transformation -fstg-cse -fno-stg-cse -fstg-lift-lams -fno-stg-lift-lams -fstg-lift-lams-known -fno-stg-lift-lams-known -fstg-lift-lams-non-rec-args -fstg-lift-lams-non-rec-args-any -fstg-lift-lams-rec-args -fstg-lift-lams-rec-args-any -fstrictness -fno-strictness -fstrictness-before=⟨n⟩ -funbox-small-strict-fields -fno-unbox-small-strict-fields -funbox-strict-fields -fno-unbox-strict-fields -funfolding-case-scaling=⟨n⟩ -funfolding-case-threshold=⟨n⟩ -funfolding-creation-threshold=⟨n⟩ -funfolding-dict-discount=⟨n⟩ -funfolding-fun-discount=⟨n⟩ -funfolding-keeness-factor=⟨n⟩ -funfolding-use-threshold=⟨n⟩ -fworker-wrapper -fworker-wrapper-cbv
-O -O1 -O0 -O0 -O2 -O0 -O⟨n⟩ -O0
-clear-package-db -distrust ⟨pkg⟩ -distrust-all-packages -fpackage-trust -global-package-db -hide-all-packages -hide-package ⟨pkg⟩ -ignore-package ⟨pkg⟩ -no-auto-link-packages -no-global-package-db -no-user-package-db -package ⟨pkg⟩ -package-db ⟨file⟩ -package-env ⟨file⟩|⟨name⟩ -package-id ⟨unit-id⟩ -this-unit-id ⟨unit-id⟩ -trust ⟨pkg⟩ -user-package-db
--merge-objs -C -c -E -F -S -x ⟨suffix⟩
-pgma ⟨cmd⟩ -pgmc ⟨cmd⟩ -pgmcxx ⟨cmd⟩ -pgmdll ⟨cmd⟩ -pgmF ⟨cmd⟩ -pgmi ⟨cmd⟩ -pgminstall_name_tool ⟨cmd⟩ -pgmL ⟨cmd⟩ -pgml ⟨cmd⟩ -pgmlc ⟨cmd⟩ -pgmlm ⟨cmd⟩ -pgmlo ⟨cmd⟩ -pgmotool ⟨cmd⟩ -pgmP ⟨cmd⟩ -pgms ⟨cmd⟩ -pgmwindres ⟨cmd⟩
-opta ⟨option⟩ -optc ⟨option⟩ -optcxx ⟨option⟩ -optdll ⟨option⟩ -optF ⟨option⟩ -opti ⟨option⟩ -optL ⟨option⟩ -optl ⟨option⟩ -optlc ⟨option⟩ -optlm ⟨option⟩ -optlo ⟨option⟩ -optP ⟨option⟩ -optwindres ⟨option⟩ -pgmc-supports-no-pie -pgml-supports-no-pie
-mavx -mavx2 -mavx512cd -mavx512er -mavx512f -mavx512pf -mbmi -mbmi2 -msse -msse2 -msse3 -msse4 -msse4.2
-fclear-plugins -fplugin-library=⟨file-path⟩;⟨unit-id⟩;⟨module⟩;⟨args⟩ -fplugin-opt=⟨module⟩:⟨args⟩ -fplugin-trustworthy -fplugin=⟨module⟩ -hide-all-plugin-packages -plugin-package ⟨pkg⟩ -plugin-package-id ⟨pkg-id⟩
-auto -auto-all -caf-all -fno-prof-count-entries -fprof-count-entries -fprof-auto -fno-prof-auto -fprof-auto-calls -fno-prof-auto -fprof-auto-exported -fno-prof-auto -fprof-auto-top -fno-prof-auto -fprof-cafs -fno-prof-cafs -fprof-callers=⟨name⟩ -fprof-late -fno-prof-late -fprof-late-inline -fno-prof-late-inline -fprof-manual -fno-prof-manual -no-auto -no-auto-all -no-caf-all -prof -ticky -ticky-allocd -ticky-ap-thunk -ticky-dyn-thunk -ticky-LNE -ticky-tag-checks
-fhpc -hpcdir⟨dir⟩
-exclude-module=⟨file⟩ -fforce-recomp -fno-force-recomp -fignore-hpc-changes -fno-ignore-hpc-changes -fignore-optim-changes -fno-ignore-optim-changes -include-cpp-deps -include-pkg-deps
-dep-makefile ⟨file⟩ -dep-suffix ⟨suffix⟩ -dumpdir ⟨dir⟩ -dynhisuf ⟨suffix⟩ -dyno ⟨file⟩ -dynohi ⟨file⟩ -dynosuf ⟨suffix⟩ -hcsuf ⟨suffix⟩ -hidir ⟨dir⟩ -hiedir ⟨dir⟩ -hiesuf ⟨suffix⟩ -hisuf ⟨suffix⟩ -o ⟨file⟩ -odir ⟨dir⟩ -ohi ⟨file⟩ -osuf ⟨suffix⟩ -outputdir ⟨dir⟩ -stubdir ⟨dir⟩
-tmpdir ⟨dir⟩
-fabstract-refinement-hole-fits -fno-abstract-refinement-hole-fits -fdefer-diagnostics -fdiagnostics-color=⟨always|auto|never⟩ -fdiagnostics-show-caret -fno-diagnostics-show-caret -ferror-spans -fhide-source-paths -fkeep-going -fmax-refinement-hole-fits=⟨n⟩ -fno-max-refinement-hole-fits -fmax-relevant-binds=⟨n⟩ -fno-max-relevant-binds -fmax-valid-hole-fits=⟨n⟩ -fno-max-valid-hole-fits -fno-show-valid-hole-fits -fno-sort-valid-hole-fits -fsort-valid-hole-fits -fprint-axiom-incomps -fno-print-axiom-incomps -fprint-equality-relations -fno-print-equality-relations -fprint-expanded-synonyms -fno-print-expanded-synonyms -fprint-explicit-coercions -fno-print-explicit-coercions -fprint-explicit-foralls -fno-print-explicit-foralls -fprint-explicit-kinds -fno-print-explicit-kinds -fprint-explicit-runtime-reps -fno-print-explicit-runtime-reps -fprint-potential-instances -fno-print-potential-instances -fprint-redundant-promotion-ticks -fno-print-redundant-promotion-ticks -fprint-typechecker-elaboration -fno-print-typechecker-elaboration -fprint-unicode-syntax -fno-print-unicode-syntax -frefinement-level-hole-fits=⟨n⟩ -fno-refinement-level-hole-fits -freverse-errors -fno-reverse-errors -fshow-docs-of-hole-fits -fno-show-docs-of-hole-fits -fshow-error-context -fno-show-error-context -fshow-hole-constraints -fshow-hole-matches-of-hole-fits -fno-show-hole-matches-of-hole-fits -fshow-provenance-of-hole-fits -fno-show-provenance-of-hole-fits -fshow-type-app-of-hole-fits -fno-show-type-app-of-hole-fits -fshow-type-app-vars-of-hole-fits -fno-show-type-app-vars-of-hole-fits -fshow-type-of-hole-fits -fno-show-type-of-hole-fits -fsort-by-size-hole-fits -fno-sort-by-size-hole-fits -fsort-by-subsumption-hole-fits -fno-sort-by-subsumption-hole-fits -funclutter-valid-hole-fits -Rghc-timing -v -v⟨n⟩
-fdefer-out-of-scope-variables -fno-defer-out-of-scope-variables -fdefer-type-errors -fno-defer-type-errors -fdefer-typed-holes -fno-defer-typed-holes -fenable-th-splice-warnings -fno-enable-th-splice-warnings -fhelpful-errors -fno-helpful-errors -fmax-pmcheck-models=⟨n⟩ -fshow-warning-groups -fno-show-warning-groups -fvia-C -W -w -w -Wall -w -Wall-missed-specialisations -Wno-all-missed-specialisations -Wall-missed-specializations -Wno-all-missed-specializations -Wambiguous-fields -Wauto-orphans -Wcompat -Wno-compat -Wcompat-unqualified-imports -Wno-compat-unqualified-imports -Wcpp-undef -Wdefault -Wdeferred-out-of-scope-variables -Wno-deferred-out-of-scope-variables -Wdeferred-type-errors -Wno-deferred-type-errors -Wdeprecated-flags -Wno-deprecated-flags -Wdeprecations -Wno-deprecations -Wderiving-defaults -Wno-deriving-defaults -Wderiving-typeable -Wno-deriving-typeable -Wdodgy-exports -Wno-dodgy-exports -Wdodgy-foreign-imports -Wno-dodgy-foreign-imports -Wdodgy-imports -Wno-dodgy-imports -Wduplicate-constraints -Wno-duplicate-constraints -Wduplicate-exports -Wno-duplicate-exports -Wempty-enumerations -Wno-empty-enumerations -Werror -Wwarn -Weverything -Wextra -w -Wforall-identifier -Wno-forall-identifier -Wgadt-mono-local-binds -Wno-gadt-mono-local-binds -Whi-shadowing -Wno-hi-shadowing -Widentities -Wno-identities -Wimplicit-kind-vars -Wno-implicit-kind-vars -Wimplicit-lift -Wno-implicit-lift -Wimplicit-prelude -Wno-implicit-prelude -Winaccessible-code -Wno-inaccessible-code -Wincomplete-patterns -Wno-incomplete-patterns -Wincomplete-record-updates -Wno-incomplete-record-updates -Wincomplete-uni-patterns -Wno-incomplete-uni-patterns -Winferred-safe-imports -Wno-inferred-safe-imports -Winline-rule-shadowing -Wno-inline-rule-shadowing -Winvalid-haddock -Wno-invalid-haddock -Wloopy-superclass-solve -Wno-loopy-superclass-solve -Wmisplaced-pragmas -Wno-misplaced-pragmas -Wmissed-extra-shared-lib -Wno-missed-extra-shared-lib -Wmissed-specialisations -Wno-missed-specialisations -Wmissed-specializations -Wno-missed-specializations -Wmissing-deriving-strategies -Wno-missing-deriving-strategies -Wmissing-export-lists -Wno-missing-export-lists -Wmissing-exported-pattern-synonym-signatures -Wno-missing-exported-pattern-synonym-signatures -Wmissing-exported-signatures -Wno-missing-exported-signatures -Wmissing-exported-sigs -Wno-missing-exported-sigs -Wmissing-fields -Wno-missing-fields -Wmissing-home-modules -Wno-missing-home-modules -Wmissing-import-lists -Wno-missing-import-lists -Wmissing-kind-signatures -Wno-missing-kind-signatures -Wmissing-local-signatures -Wno-missing-local-signatures -Wmissing-local-sigs -Wno-missing-local-sigs -Wmissing-methods -Wno-missing-methods -Wmissing-monadfail-instances -Wno-missing-monadfail-instances -Wmissing-pattern-synonym-signatures -Wno-missing-pattern-synonym-signatures -Wmissing-safe-haskell-mode -Wno-missing-safe-haskell-mode -Wmissing-signatures -Wno-missing-signatures -Wmissing-space-after-bang -Wmonomorphism-restriction -Wno-monomorphism-restriction -Wname-shadowing -Wno-name-shadowing -Wno-compat -Wcompat -Wnoncanonical-monad-instances -Wno-noncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wno-noncanonical-monadfail-instances -Wnoncanonical-monoid-instances -Wno-noncanonical-monoid-instances -Wnot -Woperator-whitespace -Wno-operator-whitespace -Woperator-whitespace-ext-conflict -Wno-operator-whitespace-ext-conflict -Worphans -Wno-orphans -Woverflowed-literals -Wno-overflowed-literals -Woverlapping-patterns -Wno-overlapping-patterns -Wpartial-fields -Wno-partial-fields -Wpartial-type-signatures -Wno-partial-type-signatures -Wprepositive-qualified-module -Wno-prepositive-qualified-module -Wredundant-bang-patterns -Wno-redundant-bang-patterns -Wredundant-constraints -Wno-redundant-constraints -Wredundant-record-wildcards -Wno-redundant-record-wildcards -Wredundant-strictness-flags -Wno-redundant-strictness-flags -Wsafe -Wno-safe -Wsemigroup -Wno-semigroup -Wsimplifiable-class-constraints -Wno-simplifiable-class-constraints -Wstar-binder -Wno-star-binder -Wstar-is-type -Wno-star-is-type -Wtabs -Wno-tabs -Wtrustworthy-safe -Wno-safe -Wtype-defaults -Wno-type-defaults -Wtype-equality-out-of-scope -Wno-type-equality-out-of-scope -Wtype-equality-requires-operators -Wno-type-equality-requires-operators -Wtyped-holes -Wno-typed-holes -Wunbanged-strict-patterns -Wno-unbanged-strict-patterns -Wunicode-bidirectional-format-characters -Wunrecognised-pragmas -Wno-unrecognised-pragmas -Wunrecognised-warning-flags -Wno-unrecognised-warning-flags -Wunsafe -Wno-unsafe -Wunsupported-calling-conventions -Wno-unsupported-calling-conventions -Wunsupported-llvm-version -Wno-monomorphism-restriction -Wunticked-promoted-constructors -Wno-unticked-promoted-constructors -Wunused-binds -Wno-unused-binds -Wunused-do-bind -Wno-unused-do-bind -Wunused-foralls -Wno-unused-foralls -Wunused-imports -Wno-unused-imports -Wunused-local-binds -Wno-unused-local-binds -Wunused-matches -Wno-unused-matches -Wunused-packages -Wno-unused-packages -Wunused-pattern-binds -Wno-unused-pattern-binds -Wunused-record-wildcards -Wno-unused-record-wildcards -Wunused-top-binds -Wno-unused-top-binds -Wunused-type-patterns -Wno-unused-type-patterns -Wwarn -Werror -Wwarnings-deprecations -Wno-warnings-deprecations -Wwrong-do-bind -Wno-wrong-do-bind

Code generation

Build dynamic object files as well as static object files during compilation
Use the native code generator
Generate byte-code
Generate object code and byte-code
Produce symbols for all functions, including internal functions.
Generate code for linking against dynamic libraries
Compile using the LLVM code generator
Omit code generation
Generate object code
Generate position-independent code (where available)
Generate code for a position-independent executable (where available)
Use byte-code if it is available to evaluate TH splices
Write an interface file containing the simplified core of the module.
Always write interface files
Split generated object files into smaller files

Debugging the compiler

ASM pass sanity checking
C-\- pass sanity checking
Turn on internal sanity checking
Dump final assembly
Dump register conflicts from the register allocator.
Dump assembly augmented with register liveness
Dump initial assembly
Dump the result of register allocation
Dump the build/spill stages of the -fregs-graph register allocator.
Dump statistics from the register allocator.
Dump interpreter byte code
Dump C code produced by the C (unregisterised) backend.
Dump output of the call arity analysis pass.
Dump the assumed weights of the CFG.
Dump the final C-\- output
Dump the results of the C-\- CAF analysis pass.
Dump the results of common block elimination
Dump the results of the C-\- control flow optimisation pass.
Dump the results of the CPS pass
Dump STG-to-C-\- output
Dump the results of the C-\- info table augmentation pass.
Dump the results of C-\- to C-\- optimising passes
Dump the results of proc-point analysis
Dump the results of the C-\- proc-point map pass.
Dump raw C-\-
Dump the results of the C-\- sinking pass.
Dump the results of the C-\- stack layout pass.
Dump the results of the C-\- proc-point splitting pass.
Dump the results of switch lowering passes
Dump the results of the C-\- ThreadSanitizer elaboration pass.
Write output from main C-\- pipeline passes to files
Show output from main C-\- pipeline passes (grouped by proc)
Print a one-line summary of the size of the Core program at the end of the optimisation pipeline
Dump CPR signatures
Dump CPR analysis output
Trace constraint solver
Dump CSE output
Dump generated DWARF debug information
Dump deriving output
Dump desugarer output.
Trace exhaustiveness checker
Dump output of the exitification pass.
Dump the whole FastString table when finished
Set the prefix of the filenames used for debugging output.
Dump foreign export stubs
Dump the hie file syntax tree
An alias for -ddump-ticked.
Trace interface files
Dump inlinings performed by the simplifier.
Dump final JavaScript code
Dump error messages as JSON documents
Dump core with late cost centres added
Dump LLVM intermediate code.
Dump the state of the module mapping database.
Dump occurrence analysis output
Dump the results of C-\- to C-\- optimising passes
Dump parse tree
Dump parser output as a syntax tree
Dump prepared core
Dump renamer output
Dump renamer output as a syntax tree
Renamer stats
Trace renamer
Trace runtime type inference
Dump rule firing info
Dump detailed rule firing info
Dump rewrite rules
Dump final simplifier output
Dump output from each simplifier iteration
Dump simplifier stats
Dump trace messages in simplifier
Dump specialiser output
Dump TH spliced expressions, and what they evaluate to
(deprecated) Alias for -ddump-stg-from-core
Show output after Stg2Stg
Show output of last STG pass.
Show CoreToStg output
Show output of the tag inference pass.
Show unarised STG
Dump top-level demand signatures
Dump demand analysis output
Dump typechecker output
Dump typechecker output as a syntax tree
Trace typechecker
Dump the code instrumented by HPC (Observing Code Coverage).
Dump per-pass timing and allocation statistics
Dump to files instead of stdout
Dump type signatures
Dump all considered inlinings
Dump commoned view patterns
Dump worker-wrapper output
Show statistics for fast string usage when finished
Print values of type Word# in hexadecimal.
Start UniqSupply allocation from ⟨s⟩.
Dump information about inlining decisions
Show statistics about IPE information
Include comments in the parser. Useful in combination with -ddump-parsed-ast.
Turn on internal sanity checking
Enable several common internal sanity checkers
Suppress unsolicited debugging output
Don't generate bindings for Typeable methods
Print single alternative case expressions as strict lets.
Set the width of debugging output. For example -dppr-cols200
Turn on debug printing (more verbose)
Set the depth for printing expressions in error msgs
Dump information about potential rule application
Print out each pass name as it happens
STG pass sanity checking
In dumps, suppress everything (except for uniques) that is suppressible.
Suppress the printing of coercion types in Core dumps to make them shorter
Suppress the printing of coercions in Core dumps to make them shorter
Suppress the printing of core size stats per binding (since 9.4)
Suppress extended information about identifiers where they are bound
Suppress the printing of module qualification prefixes
Suppress the printing of closure free variable lists in STG output
Suppress rep annotations on STG args.
Suppress "ticks" in the pretty-printer output.
Suppress timestamps in dumps
Suppress type applications
Suppress type signatures
Suppress the printing of the stable unfolding of a variable at its binding site
Suppress the printing of uniques in debug output (easier to use diff)
Suppress the printing of variable kinds
Affirm tag inference results are correct at runtime.
Dump evaluated TH declarations into *.th.hs files
Set the increment for the generated Unique's to ⟨i⟩.
Show output from each core-to-core pass
Show output from each STG-to-STG pass
Compile with alignment checks for all info table dereferences.
Add a default error alternative to case expressions without a default alternative.
Instrument array primops with bounds checks.
Enable ThreadSanitizer instrumentation of memory accesses.
Generate a fresh info table for each usage of a data constructor.
Include the tag of the enabled ways in the extension of dump files.
Embed a lookup table in the generated binary which maps the address of an info table to the source position the closure originated from.
Include info tables with no source location information in the info table map.
Include info tables for STACK closures in the info table map.
Intruct LLVM to fill dead STG registers with garbage
Omit info tables with no source location information from the info table map.
Omit info tables for STACK closures from the info table map.
Align functions at given boundary.
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.

C pre-processor

Run the C pre-processor on Haskell source files
Define a symbol in the C pre-processor
Add ⟨dir⟩ to the directory search list for #include files
Undefine a symbol in the C pre-processor

Finding imports

Empty the import directory list
add ⟨dir⟩, ⟨dir2⟩, etc. to import path

Interactive mode

Break on uncaught exceptions and errors
Break on any exception thrown
Set the number of entries GHCi keeps for :history. See The GHCi Debugger.
(Debugging only) check for space leaks when loading new modules in GHCi.
Put in scope qualified identifiers for every loaded module
Use current directory for the GHCi command history file .ghci-history.
No longer set the special variable it.
Turn on printing of binding results in GHCi
Instruct :print to use Show instances where possible.
Show the names of modules that GHCi loaded after a :load command.
Read additional .ghci files
Disable reading of .ghci files
Select the function to use for printing evaluated expressions in GHCi

Interface files

See Modes of operation.
Dump the new interface to stdout
Show the differences vs. the old interface
Dump a minimal set of imports

Keeping intermediate files

Retain intermediate .hc files.
Retain intermediate .hi files (the default).
Retain intermediate .hscpp files.
Retain intermediate LLVM .ll files. Implies -fllvm.
Retain intermediate .o files (the default).
Retain intermediate .s files.
Retain all intermediate temporary files.

Language options

Allow the user to write ambiguous types, and the type inference engine to infer them.
Enable Applicative do-notation desugaring
Enable arrow notation extension
Enable bang patterns.
Enable support for binary literals.
Allow do blocks and other constructs as function arguments.
Enable the CAPI calling convention.
Enable constrained class methods.
Enable a kind of constraints.
Enable the C preprocessor.
Enable detection of complete user-supplied kind signatures.
Enable datatype promotion.
Allow contexts on data types.
Enable deep subsumption
Enable default signatures.
Enable deriving for any class.
Enable deriving for the Data class.
Enable deriving for the Foldable class. Implied by DeriveTraversable.
Enable deriving for the Functor class. Implied by DeriveTraversable.
Enable deriving for the Generic class.
Enable deriving for the Lift class
Enable deriving for the Traversable class. Implies DeriveFunctor and DeriveFoldable.
Enables deriving strategies.
Enable deriving instances via types of the same runtime representation. Implies DerivingStrategies.
Enable record field disambiguation. Implied by RecordWildCards.
Allow definition of record types with identically-named fields.
Allow empty case alternatives.
Allow definition of empty data types.
Allow deriving instances of standard type classes for empty data types.
Enable liberalised type synonyms.
Enable explicit universal quantification. Implied by ScopedTypeVariables, LiberalTypeSynonyms, RankNTypes and ExistentialQuantification.
Enable using the keyword type to specify the namespace of entries in imports and exports (Explicit namespaces in import/export). Implied by TypeOperators and TypeFamilies.
Use GHCi's extended default rules in a normal module.
Control visibility of field selector functions.
Remove some restrictions on class contexts
Enable flexible instances. Implies TypeSynonymInstances.
Enable foreign function interface.
Enable functional dependencies. Implies MultiParamTypeClasses.
Enable generalised algebraic data types. Implies GADTSyntax and MonoLocalBinds.
Enable generalised algebraic data type syntax.
Enable newtype deriving.
Enable newtype deriving.
Use GHC’s set of default language extensions from 2021
Enable prim calling convention. Intended for internal use only.
Use the Haskell 2010 language variant.
Use the Haskell 98 language variant.
Enable support for hexadecimal floating point literals.
Enable Implicit Parameters.
ImportQualifiedPost allows the syntax import M qualified
Enable impredicative types. Implies RankNTypes.
Enable incoherent instances. Implies OverlappingInstances.
Enable instance signatures.
Enable interruptible FFI.
Enable kind signatures. Implied by TypeFamilies and PolyKinds.
Enable lambda-case expressions.
Use whitespace to determine whether the minus sign stands for negation or subtraction.
Enable liberalised type synonyms.
Enable linear types.
Allow # as a postfix modifier on identifiers.
Enable monad comprehensions.
Enable do not generalise local bindings. Implied by TypeFamilies and GADTs.
Enable multi parameter type classes. Implied by FunctionalDependencies.
Enable multi-way if-expressions.
Enable record puns.
Enable named wildcards.
Enable support for negative literals.
Don't implicitly import Prelude. Implied by RebindableSyntax.
Disable the monomorphism restriction.
Allow nested contexts to be at the same indentation level as its enclosing context.
Disable pattern guards. Implied by Haskell98.
Disable support for traditional record syntax (as supported by Haskell 98) C {f = x}
Enable support for n+k patterns. Implied by Haskell98.
Deprecated, does nothing. nullary (no parameter) type classes are now enabled using MultiParamTypeClasses.
Enable support for 'fractional' integer literals.
Enable support for numeric underscores.
Enable overlapping instances.
Enable overloaded labels.
Enable overloaded lists.
Record '.' syntax
Record '.' syntax record updates
Enable overloaded string literals.
Enable package-qualified imports.
Enable parallel list comprehensions.
Enable partial type signatures.
Enable pattern synonyms.
Enable kind polymorphism. Implies KindSignatures.
Enable postfix operators.
Enable qualified do-notation desugaring.
Allow forall quantifiers in constraints.
Enable quasiquotation.
Enable rank-2 types. Synonym for RankNTypes.
Enable rank-N types. Implied by ImpredicativeTypes.
Employ rebindable syntax. Implies NoImplicitPrelude.
Enable record wildcards. Implies DisambiguateRecordFields.
Enable recursive do (mdo) notation.
Enable role annotations.
Enable the Safe Haskell Safe mode.
Enable lexically-scoped type variables.
Enable standalone deriving.
Allow the use of standalone kind signatures.
Treat * as Data.Kind.Type.
Enable static pointers.
Make bindings in the current module strict by default.
Enable default strict datatype fields.
Enable Template Haskell.
Enable quotation subset of Template Haskell.
Enable generalised list comprehensions.
Enable the Safe Haskell Trustworthy mode.
Enable tuple sections.
Enable type application syntax in terms, patterns and types.
Enable type data declarations.
Enable type families. Implies ExplicitNamespaces, KindSignatures, and MonoLocalBinds.
Enable injective type families. Implies TypeFamilies.
Deprecated. Enable kind polymorphism and datatype promotion.
Enable type operators. Implies ExplicitNamespaces.
Enable type synonyms in instance heads. Implied by FlexibleInstances.
Enable unboxed sums.
Enable the use of unboxed tuple syntax.
Enable undecidable instances.
Allow all superclass constraints, including those that may result in non-termination of the typechecker.
Enable unicode syntax.
Enable unlifted data types.
Enable unlifted FFI types
Enable unlifted newtypes.
Enable Safe Haskell Unsafe mode.
Enable view patterns.

Linking options

Stop after generating object (.o) file
Use the debugging runtime
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)
Build dynamically-linked object files and executables
Selects one of a number of modes for finding shared libraries at runtime.
Enable runtime event tracing
Instruct the linker to produce a __compact_unwind section.
Do not garbage-collect CAFs (top-level expressions) at runtime
Link the runtime when generating a shared or static library
Do not embed the manifest in the executable (Windows only)
Do not generate a manifest file (Windows only)
Don't generate an import library for a DLL (Windows only)
On Darwin/OS X/iOS only, link in the framework ⟨name⟩. This option corresponds to the -framework option for Apple's Linker.
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.
Split sections for link-time dead-code stripping
Set the rpath based on -L flags
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
Add ⟨dir⟩ to the list of directories searched for libraries
Link in library ⟨lib⟩
Set main module and function
Don't assume this program contains main
Don't instruct the linker to produce a position-independent executable.
Don't print RTS suggestions about linking with -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩].
Expose package ⟨pkg⟩
Instruct the linker to produce a position-independent executable.
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.
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); all (or no argument at all) means that all RTS flags are permitted; 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.
Generate a shared library (as opposed to an executable)
Use static Haskell libraries
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.
Use the threaded runtime
Set the default RTS options to ⟨opts⟩.

Miscellaneous options

Dump module cycles
Run interpreted code in a separate process
Use a cache when reducing type family applications
Deprecated. Enable most language extensions; see Controlling extensions for exactly which ones.
Disable Safe Haskell
(GHC as a C compiler only) Use this ghcversion.h file
Set the minimum size of the heap to ⟨size⟩
A module which should not be visible outside its unit.
When compiling with --make, compile ⟨n⟩ modules in parallel.
A module which should be reexported from this unit.
The name of the package which this module would be part of when installed.
Specify the options to build a specific unit.
Specify the directory a unit is expected to be compiled in.

Modes of operation

run GHC with the given frontend plugin; see Frontend plugins for details.
Display help
display information about the compiler
Interactive mode - normally used by just running ghci; see Using GHCi for details.
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.
display GHC version (numeric only)
display bootstrap compiler version
display platform on which GHC was built
C compiler flags used to build GHC
C linker flags used to build GHC
print whether GHC was built with -DDEBUG
display GHC's global package database directory
display whether GHC was built with interactive support
display whether target platform has NCG support
display host platform of GHC
display linker flags used to compile GHC
display use of leading underscores on symbol names
display GHC library directory
display whether GHC supports object splitting
display Git commit id GHC is built from
display GHC version
display which way RTS was built
display stage number of GHC
display whether GHC was compiled with SMP support
display whether GHC was compiled with --enable-tables-next-to-code
display target platform of GHC
display whether this GHC was built in unregisterised mode
Run a Haskell program.
display the contents of an interface file.
display the supported command line options
display the supported language extensions
display GHC version
Evaluate expr; see Expression evaluation mode for details.
generate dependency information suitable for use in a Makefile; see Dependency generation for details.
Create a shared object.

Individual optimizations

Enable shortcutting on assembly.
default: 500K. Tweak assembly generator for binary blobs.
Use the new cfg based block layout algorithm.
Ignore cfg weights for code layout.
Sets edge weights used by the new code layout algorithm.
Enable call-arity optimisation. Implied by -O.
Enable constant folding in case expressions. Implied by -O.
Enable case-merging. Implied by -O.
Enable control flow optimisation in the Cmm backend. Implied by -O.
Enable Cmm common block elimination. Implied by -O.
Enable Cmm sinking. Implied by -O.
Enable static control flow prediction. Implied by -O.
Enable constant folding in Core. Implied by -O.
Turn on Constructed Product Result analysis. Implied by -O.
Turn on specialisation of overloaded functions imported from other modules.
Enable common sub-expression elimination. Implied by -O.
Make dictionary-valued expressions seem cheap to the optimiser.
Make dictionaries strict. Implied by -O2.
(deprecated) Use a special demand transformer for dictionary selectors.
default: 3. Boxity analysis pretends that returned records with this many fields can be unboxed.
Enable eta-reduction. Implied by -O.
Enable lambda eta-expansion. Always enabled by default.
Turn on eager blackholing
Switch on all rewrite rules (including rules generated by automatic specialisation of overloaded functions). Implied by -O.
Enable excess intermediate precision
Enables exitification optimisation. Implied by -O.
Expose all unfoldings, even for very large or recursive functions.
Turn on the float-in transformation. Implied by -O.
Turn on full laziness (floating bindings outwards). Implied by -O.
(deprecated) superseded by -ffull-laziness.
Ignore assertions in the source. Implied by -O.
Ignore pragmas in interface files. Implied by -O0 only.
Annotate methods of derived Generic and Generic1 instances with INLINE[1] pragmas based on heuristics. Implied by -O.
Annotate methods of all derived Generic and Generic1 instances with INLINE[1] pragmas.
Run demand analysis again, at the end of the simplification pipeline
Run a late specialisation pass
Turn on the liberate-case transformation. Implied by -O2.
default: 2000. Set the size threshold for the liberate-case transformation to ⟨n⟩
(deprecated) Does nothing
Enable local floating definitions out of let-binds.
Enable local floating to float top-level bindings
Turn saturated self-recursive tail-calls into local jumps in the generated assembly. Implied by -O.
default: 128. Set the maximum size of inline array allocations to ⟨n⟩ bytes (default: 128).
default: 32. Inline memcpy calls if they would generate no more than ⟨n⟩ pseudo instructions.
default: 32. Inline memset calls if they would generate no more than ⟨n⟩ pseudo instructions
default: 4. Set the max iterations for the simplifier.
default: 4. Set the maximum number of patterns to display in warnings about non-exhaustive ones.
default: 10. Maximum number of value arguments for a worker.
Turn off the coercion optimiser
Turn off pre-inlining
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.
Don't generate interface pragmas. Implied by -O0 only.
Omit heap checks when no allocation is being performed.
Use a slower but better algorithm for ApplicativeDo
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.
Allow specialisation to abstract over free type variables
Use the graph colouring register allocator for register allocation in the native code generator.
Use the iterative coalescing graph colouring register allocator in the native code generator.
default: 100. Set the percentage factor for simplifier ticks.
default: 2. Set the number of phases for the simplifier. Ignored with -O0.
When solving constraints, try to eagerly solve super classes using available dictionaries.
Turn on the SpecConstr transformation. Implied by -O2.
default: 3.* Set to ⟨n⟩ the maximum number of specialisations that will be created for any one function by the SpecConstr transformation.
Specialize a call with an explicit constructor argument, even if the argument is not scrutinised in the body of the function
default: 2000. Set the size threshold for the SpecConstr transformation to ⟨n⟩.
Turn on specialisation of overloaded functions. Implied by -O.
Turn on specialisation of overloaded functions regardless of size, if unfolding is available
Turn on the static argument transformation.
Enable common sub-expression elimination on the STG intermediate language
Enable late lambda lifting on the STG intermediate language. Implied by -O2.
Allow turning known into unknown calls while performing late lambda lifting.
Create top-level non-recursive functions with at most <n> parameters while performing late lambda lifting.
Create top-level recursive functions with at most <n> parameters while performing late lambda lifting.
Turn on demand analysis. Implied by -O. Implies -fworker-wrapper
Run an additional demand analysis before simplifier phase ⟨n⟩
Flatten strict constructor fields with a pointer-sized representation. Implied by -O.
Flatten strict constructor fields
default: 30. Apply a penalty of (inlining_cost * 1/n) for each level of case nesting.
default: 2. Reduce inlining for cases nested deeper than n.
default: 750. Tweak unfolding settings.
default: 30. Tweak unfolding settings.
default: 60. Tweak unfolding settings.
This has been deprecated in GHC 9.0.1.
default: 80. Tweak unfolding settings.
Enable the worker/wrapper transformation.
Enable w/w splits for wrappers whos sole purpose is evaluating arguments.

Optimization levels

Enable level 1 optimisations
Disable optimisations (default)
Enable level 2 optimisations
Any -On where n > 2 is the same as -O2.

Package options

Clear the package db stack.
Expose package ⟨pkg⟩ and set it to be distrusted. See Safe Haskell.
Distrust all packages by default. See Safe Haskell.
Enable Safe Haskell trusted package requirement for trustworthy modules.
Add the global package db to the stack.
Hide all packages by default
Hide package ⟨pkg⟩
Ignore package ⟨pkg⟩
Don't automatically link in the base and rts packages.
Remove the global package db from the stack.
Remove the user's package db from the stack.
Expose package ⟨pkg⟩
Add ⟨file⟩ to the package db stack.
Use the specified package environment.
Expose package by id ⟨unit-id⟩
Compile to be part of unit (i.e. package) ⟨unit-id⟩
Expose package ⟨pkg⟩ and set it to be trusted. See Safe Haskell.
Add the user's package db to the stack.

Phases of compilation

Merge a set of objects into a GHCi library.
Stop after generating C (.hc file)
Stop after generating object (.o) file
Stop after preprocessing (.hspp file)
Enable the use of a pre-processor (set with -pgmF ⟨cmd⟩)
Stop after generating assembly (.s file)
Override default behaviour for source files

Overriding external programs

Use ⟨cmd⟩ as the assembler
Use ⟨cmd⟩ as the C compiler
Use ⟨cmd⟩ as the C++ compiler
Use ⟨cmd⟩ as the DLL generator
Use ⟨cmd⟩ as the pre-processor (with -F only)
Use ⟨cmd⟩ as the external interpreter command.
Use ⟨cmd⟩ as the program to inject runpath into mach-o dylibs on macOS
Use ⟨cmd⟩ as the literate pre-processor
Use ⟨cmd⟩ as the linker
Use ⟨cmd⟩ as the LLVM compiler
Use ⟨cmd⟩ as the linker when merging object files
Use ⟨cmd⟩ as the LLVM optimiser
Use ⟨cmd⟩ as the program to inspect mach-o dylibs on macOS
Use ⟨cmd⟩ as the C pre-processor (with -cpp only)
Use ⟨cmd⟩ as the splitter
Use ⟨cmd⟩ as the program for embedding manifests on Windows.

Phase-specific options

pass ⟨option⟩ to the assembler
pass ⟨option⟩ to the C compiler
pass ⟨option⟩ to the C++ compiler
pass ⟨option⟩ to the DLL generator
pass ⟨option⟩ to the custom pre-processor
pass ⟨option⟩ to the interpreter sub-process.
pass ⟨option⟩ to the literate pre-processor
pass ⟨option⟩ to the linker
pass ⟨option⟩ to the LLVM compiler
pass ⟨option⟩ to the linker when merging object files.
pass ⟨option⟩ to the LLVM optimiser
pass ⟨option⟩ to cpp (with -cpp only)
pass ⟨option⟩ to windres.
(deprecated) Indicate that the linker supports -no-pie
Indicate that the linker supports -no-pie

Platform-specific options

(x86 only) Enable support for AVX SIMD extensions
(x86 only) Enable support for AVX2 SIMD extensions
(x86 only) Enable support for AVX512-CD SIMD extensions
(x86 only) Enable support for AVX512-ER SIMD extensions
(x86 only) Enable support for AVX512-F SIMD extensions
(x86 only) Enable support for AVX512-PF SIMD extensions
(x86 only) Use BMI1 for bit manipulation operations
(x86 only) Use BMI2 for bit manipulation operations
(x86 only) Use SSE for floating-point operations
(x86 only) Use SSE2 for floating-point operations
(x86 only) Use SSE3 for floating-point operations
(x86 only) Use SSE4 for floating-point operations
(x86 only) Use SSE4.2 for floating-point operations

Compiler plugins

Clear the list of active plugins
Load a pre-compiled static plugin from an external library
Give arguments to a plugin module; module must be specified with -fplugin=⟨module⟩
Trust the used plugins and no longer mark the compiled module as unsafe
Load a plugin exported by a given module
Hide all packages for plugins by default
Expose ⟨pkg⟩ for plugins
Expose ⟨pkg-id⟩ for plugins

Profiling

(deprecated) Alias for -fprof-auto-exported
(deprecated) Alias for -fprof-auto
(deprecated) Alias for -fprof-cafs
Do not collect entry counts
Auto-add SCC\ s to all bindings not marked INLINE
Auto-add SCC\ s to all call sites
Auto-add SCC\ s to all exported bindings not marked INLINE
Auto-add SCC\ s to all top-level bindings not marked INLINE
Auto-add SCC\ s to all CAFs
Auto-add SCC\ s to all call-sites of the named function.
Auto-add SCC\ s to all top level bindings after the core pipeline has run.
Auto-add SCC\ s to all top level bindings after the optimizer has run and retain them when inlining.
Process manual SCC annotations.
(deprecated) Alias for -fno-prof-auto
(deprecated) Alias for -fno-prof-auto
(deprecated) Alias for -fno-prof-cafs
Turn on profiling
Turn on ticky-ticky profiling
Track the number of times each closure type is allocated.
Don't use standard AP thunks on order to get more reliable entry counters.
Track allocations of dynamic thunks
Treat join point binders similar to thunks/functions.
Emit dummy ticky counters to record how many tag-inference checks tag inference avoided.

Program coverage

Turn on Haskell program coverage instrumentation
Set the directory where GHC places .mix files.

Recompilation checking

Regard ⟨file⟩ as "stable"; i.e., exclude it from having dependencies on it.
Turn off recompilation checking. This is implied by any -ddump-X option when compiling a single file (i.e. when using -c).
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.
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.
Include preprocessor dependencies
Regard modules imported from packages as unstable

Redirecting output

Use ⟨file⟩ as the makefile
Make dependencies that declare that files with suffix .⟨suf⟩⟨osuf⟩ depend on interface files with suffix .⟨suf⟩hi
redirect dump files
set the suffix to use for dynamic interface files
set dynamic output filename
set the filename in which to put the dynamic interface
set the dynamic output file suffix
set the suffix to use for intermediate C files
set directory for interface files
set directory for extended interface files
set the suffix to use for extended interface files
set the suffix to use for interface files
set output filename
set directory for object files
set the filename in which to put the interface
set the output file suffix
set output directory
redirect FFI stub files

Temporary files

set the directory for temporary files

Verbosity options

default: off. Toggles whether refinements where one or more of the holes are abstract are reported.
Defer and group diagnostic messages by severity
Use colors in error messages
Whether to show snippets of original source code
Output full span in error messages
hide module source and object paths
Continue compilation as far as possible on errors
default: 6. Set the maximum number of refinement hole fits for typed holes to display in type error messages.
default: 6. Set the maximum number of bindings to display in type error messages.
default: 6. Set the maximum number of valid hole fits for typed holes to display in type error messages.
Disables showing a list of valid hole fits for typed holes in type error messages.
Disables the sorting of the list of valid hole fits for typed holes in type error messages.
Display equation incompatibilities in closed type families
Distinguish between equality relations when printing
In type errors, also print type-synonym-expanded types.
Print coercions in types
Print explicit forall quantification in types. See also ExplicitForAll
Print explicit kind foralls and kind arguments in types. See also KindSignatures
Print RuntimeRep and Levity variables in types which are runtime-representation polymorphic.
display all available instances in type error messages
Print redundant DataKinds promotion ticks
Print extra information from typechecker.
Use unicode syntax when printing expressions, types and kinds. See also UnicodeSyntax
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.
Output errors in reverse order
Toggles whether to show the documentation of the valid hole fits in the output.
Whether to show textual information about error context
Show constraints when reporting typed holes.
Toggles whether to show the type of the additional holes in refinement hole fits.
Toggles whether to show the provenance of the valid hole fits in the output.
Toggles whether to show the type application of the valid hole fits in the output.
Toggles whether to show what type each quantified variable takes in a valid hole fit.
Toggles whether to show the type of the valid hole fits in the output.
Sort valid hole fits by size.
Sort valid hole fits by subsumption.
Unclutter the list of valid hole fits by not showing provenance nor type applications of suggestions.
Summarise timing stats for GHC (same as +RTS -tstderr).
verbose mode (equivalent to -v3)
set verbosity level

Warnings

Convert variable out of scope variables errors into warnings. Implied by -fdefer-type-errors. See also -Wdeferred-out-of-scope-variables.
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
Convert typed hole errors into warnings, deferring the error until runtime. Implied by -fdefer-type-errors. See also -Wtyped-holes.
Generate warnings for Template Haskell splices
Make suggestions for mis-spelled names.
soft limit on the number of parallel models the pattern match checker should check a pattern match clause against
show which group an emitted warning belongs to.
use the C code generator
enable normal warnings
disable all warnings
enable almost all warnings (details in Warnings and sanity-checking)
warn when specialisation of any overloaded function fails.
alias for -Wall-missed-specialisations
warn about ambiguous field selectors or updates
(deprecated) Does nothing
enable future compatibility warnings (details in Warnings and sanity-checking)
Report unqualified imports of core libraries which are expected to cause compatibility problems in future releases.
warn on uses of the #if directive on undefined identifiers
enable default flags
Report warnings when variable out-of-scope errors are deferred until runtime. See -fdefer-out-of-scope-variables.
Report warnings when deferred type errors are enabled. This option is enabled by default. See -fdefer-type-errors.
warn about uses of commandline flags that are deprecated
warn about uses of functions & types that have warnings or deprecated pragmas. Alias for -Wwarnings-deprecations
warn about default deriving when using both DeriveAnyClass and GeneralizedNewtypeDeriving
warn when Typeable is derived
warn about dodgy exports
warn about dodgy foreign imports
warn about dodgy imports
warn when a constraint appears duplicated in a type signature
warn when an entity is exported multiple times
warn about enumerations that are empty
make warnings fatal
enable all warnings supported by GHC
alias for -W
warn when forall is used as an identifier (at definition sites)
warn when pattern matching on a GADT without MonoLocalBinds
(deprecated) warn when a .hi file in the current directory shadows a library
warn about uses of Prelude numeric conversions that are probably the identity (and hence could be omitted)
(deprecated) warn when kind variables are implicitly quantified over.
warn about implicit lift in Template Haskell quotes
warn when the Prelude is implicitly imported
warn about inaccessible code
warn when a pattern match could fail
warn when a record update could fail
warn when a pattern match in a lambda expression, pattern binding or a lazy pattern could fail
warn when an explicitly Safe Haskell module imports a Safe-Inferred one
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.
warn when a Haddock comment occurs in an invalid position
warn when creating potentially-loopy superclass constraint evidence
warn about uses of file header pragmas in the module body
Warn when GHCi can't load a shared lib.
warn when specialisation of an imported, overloaded function fails.
alias for -Wmissed-specialisations
warn when a deriving clause is missing a deriving strategy
warn when a module declaration does not explicitly list all exports
warn about pattern synonyms without signatures, only if they are exported
warn about top-level functions without signatures, only if they are exported
(deprecated) warn about top-level functions without signatures, only if they are exported. takes precedence over -Wmissing-signatures
warn when fields of a record are uninitialised
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.
warn when an import declaration does not explicitly list all the names brought into scope
warn when type declarations don't have kind signatures nor CUSKs
warn about polymorphic local bindings without signatures
(deprecated) warn about polymorphic local bindings without signatures
warn when class methods are undefined
(deprecated) Warn when a failable pattern is used in a do-block that does not have a MonadFail instance.
warn when pattern synonyms do not have type signatures
warn when the Safe Haskell mode is not explicitly specified.
warn about top-level functions without signatures
(deprecated) Does nothing
warn when the Monomorphism Restriction is applied
warn when names are shadowed
Disables all warnings enabled by -Wcompat.
warn when Applicative or Monad instances have noncanonical definitions of return, pure, (>>), or (*>). See flag description in Warnings and sanity-checking for more details.
(deprecated) warn when Monad or MonadFail instances have noncanonical definitions of fail.
warn when Semigroup or Monoid instances have noncanonical definitions of (<>) or mappend. See flag description in Warnings and sanity-checking for more details.
(deprecated) Alias for -w
warn on prefix, suffix, and tight infix uses of infix operators
warn on uses of infix operators that would be parsed differently were a particular GHC extension enabled
warn when the module contains orphan instance declarations or rewrite rules
warn about literals that will overflow their type
warn about overlapping patterns
warn when defining a partial record field.
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.
Report imports with a leading/prepositive "qualified"
Warn about redundant bang patterns.
Have the compiler warn about redundant constraints in type signatures.
Warn about record wildcard matches when the wildcard binds no patterns.
Warn about redundant strictness flags.
warn if the module being compiled is regarded to be safe.
warn when a Monoid is not Semigroup, and on non- Semigroup definitions of (<>)?
Warn about class constraints in a type signature that can be simplified using a top-level instance declaration.
warn about binding the (*) type operator despite StarIsType
warn when * is used to mean Data.Kind.Type
warn if there are tabs in the source file
warn if the module being compiled is marked as Trustworthy but it could instead be marked as Safe, a more informative bound.
warn when defaulting happens
warn when type equality a ~ b is used despite being out of scope
warn when type equality a ~ b is used despite being out of scope
Report warnings when typed hole errors are deferred until runtime. See -fdefer-typed-holes.
warn on pattern bind of unlifted variable that is neither bare nor banged
warn about the usage of unicode bidirectional layout override characters
warn about uses of pragmas that GHC doesn't recognise
throw a warning when an unrecognised -W... flag is encountered on the command line.
warn if the module being compiled is regarded to be unsafe. See Safe Haskell
warn about use of an unsupported calling convention
Warn when using -fllvm with an unsupported version of LLVM.
warn if promoted constructors are not ticked
warn about bindings that are unused. Alias for -Wunused-top-binds, -Wunused-local-binds and -Wunused-pattern-binds
warn about do bindings that appear to throw away values of types other than ()
warn about type variables in user-written forall\s that are unused
warn about unnecessary imports
warn about local bindings that are unused
warn about variables in patterns that aren't used
warn when package is requested on command line, but not needed.
warn about pattern match bindings that are unused
Warn about record wildcard matches when none of the bound variables are used.
warn about top-level bindings that are unused
warn about unused type variables which arise from patterns in in type family and data family instances
make warnings non-fatal
warn about uses of functions & types that have warnings or deprecated pragmas
warn about do bindings that appear to throw away monadic values that you should have bound instead

COPYRIGHT

Copyright 2015. The University Court of the University of Glasgow. All rights reserved.

SEE ALSO

https://www.haskell.org/ghc the GHC homepage

AUTHOR

The GHC Team

COPYRIGHT

2024, GHC Team

August 26, 2024 9.6.6