GHC

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 and HTML; see below.

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:

dyn
dynamically-linked
p
built with profiling
.⟨way⟩_hi
interface files for “way” ⟨way⟩; common ways are:

Options

Code generation
-dynamic-too -fasm -fbyte-code -fexternal-dynamic-refs -fllvm -fno-code -fobject-code -fPIC -fPIE -fwrite-interface
Debugging the compiler
-dcmm-lint -dcore-lint -ddump-asm -ddump-asm-expanded -ddump-asm-liveness -ddump-asm-native -ddump-asm-regalloc -ddump-asm-regalloc-stages -ddump-asm-stats -ddump-bcos -ddump-cmm -ddump-cmm-caf -ddump-cmm-cbe -ddump-cmm-cfg -ddump-cmm-cps -ddump-cmm-from-stg -ddump-cmm-info -ddump-cmm-proc -ddump-cmm-procmap -ddump-cmm-raw -ddump-cmm-sink -ddump-cmm-sp -ddump-cmm-split -ddump-cmm-switch -ddump-cmm-verbose -ddump-core-stats -ddump-cse -ddump-deriv -ddump-ds -ddump-ds-preopt -ddump-ec-trace -ddump-foreign -ddump-if-trace -ddump-inlinings -ddump-json -ddump-llvm -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-rule-firings -ddump-rule-rewrites -ddump-rules -ddump-simpl -ddump-simpl-iterations -ddump-simpl-stats -ddump-spec -ddump-splices -ddump-stg -ddump-str-signatures -ddump-stranal -ddump-tc -ddump-tc-ast -ddump-tc-trace -ddump-timings -ddump-to-file -ddump-types -ddump-worker-wrapper -dfaststring-stats -dhex-word-literals -dinitial-unique=⟨s⟩ -dinline-check=⟨str⟩ -dno-debug-output -dppr-case-as-let -dppr-cols=⟨n⟩ -dppr-debug -dppr-user-length -drule-check=⟨str⟩ -dshow-passes -dstg-lint -dsuppress-all -dsuppress-coercions -dsuppress-idinfo -dsuppress-module-prefixes -dsuppress-stg-free-vars -dsuppress-ticks -dsuppress-timestamps -dsuppress-type-applications -dsuppress-type-signatures -dsuppress-unfoldings -dsuppress-uniques -dsuppress-var-kinds -dth-dec-file -dunique-increment=⟨i⟩ -dverbose-core2core -dverbose-stg2stg -falignment-sanitisation -fcatch-bottoms -fllvm-fill-undef-with-garbage -fproc-alignment -g -g⟨n⟩
C pre-processor
-cpp -D⟨symbol⟩[=⟨value⟩] -I⟨dir⟩ -U⟨symbol⟩
Finding imports
-i -i⟨dir⟩[:⟨dir⟩]*
Interactive mode
-fbreak-on-error -fbreak-on-exception -fghci-hist-size=⟨n⟩ -fghci-leak-check -flocal-ghci-history -fno-it -fprint-bind-result -fshow-loaded-modules -ghci-script -ignore-dot-ghci -interactive-print ⟨expr⟩
Interface files
--show-iface ⟨file⟩ -ddump-hi -ddump-hi-diffs -ddump-minimal-imports
Keeping intermediate files
-keep-hc-file -keep-hc-files -keep-hi-files -keep-llvm-file -keep-llvm-files -keep-o-files -keep-s-file -keep-s-files -keep-tmp-files
Language options
-fsort-by-size-hole-fits -fsort-by-subsumption-hole-fits -XAllowAmbiguousTypes -XApplicativeDo -XArrows -XBangPatterns -XBinaryLiterals -XBlockArguments -XCApiFFI -XConstrainedClassMethods -XConstraintKinds -XCPP -XDataKinds -XDatatypeContexts -XDefaultSignatures -XDeriveAnyClass -XDeriveDataTypeable -XDeriveFoldable -XDeriveFunctor -XDeriveGeneric -XDeriveLift -XDeriveTraversable -XDerivingStrategies -XDerivingVia -XDisambiguateRecordFields -XDuplicateRecordFields -XEmptyCase -XEmptyDataDecls -XEmptyDataDeriving -XExistentialQuantification -XExplicitForAll -XExplicitNamespaces -XExtendedDefaultRules -XFlexibleContexts -XFlexibleInstances -XForeignFunctionInterface -XFunctionalDependencies -XGADTs -XGADTSyntax -XGeneralisedNewtypeDeriving -XGeneralizedNewtypeDeriving -XHexFloatLiterals -XImplicitParams -XImpredicativeTypes -XIncoherentInstances -XInstanceSigs -XInterruptibleFFI -XKindSignatures -XLambdaCase -XLiberalTypeSynonyms -XMagicHash -XMonadComprehensions -XMonadFailDesugaring -XMonoLocalBinds -XMultiParamTypeClasses -XMultiWayIf -XNamedFieldPuns -XNamedWildCards -XNegativeLiterals -XNoImplicitPrelude -XNoMonomorphismRestriction -XNoPatternGuards -XNoTraditionalRecordSyntax -XNPlusKPatterns -XNullaryTypeClasses -XNumDecimals -XNumericUnderscores -XOverlappingInstances -XOverloadedLabels -XOverloadedLists -XOverloadedStrings -XPackageImports -XParallelListComp -XPartialTypeSignatures -XPatternSynonyms -XPolyKinds -XPostfixOperators -XQuantifiedConstraints -XQuasiQuotes -XRank2Types -XRankNTypes -XRebindableSyntax -XRecordWildCards -XRecursiveDo -XRoleAnnotations -XSafe -XScopedTypeVariables -XStandaloneDeriving -XStarIsType -XStaticPointers -XStrict -XStrictData -XTemplateHaskell -XTemplateHaskellQuotes -XTransformListComp -XTrustworthy -XTupleSections -XTypeApplications -XTypeFamilies -XTypeFamilyDependencies -XTypeInType -XTypeOperators -XTypeSynonymInstances -XUnboxedSums -XUnboxedTuples -XUndecidableInstances -XUndecidableSuperClasses -XUnicodeSyntax -XUnsafe -XViewPatterns
Linking options
-c -debug -dylib-install-name ⟨path⟩ -dynamic -dynload -eventlog -fno-embed-manifest -fno-gen-manifest -fno-shared-implib -framework ⟨name⟩ -framework-path ⟨dir⟩ -fwhole-archive-hs-libs -L ⟨dir⟩ -l ⟨lib⟩ -main-is ⟨thing⟩ -no-hs-main -no-rtsopts-suggestions -package ⟨name⟩ -pie -rdynamic -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩] -shared -split-objs -split-sections -static -staticlib -threaded -with-rtsopts=⟨opts⟩
Miscellaneous options
-fexternal-interpreter -fglasgow-exts -ghcversion-file ⟨path to ghcversion.h⟩ -H ⟨size⟩ -j[⟨n⟩]
Modes of operation
--frontend ⟨module⟩ --help -? --info --interactive --make --mk-dll --numeric-version --print-libdir --show-iface ⟨file⟩ --show-options --supported-extensions --supported-languages --version -V -e ⟨expr⟩ -M
Individual optimizations
-fasm-shortcutting -fcall-arity -fcase-folding -fcase-merge -fcmm-elim-common-blocks -fcmm-sink -fcpr-anal -fcross-module-specialise -fcse -fdicts-cheap -fdicts-strict -fdmd-tx-dict-sel -fdo-eta-reduction -fdo-lambda-eta-expansion -feager-blackholing -fenable-rewrite-rules -fexcess-precision -fexitification -fexpose-all-unfoldings -ffloat-in -ffull-laziness -ffun-to-thunk -fignore-asserts -fignore-interface-pragmas -flate-dmd-anal -flate-specialise -fliberate-case -fliberate-case-threshold=⟨n⟩ -fllvm-pass-vectors-in-regs -floopification -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 -fomit-yields -foptimal-applicative-do -fpedantic-bottoms -fregs-graph -fregs-iterative -fsimpl-tick-factor=⟨n⟩ -fsimplifier-phases=⟨n⟩ -fsolve-constant-dicts -fspec-constr -fspec-constr-count=⟨n⟩ -fspec-constr-keen -fspec-constr-threshold=⟨n⟩ -fspecialise -fspecialise-aggressively -fstatic-argument-transformation -fstg-cse -fstrictness -fstrictness-before=⟨n⟩ -funbox-small-strict-fields -funbox-strict-fields -funfolding-creation-threshold=⟨n⟩ -funfolding-dict-discount=⟨n⟩ -funfolding-fun-discount=⟨n⟩ -funfolding-keeness-factor=⟨n⟩ -funfolding-use-threshold=⟨n⟩
Optimization levels
-O -O1 -O0 -O2
Package options
-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
Phases of compilation
-C -c -E -F -S -x ⟨suffix⟩
Overriding external programs
-pgma ⟨cmd⟩ -pgmc ⟨cmd⟩ -pgmdll ⟨cmd⟩ -pgmF ⟨cmd⟩ -pgmi ⟨cmd⟩ -pgmL ⟨cmd⟩ -pgml ⟨cmd⟩ -pgmlc ⟨cmd⟩ -pgmlibtool ⟨cmd⟩ -pgmlo ⟨cmd⟩ -pgmP ⟨cmd⟩ -pgms ⟨cmd⟩ -pgmwindres ⟨cmd⟩
Phase-specific options
-opta ⟨option⟩ -optc ⟨option⟩ -optdll ⟨option⟩ -optF ⟨option⟩ -opti ⟨option⟩ -optL ⟨option⟩ -optl ⟨option⟩ -optlc ⟨option⟩ -optlo ⟨option⟩ -optP ⟨option⟩ -optwindres ⟨option⟩
Platform-specific options
-msse2 -msse4.2
Compiler plugins
-fplugin-opt=⟨module⟩:⟨args⟩ -fplugin=⟨module⟩ -hide-all-plugin-packages -plugin-package ⟨pkg⟩ -plugin-package-id ⟨pkg-id⟩
Profiling
-fno-prof-auto -fno-prof-cafs -fno-prof-count-entries -fprof-auto -fprof-auto-calls -fprof-auto-exported -fprof-auto-top -fprof-cafs -prof -ticky
Program coverage
-fhpc
Recompilation checking
-fforce-recomp -fignore-hpc-changes -fignore-optim-changes
Redirecting output
--exclude-module=⟨file⟩ -ddump-mod-cycles -dep-makefile ⟨file⟩ -dep-suffix ⟨suffix⟩ -dumpdir ⟨dir⟩ -hcsuf ⟨suffix⟩ -hidir ⟨dir⟩ -hisuf ⟨suffix⟩ -include-pkg-deps -o ⟨file⟩ -odir ⟨dir⟩ -ohi ⟨file⟩ -osuf ⟨suffix⟩ -outputdir ⟨dir⟩ -stubdir ⟨dir⟩
Temporary files
-tmpdir ⟨dir⟩
Verbosity options
-fabstract-refinement-hole-fits -fdiagnostics-color=⟨always|auto|never⟩ -fdiagnostics-show-caret -ferror-spans -fhide-source-paths -fmax-refinement-hole-fits=⟨n⟩ -fmax-relevant-binds=⟨n⟩ -fmax-valid-hole-fits=⟨n⟩ -fno-show-valid-hole-fits -fno-sort-valid-hole-fits -fprint-equality-relations -fprint-expanded-synonyms -fprint-explicit-coercions -fprint-explicit-foralls -fprint-explicit-kinds -fprint-explicit-runtime-reps -fprint-explicit-runtime-reps -fprint-potential-instances -fprint-typechecker-elaboration -fprint-unicode-syntax -frefinement-level-hole-fits=⟨n⟩ -fshow-hole-constraints -fshow-hole-matches-of-hole-fits -fshow-provenance-of-hole-fits -fshow-type-app-of-hole-fits -fshow-type-app-vars-of-hole-fits -fshow-type-of-hole-fits -funclutter-valid-hole-fits -Rghc-timing -v -v⟨n⟩
Warnings
-fdefer-out-of-scope-variables -fdefer-type-errors -fdefer-typed-holes -fhelpful-errors -fmax-pmcheck-iterations=⟨n⟩ -fshow-warning-groups -W -w -Wall -Wall-missed-specialisations -Wamp -Wcompat -Wcpp-undef -Wdeferred-out-of-scope-variables -Wdeferred-type-errors -Wdeprecated-flags -Wdeprecations -Wdodgy-exports -Wdodgy-foreign-imports -Wdodgy-imports -Wduplicate-constraints -Wduplicate-exports -Wempty-enumerations -Werror -Weverything -Whi-shadowing -Widentities -Wimplicit-kind-vars -Wimplicit-prelude -Winaccessible-code -Wincomplete-patterns -Wincomplete-record-updates -Wincomplete-uni-patterns -Winline-rule-shadowing -Wmissed-specialisations -Wmissing-export-lists -Wmissing-exported-signatures -Wmissing-exported-sigs -Wmissing-fields -Wmissing-home-modules -Wmissing-import-lists -Wmissing-local-signatures -Wmissing-local-sigs -Wmissing-methods -Wmissing-monadfail-instances -Wmissing-pattern-synonym-signatures -Wmissing-signatures -Wmonomorphism-restriction -Wname-shadowing -Wno-compat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances -Worphans -Woverflowed-literals -Woverlapping-patterns -Wpartial-fields -Wpartial-type-signatures -Wredundant-constraints -Wsafe -Wsemigroup -Wsimplifiable-class-constraints -Wstar-binder -Wstar-is-type -Wtabs -Wtrustworthy-safe -Wtype-defaults -Wtyped-holes -Wunbanged-strict-patterns -Wunrecognised-pragmas -Wunrecognised-warning-flags -Wunsafe -Wunsupported-calling-conventions -Wunsupported-llvm-version -Wunticked-promoted-constructors -Wunused-binds -Wunused-do-bind -Wunused-foralls -Wunused-imports -Wunused-local-binds -Wunused-matches -Wunused-pattern-binds -Wunused-top-binds -Wunused-type-patterns -Wwarn -Wwarnings-deprecations -Wwrong-do-bind

Code generation

-dynamic-too

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

-fasm

Use the native code generator

-fbyte-code

Generate byte-code

-fexternal-dynamic-refs

Generate code for linking against dynamic libraries

-fllvm

Compile using the LLVM code generator

-fno-code

Omit code generation

-fobject-code

Generate object code

-fPIC

Generate position-independent code (where available)

-fPIE

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

-fwrite-interface

Always write interface files

Debugging the compiler

-dcmm-lint

C-\- pass sanity checking

-dcore-lint

Turn on internal sanity checking

-ddump-asm

Dump final assembly

-ddump-asm-expanded

Dump the result of the synthetic instruction expansion pass.

-ddump-asm-liveness

Dump assembly augmented with register liveness

-ddump-asm-native

Dump initial assembly

-ddump-asm-regalloc

Dump the result of register allocation

-ddump-asm-regalloc-stages

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

-ddump-asm-stats

Dump statistics from the register allocator.

-ddump-bcos

Dump interpreter byte code

-ddump-cmm

Dump the final C-\- output

-ddump-cmm-caf

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

-ddump-cmm-cbe

Dump the results of common block elimination

-ddump-cmm-cfg

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

-ddump-cmm-cps

Dump the results of the CPS pass

-ddump-cmm-from-stg

Dump STG-to-C-\- output

-ddump-cmm-info

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

-ddump-cmm-proc

Dump the results of proc-point analysis

-ddump-cmm-procmap

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

-ddump-cmm-raw

Dump raw C-\-

-ddump-cmm-sink

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

-ddump-cmm-sp

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

-ddump-cmm-split

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

-ddump-cmm-switch

Dump the results of switch lowering passes

-ddump-cmm-verbose

Show output from each C-\- pipeline pass

-ddump-core-stats

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

-ddump-cse

Dump CSE output

-ddump-deriv

Dump deriving output

-ddump-ds -ddump-ds-preopt

Dump desugarer output.

-ddump-ec-trace

Trace exhaustiveness checker

-ddump-foreign

Dump foreign export stubs

-ddump-if-trace

Trace interface files

-ddump-inlinings

Dump inlining info

-ddump-json

Dump error messages as JSON documents

-ddump-llvm

Dump LLVM intermediate code.

-ddump-occur-anal

Dump occurrence analysis output

-ddump-opt-cmm

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

-ddump-parsed

Dump parse tree

-ddump-parsed-ast

Dump parser output as a syntax tree

-ddump-prep

Dump prepared core

-ddump-rn

Dump renamer output

-ddump-rn-ast

Dump renamer output as a syntax tree

-ddump-rn-stats

Renamer stats

-ddump-rn-trace

Trace renamer

-ddump-rule-firings

Dump rule firing info

-ddump-rule-rewrites

Dump detailed rule firing info

-ddump-rules

Dump rewrite rules

-ddump-simpl

Dump final simplifier output

-ddump-simpl-iterations

Dump output from each simplifier iteration

-ddump-simpl-stats

Dump simplifier stats

-ddump-spec

Dump specialiser output

-ddump-splices

Dump TH spliced expressions, and what they evaluate to

-ddump-stg

Dump final STG

-ddump-str-signatures

Dump strictness signatures

-ddump-stranal

Dump strictness analyser output

-ddump-tc

Dump typechecker output

-ddump-tc-ast

Dump typechecker output as a syntax tree

-ddump-tc-trace

Trace typechecker

-ddump-timings

Dump per-pass timing and allocation statistics

-ddump-to-file

Dump to files instead of stdout

-ddump-types

Dump type signatures

-ddump-worker-wrapper

Dump worker-wrapper output

-dfaststring-stats

Show statistics for fast string usage when finished

-dhex-word-literals

Print values of type Word# in hexadecimal.

-dinitial-unique=⟨s⟩

Start UniqSupply allocation from ⟨s⟩.

-dinline-check=⟨str⟩

Dump information about inlining decisions

-dno-debug-output

Suppress unsolicited debugging output

-dppr-case-as-let

Print single alternative case expressions as strict lets.

-dppr-cols=⟨n⟩

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

-dppr-debug

Turn on debug printing (more verbose)

-dppr-user-length

Set the depth for printing expressions in error msgs

-drule-check=⟨str⟩

Dump information about potential rule application

-dshow-passes

Print out each pass name as it happens

-dstg-lint

STG pass sanity checking

-dsuppress-all

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

-dsuppress-coercions

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

-dsuppress-idinfo

Suppress extended information about identifiers where they are bound

-dsuppress-module-prefixes

Suppress the printing of module qualification prefixes

-dsuppress-stg-free-vars

Suppress the printing of closure free variable lists in STG output

-dsuppress-ticks

Suppress “ticks” in the pretty-printer output.

-dsuppress-timestamps

Suppress timestamps in dumps

-dsuppress-type-applications

Suppress type applications

-dsuppress-type-signatures

Suppress type signatures

-dsuppress-unfoldings

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

-dsuppress-uniques

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

-dsuppress-var-kinds

Suppress the printing of variable kinds

-dth-dec-file

Dump evaluated TH declarations into *.th.hs files

-dunique-increment=⟨i⟩

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

-dverbose-core2core

Show output from each core-to-core pass

-dverbose-stg2stg

Show output from each STG-to-STG pass

-falignment-sanitisation

Compile with alignment checks for all info table dereferences.

-fcatch-bottoms

Insert error expressions after bottoming expressions; useful when debugging the compiler.

-fllvm-fill-undef-with-garbage

Intruct LLVM to fill dead STG registers with garbage

-fproc-alignment

Align functions at given boundary.

-g

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

-cpp

Run the C pre-processor on Haskell source files

-D⟨symbol⟩[=⟨value⟩]

Define a symbol in the C pre-processor

-I⟨dir⟩

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

-U⟨symbol⟩

Undefine a symbol in the C pre-processor

Finding imports

-i

Empty the import directory list

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

add ⟨dir⟩, ⟨dir2⟩, etc. to import path

Interactive mode

-fbreak-on-error

Break on uncaught exceptions and errors

-fbreak-on-exception

Break on any exception thrown

-fghci-hist-size=⟨n⟩

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

-fghci-leak-check

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

-flocal-ghci-history

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

-fno-it

No longer set the special variable it.

-fprint-bind-result

Turn on printing of binding results in GHCi

-fshow-loaded-modules

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

-ghci-script

Read additional .ghci files

-ignore-dot-ghci

Disable reading of .ghci files

-interactive-print ⟨expr⟩

Select the function to use for printing evaluated expressions in GHCi

Interface files

--show-iface ⟨file⟩

See Modes of operation.

-ddump-hi

Dump the new interface to stdout

-ddump-hi-diffs

Show the differences vs. the old interface

-ddump-minimal-imports

Dump a minimal set of imports

Keeping intermediate files

-keep-hc-file

Retain intermediate .hc files.

-keep-hi-files

Retain intermediate .hi files (the default).

-keep-llvm-file

Retain intermediate LLVM .ll files. Implies -fllvm.

-keep-o-files

Retain intermediate .o files (the default).

-keep-s-file

Retain intermediate .s files.

-keep-tmp-files

Retain all intermediate temporary files.

Language options

-fsort-by-size-hole-fits
Sort valid hole fits by size.
-fsort-by-subsumption-hole-fits
Sort valid hole fits by subsumption.
-XAllowAmbiguousTypes
Allow the user to write ambiguous types, and the type inference engine to infer them.
-XApplicativeDo
Enable Applicative do-notation desugaring
-XArrows
Enable arrow notation extension
-XBangPatterns
Enable bang patterns.
-XBinaryLiterals
Enable support for binary literals.
-XBlockArguments
Allow do blocks and other constructs as function arguments.
-XCApiFFI
Enable the CAPI calling convention.
-XConstrainedClassMethods
Enable constrained class methods.
-XConstraintKinds
Enable a kind of constraints.
-XCPP
Enable the C preprocessor.
-XDataKinds
Enable datatype promotion.
-XDatatypeContexts
Allow contexts on data types.
-XDefaultSignatures
Enable default signatures.
-XDeriveAnyClass
Enable deriving for any class.
-XDeriveDataTypeable
Enable deriving for the Data class. Implied by AutoDeriveTypeable.
-XDeriveFoldable
Enable deriving for the Foldable class. Implied by DeriveTraversable.
-XDeriveFunctor
Enable deriving for the Functor class. Implied by DeriveTraversable.
-XDeriveGeneric
Enable deriving for the Generic class.
-XDeriveLift
Enable deriving for the Lift class
-XDeriveTraversable
Enable deriving for the Traversable class. Implies DeriveFunctor and DeriveFoldable.
-XDerivingStrategies
Enables deriving strategies.
-XDerivingVia
Enable deriving instances via types of the same runtime representation. Implies DerivingStrategies.
-XDisambiguateRecordFields
Enable record field disambiguation. Implied by RecordWildCards.
-XDuplicateRecordFields
Allow definition of record types with identically-named fields.
-XEmptyCase
Allow empty case alternatives.
-XEmptyDataDecls
Allow definition of empty data types.
-XEmptyDataDeriving
Allow deriving instances of standard type classes for empty data types.
-XExistentialQuantification
Enable liberalised type synonyms.
-XExplicitForAll
Enable explicit universal quantification. Implied by ScopedTypeVariables, LiberalTypeSynonyms, RankNTypes and ExistentialQuantification.
-XExplicitNamespaces
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.
-XExtendedDefaultRules
Use GHCi’s extended default rules in a normal module.
-XFlexibleContexts
Enable flexible contexts. Implied by ImplicitParams.
-XFlexibleInstances
Enable flexible instances. Implies TypeSynonymInstances. Implied by ImplicitParams.
-XForeignFunctionInterface
Enable foreign function interface.
-XFunctionalDependencies
Enable functional dependencies. Implies MultiParamTypeClasses.
-XGADTs
Enable generalised algebraic data types. Implies GADTSyntax and MonoLocalBinds.
-XGADTSyntax
Enable generalised algebraic data type syntax.
-XGeneralisedNewtypeDeriving
Enable newtype deriving.
-XGeneralizedNewtypeDeriving
Enable newtype deriving.
-XHexFloatLiterals
Enable support for hexadecimal floating point literals.
-XImplicitParams
Enable Implicit Parameters. Implies FlexibleContexts and FlexibleInstances.
-XImpredicativeTypes
Enable impredicative types. Implies RankNTypes.
-XIncoherentInstances
Enable incoherent instances. Implies OverlappingInstances.
-XInstanceSigs
Enable instance signatures.
-XInterruptibleFFI
Enable interruptible FFI.
-XKindSignatures
Enable kind signatures. Implied by TypeFamilies and PolyKinds.
-XLambdaCase
Enable lambda-case expressions.
-XLiberalTypeSynonyms
Enable liberalised type synonyms.
-XMagicHash
Allow # as a postfix modifier on identifiers.
-XMonadComprehensions
Enable monad comprehensions.
-XMonadFailDesugaring
Enable monadfail desugaring.
-XMonoLocalBinds
Enable do not generalise local bindings. Implied by TypeFamilies and GADTs.
-XMultiParamTypeClasses
Enable multi parameter type classes. Implied by FunctionalDependencies.
-XMultiWayIf
Enable multi-way if-expressions.
-XNamedFieldPuns
Enable record puns.
-XNamedWildCards
Enable named wildcards.
-XNegativeLiterals
Enable support for negative literals.
-XNoImplicitPrelude
Don’t implicitly import Prelude. Implied by RebindableSyntax.
-XNoMonomorphismRestriction
Disable the monomorphism restriction.
-XNoPatternGuards
Disable pattern guards. Implied by Haskell98.
-XNoTraditionalRecordSyntax
Disable support for traditional record syntax (as supported by Haskell 98) C {f = x}
-XNPlusKPatterns
Enable support for n+k patterns. Implied by Haskell98.
-XNullaryTypeClasses
Deprecated, does nothing. nullary (no parameter) type classes are now enabled using MultiParamTypeClasses.
-XNumDecimals
Enable support for ‘fractional’ integer literals.
-XNumericUnderscores
Enable support for numeric underscores.
-XOverlappingInstances
Enable overlapping instances.
-XOverloadedLabels
Enable overloaded labels.
-XOverloadedLists
Enable overloaded lists.
-XOverloadedStrings
Enable overloaded string literals.
-XPackageImports
Enable package-qualified imports.
-XParallelListComp
Enable parallel list comprehensions.
-XPartialTypeSignatures
Enable partial type signatures.
-XPatternSynonyms
Enable pattern synonyms.
-XPolyKinds
Enable kind polymorphism. Implies KindSignatures.
-XPostfixOperators
Enable postfix operators.
-XQuantifiedConstraints
Allow forall quantifiers in constraints.
-XQuasiQuotes
Enable quasiquotation.
-XRank2Types
Enable rank-2 types. Synonym for RankNTypes.
-XRankNTypes
Enable rank-N types. Implied by ImpredicativeTypes.
-XRebindableSyntax
Employ rebindable syntax. Implies NoImplicitPrelude.
-XRecordWildCards
Enable record wildcards. Implies DisambiguateRecordFields.
-XRecursiveDo
Enable recursive do (mdo) notation.
-XRoleAnnotations
Enable role annotations.
-XSafe
Enable the Safe Haskell Safe mode.
-XScopedTypeVariables
Enable lexically-scoped type variables.
-XStandaloneDeriving
Enable standalone deriving.
-XStarIsType
Treat * as Data.Kind.Type.
-XStaticPointers
Enable static pointers.
-XStrict
Make bindings in the current module strict by default.
-XStrictData
Enable default strict datatype fields.
-XTemplateHaskell
Enable Template Haskell.
-XTemplateHaskellQuotes
Enable quotation subset of Template Haskell.
-XTransformListComp
Enable generalised list comprehensions.
-XTrustworthy
Enable the Safe Haskell Trustworthy mode.
-XTupleSections
Enable tuple sections.
-XTypeApplications
Enable type application syntax.
-XTypeFamilies
Enable type families. Implies ExplicitNamespaces, KindSignatures, and MonoLocalBinds.
-XTypeFamilyDependencies
Enable injective type families. Implies TypeFamilies.
-XTypeInType
Deprecated. Enable kind polymorphism and datatype promotion.
-XTypeOperators
Enable type operators. Implies ExplicitNamespaces.
-XTypeSynonymInstances
Enable type synonyms in instance heads. Implied by FlexibleInstances.
-XUnboxedSums
Enable unboxed sums.
-XUnboxedTuples
Enable the use of unboxed tuple syntax.
-XUndecidableInstances
Enable undecidable instances.
-XUndecidableSuperClasses
Allow all superclass constraints, including those that may result in non-termination of the typechecker.
-XUnicodeSyntax
Enable unicode syntax.
-XUnsafe
Enable Safe Haskell Unsafe mode.
-XViewPatterns
Enable view patterns.

Linking options

-c

Stop after generating object (.o) file

-debug

Use the debugging runtime

-dylib-install-name ⟨path⟩

Set the install name (via -install_name passed to Apple’s linker), specifying the full install path of the library file. Any libraries or executables that link with it later will pick up that path as their runtime search location for it. (Darwin/OS X only)

-dynamic

Build dynamically-linked object files and executables

-dynload

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

-eventlog

Enable runtime event tracing

-fno-embed-manifest

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

-fno-gen-manifest

Do not generate a manifest file (Windows only)

-fno-shared-implib

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

-framework ⟨name⟩

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

-framework-path ⟨dir⟩

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

-fwhole-archive-hs-libs

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

-L ⟨dir⟩

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

-l ⟨lib⟩

Link in library ⟨lib⟩

-main-is ⟨thing⟩

Set main module and function

-no-hs-main

Don’t assume this program contains main

-no-rtsopts-suggestions

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

-package ⟨name⟩

Expose package ⟨pkg⟩

-pie

Instruct the linker to produce a position-independent executable.

-rdynamic

This instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. Currently Linux and Windows/MinGW32 only. This is equivalent to using -optl -rdynamic on Linux, and -optl -export-all-symbols on Windows.

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

Control whether the RTS behaviour can be tweaked via command-line flags and the GHCRTS environment variable. Using none means no RTS flags can be given; some means only a minimum of safe options can be given (the default); 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.

-shared

Generate a shared library (as opposed to an executable)

-split-objs

Split objects (for libraries)

-split-sections

Split sections for link-time dead-code stripping

-static

Use static Haskell libraries

-staticlib

Generate a standalone static library (as opposed to an executable). This is useful when cross compiling. The library together with all its dependencies ends up in in a single static library that can be linked against.

-threaded

Use the threaded runtime

-with-rtsopts=⟨opts⟩

Set the default RTS options to ⟨opts⟩.

Miscellaneous options

-fexternal-interpreter

Run interpreted code in a separate process

-fglasgow-exts

Deprecated. Enable most language extensions; see Language options for exactly which ones.

-ghcversion-file ⟨path to ghcversion.h⟩

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

-H ⟨size⟩

Set the minimum size of the heap to ⟨size⟩

-j[⟨n⟩]

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

Modes of operation

--frontend ⟨module⟩

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

--help

Display help

--info

display information about the compiler

--interactive

Interactive mode - normally used by just running ghci; see Using GHCi for details.

--make

Build a multi-module Haskell program, automatically figuring out dependencies. Likely to be much easier, and faster, than using make; see Using ghc –make for details.

--mk-dll

DLL-creation mode (Windows only)

--numeric-version

display GHC version (numeric only)

--print-libdir

display GHC library directory

--show-iface ⟨file⟩

display the contents of an interface file.

--show-options

display the supported command line options

--supported-extensions

display the supported language extensions

--version

display GHC version

-e ⟨expr⟩

Evaluate expr; see Expression evaluation mode for details.

-M

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

Individual optimizations

-fasm-shortcutting

Enable shortcutting on assembly. Implied by -O2.

-fcall-arity

Enable call-arity optimisation. Implied by -O.

-fcase-folding

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

-fcase-merge

Enable case-merging. Implied by -O.

-fcmm-elim-common-blocks

Enable Cmm common block elimination. Implied by -O.

-fcmm-sink

Enable Cmm sinking. Implied by -O.

-fcpr-anal

Turn on CPR analysis in the demand analyser. Implied by -O.

-fcross-module-specialise

Turn on specialisation of overloaded functions imported from other modules.

-fcse

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

-fdicts-cheap

Make dictionary-valued expressions seem cheap to the optimiser.

-fdicts-strict

Make dictionaries strict

-fdmd-tx-dict-sel

Use a special demand transformer for dictionary selectors. Always enabled by default.

-fdo-eta-reduction

Enable eta-reduction. Implied by -O.

-fdo-lambda-eta-expansion

Enable lambda eta-expansion. Always enabled by default.

-feager-blackholing

Turn on eager blackholing

-fenable-rewrite-rules

Switch on all rewrite rules (including rules generated by automatic specialisation of overloaded functions). Implied by -O.

-fexcess-precision

Enable excess intermediate precision

-fexitification

Enables exitification optimisation. Implied by -O.

-fexpose-all-unfoldings

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

-ffloat-in

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

-ffull-laziness

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

-ffun-to-thunk

Allow worker-wrapper to convert a function closure into a thunk if the function does not use any of its arguments. Off by default.

-fignore-asserts

Ignore assertions in the source. Implied by -O.

-fignore-interface-pragmas

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

-flate-dmd-anal

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

-flate-specialise

Run a late specialisation pass

-fliberate-case

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

-fliberate-case-threshold=⟨n⟩

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

-fllvm-pass-vectors-in-regs

Pass vector value in vector registers for function calls

-floopification

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

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

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

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

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

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

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

-fmax-simplifier-iterations=⟨n⟩

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

-fmax-uncovered-patterns=⟨n⟩

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

-fmax-worker-args=⟨n⟩

default: 10. If a worker has that many arguments, none will be unpacked anymore.

-fno-opt-coercion

Turn off the coercion optimiser

-fno-pre-inlining

Turn off pre-inlining

-fno-state-hack

Turn off the state hackwhereby any lambda with a real-world state token as argument is considered to be single-entry. Hence OK to inline things inside it.

-fomit-interface-pragmas

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

-fomit-yields

Omit heap checks when no allocation is being performed.

-foptimal-applicative-do

Use a slower but better algorithm for ApplicativeDo

-fpedantic-bottoms

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

-fregs-graph

Use the graph colouring register allocator for register allocation in the native code generator. Implied by -O2.

-fregs-iterative

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

-fsimpl-tick-factor=⟨n⟩

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

-fsimplifier-phases=⟨n⟩

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

-fsolve-constant-dicts

When solving constraints, try to eagerly solve super classes using available dictionaries.

-fspec-constr

Turn on the SpecConstr transformation. Implied by -O2.

-fspec-constr-count=⟨n⟩

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

-fspec-constr-keen

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

-fspec-constr-threshold=⟨n⟩

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

-fspecialise

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

-fspecialise-aggressively

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

-fstatic-argument-transformation

Turn on the static argument transformation.

-fstg-cse

Enable common sub-expression elimination on the STG intermediate language

-fstrictness

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

-fstrictness-before=⟨n⟩

Run an additional strictness analysis before simplifier phase ⟨n⟩

-funbox-small-strict-fields

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

-funbox-strict-fields

Flatten strict constructor fields

-funfolding-creation-threshold=⟨n⟩

default: 750. Tweak unfolding settings.

-funfolding-dict-discount=⟨n⟩

default: 30. Tweak unfolding settings.

-funfolding-fun-discount=⟨n⟩

default: 60. Tweak unfolding settings.

-funfolding-keeness-factor=⟨n⟩

default: 1.5. Tweak unfolding settings.

-funfolding-use-threshold=⟨n⟩

default: 60. Tweak unfolding settings.

Optimization levels

-O

Enable level 1 optimisations

-O0

Disable optimisations (default)

-O2

Enable level 2 optimisations

Package options

-clear-package-db

Clear the package db stack.

-distrust ⟨pkg⟩

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

-distrust-all-packages

Distrust all packages by default. See Safe Haskell.

-fpackage-trust

Enable Safe Haskell trusted package requirement for trustworthy modules.

-global-package-db

Add the global package db to the stack.

-hide-all-packages

Hide all packages by default

-hide-package ⟨pkg⟩

Hide package ⟨pkg⟩

-ignore-package ⟨pkg⟩

Ignore package ⟨pkg⟩

-no-auto-link-packages

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

-no-global-package-db

Remove the global package db from the stack.

-no-user-package-db

Remove the user’s package db from the stack.

-package ⟨pkg⟩

Expose package ⟨pkg⟩

-package-db ⟨file⟩

Add ⟨file⟩ to the package db stack.

-package-env ⟨file⟩|⟨name⟩

Use the specified package environment.

-package-id ⟨unit-id⟩

Expose package by id ⟨unit-id⟩

-this-unit-id ⟨unit-id⟩

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

-trust ⟨pkg⟩

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

-user-package-db

Add the user’s package db to the stack.

Phases of compilation

-C

Stop after generating C (.hc file)

-c

Stop after generating object (.o) file

-E

Stop after preprocessing (.hspp file)

-F

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

-S

Stop after generating assembly (.s file)

-x ⟨suffix⟩

Override default behaviour for source files

Overriding external programs

-pgma ⟨cmd⟩

Use ⟨cmd⟩ as the assembler

-pgmc ⟨cmd⟩

Use ⟨cmd⟩ as the C compiler

-pgmdll ⟨cmd⟩

Use ⟨cmd⟩ as the DLL generator

-pgmF ⟨cmd⟩

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

-pgmi ⟨cmd⟩

Use ⟨cmd⟩ as the external interpreter command.

-pgmL ⟨cmd⟩

Use ⟨cmd⟩ as the literate pre-processor

-pgml ⟨cmd⟩

Use ⟨cmd⟩ as the linker

-pgmlc ⟨cmd⟩

Use ⟨cmd⟩ as the LLVM compiler

-pgmlibtool ⟨cmd⟩

Use ⟨cmd⟩ as the command for libtool (with -staticlib only).

-pgmlo ⟨cmd⟩

Use ⟨cmd⟩ as the LLVM optimiser

-pgmP ⟨cmd⟩

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

-pgms ⟨cmd⟩

Use ⟨cmd⟩ as the splitter

-pgmwindres ⟨cmd⟩

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

Phase-specific options

-opta ⟨option⟩

pass ⟨option⟩ to the assembler

-optc ⟨option⟩

pass ⟨option⟩ to the C compiler

-optdll ⟨option⟩

pass ⟨option⟩ to the DLL generator

-optF ⟨option⟩

pass ⟨option⟩ to the custom pre-processor

-opti ⟨option⟩

pass ⟨option⟩ to the interpreter sub-process.

-optL ⟨option⟩

pass ⟨option⟩ to the literate pre-processor

-optl ⟨option⟩

pass ⟨option⟩ to the linker

-optlc ⟨option⟩

pass ⟨option⟩ to the LLVM compiler

-optlo ⟨option⟩

pass ⟨option⟩ to the LLVM optimiser

-optP ⟨option⟩

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

-optwindres ⟨option⟩

pass ⟨option⟩ to windres.

Platform-specific options

-msse2

(x86 only) Use SSE2 for floating-point operations

-msse4.2

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

Compiler plugins

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

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

-fplugin=⟨module⟩

Load a plugin exported by a given module

-hide-all-plugin-packages

Hide all packages for plugins by default

-plugin-package ⟨pkg⟩

Expose ⟨pkg⟩ for plugins

-plugin-package-id ⟨pkg-id⟩

Expose ⟨pkg-id⟩ for plugins

Profiling

-fno-prof-auto

Disables any previous -fprof-auto, -fprof-auto-top, or -fprof-auto-exported options.

-fno-prof-cafs

Disables any previous -fprof-cafs option.

-fno-prof-count-entries

Do not collect entry counts

-fprof-auto

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

-fprof-auto-calls

Auto-add SCC\ s to all call sites

-fprof-auto-exported

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

-fprof-auto-top

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

-fprof-cafs

Auto-add SCC\ s to all CAFs

-prof

Turn on profiling

-ticky

Turn on ticky-ticky profiling

Program coverage

-fhpc

Turn on Haskell program coverage instrumentation

Recompilation checking

-fforce-recomp

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

-fignore-hpc-changes

Do not recompile modules just to match changes to HPC flags. This is especially useful for avoiding recompilation when using GHCi, and is enabled by default for GHCi.

-fignore-optim-changes

Do not recompile modules just to match changes to optimisation flags. This is especially useful for avoiding recompilation when using GHCi, and is enabled by default for GHCi.

Redirecting output

--exclude-module=⟨file⟩

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

-ddump-mod-cycles

Dump module cycles

-dep-makefile ⟨file⟩

Use ⟨file⟩ as the makefile

-dep-suffix ⟨suffix⟩

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

-dumpdir ⟨dir⟩

redirect dump files

-hcsuf ⟨suffix⟩

set the suffix to use for intermediate C files

-hidir ⟨dir⟩

set directory for interface files

-hisuf ⟨suffix⟩

set the suffix to use for interface files

-include-pkg-deps

Regard modules imported from packages as unstable

-o ⟨file⟩

set output filename

-odir ⟨dir⟩

set directory for object files

-ohi ⟨file⟩

set the filename in which to put the interface

-osuf ⟨suffix⟩

set the output file suffix

-outputdir ⟨dir⟩

set output directory

-stubdir ⟨dir⟩

redirect FFI stub files

Temporary files

-tmpdir ⟨dir⟩

set the directory for temporary files

Verbosity options

-fabstract-refinement-hole-fits

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

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

Use colors in error messages

-fdiagnostics-show-caret

Whether to show snippets of original source code

-ferror-spans

Output full span in error messages

-fhide-source-paths

hide module source and object paths

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

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

-fmax-relevant-binds=⟨n⟩

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

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

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

-fno-show-valid-hole-fits

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

-fno-sort-valid-hole-fits

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

-fprint-equality-relations

Distinguish between equality relations when printing

-fprint-expanded-synonyms

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

-fprint-explicit-coercions

Print coercions in types

-fprint-explicit-foralls

Print explicit forall quantification in types. See also -XExplicitForAll

-fprint-explicit-kinds

Print explicit kind foralls and kind arguments in types. See also -XKindSignatures

-fprint-explicit-runtime-reps

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

-fprint-explicit-runtime-reps

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

-fprint-potential-instances

display all available instances in type error messages

-fprint-typechecker-elaboration

Print extra information from typechecker.

-fprint-unicode-syntax

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

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

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

-fshow-hole-constraints

Show constraints when reporting typed holes.

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

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

-fshow-provenance-of-hole-fits

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

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

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

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

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

-fshow-type-of-hole-fits

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

-funclutter-valid-hole-fits

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

-Rghc-timing

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

-v

verbose mode (equivalent to -v3)

-v⟨n⟩

set verbosity level

Warnings

-fdefer-out-of-scope-variables

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

-fdefer-type-errors

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

-fdefer-typed-holes

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

-fhelpful-errors

Make suggestions for mis-spelled names.

-fmax-pmcheck-iterations=⟨n⟩

the iteration limit for the pattern match checker

-fshow-warning-groups

show which group an emitted warning belongs to.

-W

enable normal warnings

-w

disable all warnings

-Wall

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

-Wall-missed-specialisations

warn when specialisation of any overloaded function fails.

-Wamp

(deprecated) warn on definitions conflicting with the Applicative-Monad Proposal (AMP)

-Wcompat

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

-Wcpp-undef

warn on uses of the #if directive on undefined identifiers

-Wdeferred-out-of-scope-variables

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

-Wdeferred-type-errors

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

-Wdeprecated-flags

warn about uses of commandline flags that are deprecated

-Wdeprecations

warn about uses of functions & types that have warnings or deprecated pragmas. Alias for -Wwarnings-deprecations

-Wdodgy-exports

warn about dodgy exports

-Wdodgy-foreign-imports

warn about dodgy foreign imports

-Wdodgy-imports

warn about dodgy imports

-Wduplicate-constraints

warn when a constraint appears duplicated in a type signature

-Wduplicate-exports

warn when an entity is exported multiple times

-Wempty-enumerations

warn about enumerations that are empty

-Werror

make warnings fatal

-Weverything

enable all warnings supported by GHC

-Whi-shadowing

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

-Widentities

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

-Wimplicit-kind-vars

warn when kind variables are brought into scope implicitly despite the “forall-or-nothing” rule

-Wimplicit-prelude

warn when the Prelude is implicitly imported

-Winaccessible-code

warn about inaccessible code

-Wincomplete-patterns

warn when a pattern match could fail

-Wincomplete-record-updates

warn when a record update could fail

-Wincomplete-uni-patterns

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

-Winline-rule-shadowing

Warn if a rewrite RULE might fail to fire because the function might be inlined before the rule has a chance to fire. See How rules interact with INLINE/NOINLINE pragmas.

-Wmissed-specialisations

warn when specialisation of an imported, overloaded function fails.

-Wmissing-export-lists

warn when a module declaration does not explicitly list all exports

-Wmissing-exported-signatures

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

-Wmissing-exported-sigs

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

-Wmissing-fields

warn when fields of a record are uninitialised

-Wmissing-home-modules

warn when encountering a home module imported, but not listed on the command line. Useful for cabal to ensure GHC won’t pick up modules, not listed neither in exposed-modules, nor in other-modules.

-Wmissing-import-lists

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

-Wmissing-local-signatures

warn about polymorphic local bindings without signatures

-Wmissing-local-sigs

(deprecated) warn about polymorphic local bindings without signatures

-Wmissing-methods

warn when class methods are undefined

-Wmissing-monadfail-instances

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

-Wmissing-pattern-synonym-signatures

warn when pattern synonyms do not have type signatures

-Wmissing-signatures

warn about top-level functions without signatures

-Wmonomorphism-restriction

warn when the Monomorphism Restriction is applied

-Wname-shadowing

warn when names are shadowed

-Wno-compat

Disables all warnings enabled by -Wcompat.

-Wnoncanonical-monad-instances

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

-Wnoncanonical-monadfail-instances

warn when Monad or MonadFail instances have noncanonical definitions of fail. See flag description in Warnings and sanity-checking for more details.

-Wnoncanonical-monoid-instances

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

-Worphans

warn when the module contains orphan instance declarations or rewrite rules

-Woverflowed-literals

warn about literals that will overflow their type

-Woverlapping-patterns

warn about overlapping patterns

-Wpartial-fields

warn when defining a partial record field.

-Wpartial-type-signatures

warn about holes in partial type signatures when -XPartialTypeSignatures is enabled. Not applicable when -XPartialTypesignatures is not enabled, in which case errors are generated for such holes. See Partial Type Signatures.

-Wredundant-constraints

Have the compiler warn about redundant constraints in type signatures.

-Wsafe

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

-Wsemigroup

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

-Wsimplifiable-class-constraints

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

-Wstar-binder

warn about binding the (*) type operator despite -XStarIsType

-Wstar-is-type

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

-Wtabs

warn if there are tabs in the source file

-Wtrustworthy-safe

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

-Wtype-defaults

warn when defaulting happens

-Wtyped-holes

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

-Wunbanged-strict-patterns

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

-Wunrecognised-pragmas

warn about uses of pragmas that GHC doesn’t recognise

-Wunrecognised-warning-flags

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

-Wunsafe

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

-Wunsupported-calling-conventions

warn about use of an unsupported calling convention

-Wunsupported-llvm-version

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

-Wunticked-promoted-constructors

warn if promoted constructors are not ticked

-Wunused-binds

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

-Wunused-do-bind

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

-Wunused-foralls

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

-Wunused-imports

warn about unnecessary imports

-Wunused-local-binds

warn about local bindings that are unused

-Wunused-matches

warn about variables in patterns that aren’t used

-Wunused-pattern-binds

warn about pattern match bindings that are unused

-Wunused-top-binds

warn about top-level bindings that are unused

-Wunused-type-patterns

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

-Wwarn

make warnings non-fatal

-Wwarnings-deprecations

warn about uses of functions & types that have warnings or deprecated pragmas

-Wwrong-do-bind

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