ghc man page

GHC — the Glasgow Haskell Compiler


ghc Main

ghc {{file.hs}}

ghc -O {{file.hs}}

ghc -c {{file.hs}}



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


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 DVI, PostScript 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:

Haskell source code; preprocess, compile
literate Haskell source; unlit, preprocess, compile
Interface file; contains information about exported symbols
intermediate C files
way x object files; common ways are: p, u, s
way x interface files


Verbosity options

-v -vn -fprint-explicit-foralls -fprint-explicit-kinds -ferror-spans -Hsize -Rghc-timing

Alternative modes of operation

--help,-? --interactive --make -e expr --show-iface -M --supported-extensions, --supported-languages --show-options --info --version, -V --numeric-version --print-libdir

Which phases to run

-E -C -S -c -x suffix

Redirecting output

-hcsuf suffix -hidir dir -hisuf suffix -o filename -odir dir -ohi filename -osuf suffix -stubdir dir -dumpdir dir -outputdir dir

Keeping intermediate files

-keep-hc-file or
-keep-hc-files -keep-llvm-file or
-keep-llvm-files -keep-s-file or
-keep-s-files -keep-tmp-files

Temporary files


Finding imports

-idir1:dir2:... -i

Interface file options

-ddump-hi -ddump-hi-diffs -ddump-minimal-imports --show-iface file

Recompilation checking

-fforce-recomp -fno-force-recomp

Interactive-mode options

-ignore-dot-ghci -ghci-script -fbreak-on-error -fno-break-on-error -fbreak-on-exception -fno-break-on-exception -fghci-hist-size=n (default is 50) -fprint-evld-with-show -fno-print-evld-with-show -fprint-bind-result -fno-print-bind-result -fno-print-bind-contents -fno-implicit-import-qualified -interactive-print


-this-package-key P -package P -hide-all-packages -hide-package name -ignore-package name -package-db file -clear-package-db -no-global-package-db -global-package-db -no-user-package-db -user-package-db -no-auto-link-packages -trust P -distrust P -distrust-all

Language options

-fcontext-stack=n -fglasgow-exts -fno-glasgow-exts -firrefutable-tuples -fno-irrefutable-tuples -fpackage-trust -ftype-function-depth=n -XAllowAmbiguousTypes -XNoAllowAmbiguousTypes -XArrows -XNoArrows -XAutoDeriveTypeable -XNoAutoDeriveTypeable -XBangPatterns -XNoBangPatterns -XBinaryLiterals -XNoBinaryLiterals -XCApiFFI -XNoCAPIFFI -XConstrainedClassMethods -XNoConstrainedClassMethods -XConstraintKinds -XNoConstraintKinds -XCPP -XNoCPP -XDataKinds -XNoDataKinds -XDefaultSignatures -XNoDefaultSignatures -XDeriveAnyClass -XNoDeriveAnyClass -XDeriveDataTypeable -XNoDeriveDataTypeable -XDeriveFunctor -XNoDeriveFunctor -XDeriveFoldable -XNoDeriveFoldable -XDeriveGeneric -XNoDeriveGeneric -XDeriveTraversable -XNoDeriveTraversable -XDisambiguateRecordFields -XNoDisambiguateRecordFields -XEmptyCase -XNoEmptyCase -XEmptyDataDecls -XNoEmptyDataDecls -XExistentialQuantification -XNoExistentialQuantification -XExplicitForAll -XNoExplicitForAll -XExplicitNamespaces -XNoExplicitNamespaces -XExtendedDefaultRules -XNoExtendedDefaultRules -XFlexibleContexts -XNoFlexibleContexts -XFlexibleInstances -XNoFlexibleInstances -XForeignFunctionInterface -XNoForeignFunctionInterface -XFunctionalDependencies -XNoFunctionalDependencies -XGADTs -XNoGADTs -XGADTSyntax -XNoGADTSyntax -XGeneralizedNewtypeDeriving -XNoGeneralizedNewtypeDeriving -XGenerics -XNoGenerics -XImplicitParams -XNoImplicitParams -XNoImplicitPrelude -XImplicitPrelude -XImpredicativeTypes -XNoImpredicativeTypes -XIncoherentInstances -XNoIncoherentInstances -XInstanceSigs -XNoInstanceSigs -XInterruptibleFFI -XNoInterruptibleFFI -XKindSignatures -XNoKindSignatures -XLambdaCase -XNoLambdaCase -XLiberalTypeSynonyms -XNoLiberalTypeSynonyms -XMagicHash -XNoMagicHash -XMonadComprehensions -XNoMonadComprehensions -XMonoLocalBinds -XNoMonoLocalBinds -XNoMonomorphismRestriction -XMonomorphismRestriction -XMultiParamTypeClasses -XNoMultiParamTypeClasses -XMultiWayIf -XNoMultiWayIf -XNamedFieldPuns -XNoNamedFieldPuns -XNamedWildCards -XNoNamedWildCards -XNegativeLiterals -XNoNegativeLiterals -XNoNPlusKPatterns -XNPlusKPatterns -XNullaryTypeClasses -XNoNullaryTypeClasses -XNumDecimals -XNoNumDecimals -XOverlappingInstances -XNoOverlappingInstances -XOverloadedLists -XNoOverloadedLists -XOverloadedStrings -XNoOverloadedStrings -XPackageImports -XNoPackageImports -XParallelArrays -XNoParallelArrays -XParallelListComp -XNoParallelListComp -XPartialTypeSignatures -XNoPartialTypeSignatures -XPatternGuards -XNoPatternGuards -XPatternSynonyms -XNoPatternSynonyms -XPolyKinds -XNoPolyKinds -XPolymorphicComponents -XNoPolymorphicComponents -XPostfixOperators -XNoPostfixOperators -XQuasiQuotes -XNoQuasiQuotes -XRank2Types -XNoRank2Types -XRankNTypes -XNoRankNTypes -XRebindableSyntax -XNoRebindableSyntax -XRecordWildCards -XNoRecordWildCards -XRecursiveDo -XNoRecursiveDo -XRelaxedPolyRec -XNoRelaxedPolyRec -XRoleAnnotations -XNoRoleAnnotations -XSafe -XScopedTypeVariables -XNoScopedTypeVariables -XStandaloneDeriving -XNoStandaloneDeriving -XTemplateHaskell -XNoTemplateHaskell -XNoTraditionalRecordSyntax -XTraditionalRecordSyntax -XTransformListComp -XNoTransformListComp -XTrustworthy -XTupleSections -XNoTupleSections -XTypeFamilies -XNoTypeFamilies -XTypeOperators -XNoTypeOperators -XTypeSynonymInstances -XNoTypeSynonymInstances -XUnboxedTuples -XNoUnboxedTuples -XUndecidableInstances -XNoUndecidableInstances -XUnicodeSyntax -XNoUnicodeSyntax -XUnliftedFFITypes -XNoUnliftedFFITypes -XUnsafe -XViewPatterns -XNoViewPatterns


-W -w -w -Wall -w -Werror -Wwarn -fdefer-type-errors -fno-defer-type-errors -fdefer-typed-holes -fno-defer-typed-holes -fhelpful-errors -fno-helpful-errors -fwarn-deprecated-flags -fno-warn-deprecated-flags -fwarn-duplicate-constraints -fno-warn-duplicate-constraints -fwarn-duplicate-exports -fno-warn-duplicate-exports -fwarn-hi-shadowing -fno-warn-hi-shadowing -fwarn-identities -fno-warn-identities -fwarn-implicit-prelude -fno-warn-implicit-prelude -fwarn-incomplete-patterns -fno-warn-incomplete-patterns -fwarn-incomplete-uni-patterns -fno-warn-incomplete-uni-patterns -fwarn-incomplete-record-updates -fno-warn-incomplete-record-updates -fwarn-lazy-unlifted-bindings -fno-warn-lazy-unlifted-bindings -fwarn-missing-fields -fno-warn-missing-fields -fwarn-missing-import-lists -fnowarn-missing-import-lists -fwarn-missing-methods -fno-warn-missing-methods -fwarn-missing-signatures -fno-warn-missing-signatures -fwarn-missing-exported-sigs -fno-warn-missing-exported-sigs -fwarn-missing-local-sigs -fno-warn-missing-local-sigs -fwarn-monomorphism-restriction -fno-warn-monomorphism-restriction -fwarn-name-shadowing -fno-warn-name-shadowing -fwarn-orphans, -fwarn-auto-orphans -fno-warn-orphans, -fno-warn-auto-orphans -fwarn-overlapping-patterns -fno-warn-overlapping-patterns -fwarn-tabs -fno-warn-tabs -fwarn-type-defaults -fno-warn-type-defaults -fwarn-unrecognised-pragmas -fno-warn-unrecognised-pragmas -fwarn-unticked-promoted-constructors -fno-warn-unticked-promoted-constructors -fwarn-unused-binds -fno-warn-unused-binds -fwarn-unused-imports -fno-warn-unused-imports -fwarn-unused-matches -fno-warn-unused-matches -fwarn-unused-do-bind -fno-warn-unused-do-bind -fwarn-wrong-do-bind -fno-warn-wrong-do-bind -fwarn-unsafe -fno-warn-unsafe -fwarn-safe -fno-warn-safe -fwarn-trustworthy-safe -fno-warn-safe -fwarn-warnings-deprecations -fno-warn-warnings-deprecations -fwarn-amp -fno-warn-amp -fwarn-typed-holes -fno-warn-typed-holes -fwarn-partial-type-signatures -fno-warn-partial-type-signatures -fwarn-deriving-typeable -fno-warn-deriving-typeable

Optimisation levels

-O0 -O -O or -O1 -O0 -O2 -O0 -Odph

Individual optimisations

-fcall-arity -fno-call-arity -fcase-merge -fno-case-merge -fcmm-elim-common-blocks -fno-cmm-elim-common-blocks -fcmm-sink -fno-cmm-sink -fcpr-off -fcse -fno-cse -fdicts-cheap -fno-dicts-cheap -fdicts-strict -fno-dicts-strict -fdmd-tx-dict-sel
-fno-dmd-tx-dict-sel -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 -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 -flate-dmd-anal -fno-late-dmd-anal -fliberate-case -fliberate-case-threshold=n -fno-liberate-case-threshold -floopification -fno-loopification -fmax-inline-alloc-size=n

-fmax-relevant-binds=n -fno-max-relevant-bindings -fmax-simplifier-iterations=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 -fpedantic-bottoms -fno-pedantic-bottoms -fregs-graph -fno-regs-graph -fregs-iterative -fno-regs-iterative -fsimplifier-phases=n -fsimpl-tick-factor=n -fspec-constr -fno-spec-constr -fspec-constr-count=n -fno-spec-constr-count -fspec-constr-threshold=n -fno-spec-constr-threshold -fspecialise -fno-specialise -fstatic-argument-transformation -fno-static-argument-transformation -fstrictness -fno-strictness -fstrictness-before=n -funbox-small-strict-fields -fno-unbox-small-strict-fields -funbox-strict-fields -fno-unbox-strict-fields -funfolding-creation-threshold=n -funfolding-dict-discount=n -funfolding-fun-discount=n -funfolding-keeness-factor=n -funfolding-use-threshold=n -fvectorisation-avoidance -fno-vectorisation-avoidance -fvectorise -fno-vectorise

Profiling options

-prof -fprof-auto -fno-prof-auto -fprof-auto-top -fno-prof-auto -fprof-auto-exported -fno-prof-auto -fprof-cafs -fno-prof-cafs -fno-prof-count-entries -fprof-count-entries -ticky

Program coverage options

-fhpc -hpcdir dir

Haskell pre-processor options


C pre-processor options

-cpp -Dsymbol=value -U -Usymbol -Idir

Code generation options

-fasm -fllvm -fno-code -fwrite-interface -fbyte-code -fobject-code

Linking options

-shared -staticlib -fPIC -dynamic -dynamic-too -dyno -dynosuf -dynload -framework name -framework-path name -llib -Ldir -main-is --mk-dll -no-hs-main -rtsopts, -rtsopts={none,some,all} -with-rtsopts=opts -no-link -split-objs -static -threaded -debug -ticky -eventlog -fno-gen-manifest -fno-embed-manifest -fno-shared-implib -dylib-install-name path -rdynamic

Plugin options

-fplugin=module -fplugin-opt=module:args

Replacing phases

-pgmL cmd -pgmP cmd -pgmc cmd -pgmlo cmd -pgmlc cmd -pgms cmd -pgma cmd -pgml cmd -pgmdll cmd -pgmF cmd -pgmwindres cmd -pgmlibtool cmd -pgmreadelf cmd

Forcing options to particular phases

-optL option -optP option -optF option -optc option -optlo option -optlc option -opta option -optl option -optdll option -optwindres option

Platform-specific options


Compiler debugging options

-dcore-lint -ddump-to-file -ddump-asm -ddump-bcos -ddump-cmm -ddump-core-stats -ddump-cse -ddump-deriv -ddump-ds -ddump-foreign -ddump-hpc -ddump-inlinings -ddump-llvm -ddump-occur-anal -ddump-opt-cmm -ddump-parsed -ddump-prep -ddump-rn -ddump-rule-firings -ddump-rule-rewrites -ddump-rules -ddump-vect -ddump-simpl -ddump-simpl-iterations -ddump-spec -ddump-splices -ddump-stg -ddump-stranal -ddump-strsigs -ddump-tc -dth-dec-file -ddump-types -ddump-worker-wrapper -ddump-if-trace -ddump-tc-trace -ddump-vt-trace -ddump-rn-trace -ddump-rn-stats -ddump-simpl-stats -dno-debug-output -dppr-debug -dppr-user-length -dppr-colsNNN -dppr-case-as-let -dsuppress-all -dsuppress-uniques -dsuppress-idinfo -dsuppress-module-prefixes -dsuppress-type-signatures -dsuppress-type-applications -dsuppress-coercions -dsource-stats -dcmm-lint -dstg-lint -dstg-stats -dverbose-core2core -dverbose-stg2stg -dshow-passes -dfaststring-stats -frule-check

Misc compiler options

-jN -fno-hi-version-check -fhistory-size -fno-ghci-history -fno-ghci-sandbox

Verbosity Options

verbose mode (equivalent to -v3) [dynamic]
set verbosity level [dynamic]
print explicit forall quantification in types [dynamic]
print explicit kind foralls and kind arguments in types [dynamic]
output full span in error messages [dynamic]
Set the minimum heap size to size [dynamic]
Summarise timing stats for GHC (same as +RTS -tstderr) [dynamic]

Alternative Modes of Operation

Disply help [mode]
Interactive mode - normally used by just running ghci; see for details. [mode]
Build a multi-module Haskell program, automatically figuring out dependencies. Likely to be much easier, and faster, than using make; see for details.. [mode]
-e expr
Evaluate expr; see for details. [mode]
Display the contents of an interface file. [mode]
Generate dependency information suitable for use in a Makefile; see for details. [mode]
--supported-extensions, --supported-languages
display the supported language extensions [mode]
display the supported command line options [mode]
display information about the compiler [mode]
--version, -V
display GHC version [mode]
display GHC version (numeric only) [mode]
display GHC library directory [mode]

Which Phases to Run

Stop after preprocessing (.hspp file) [mode]
Stop after generating C (.hc file) [mode]
Stop after generating assembly (.s file) [mode]
Stop after generating object (.o) file [mode]
-x suffix
Override default behaviour for source files [dynamic]

Redirecting Output

-hcsuf suffix
set the suffix to use for intermediate C files [dynamic]
-hidir dir
set directory for interface files [dynamic]
-hisuf suffix
set the suffix to use for interface files [dynamic]
-o filename
set output filename [dynamic]
-odir dir
set directory for object files [dynamic]
-ohi filename
set the filename in which to put the interface [dynamic]
-osuf suffix
set the output file suffix [dynamic]
-stubdir dir
redirect FFI stub files [dynamic]
-dumpdir dir
redirect dump files [dynamic]
-outputdir dir
set output directory [dynamic]

Keeping Intermediate Files

-keep-hc-file or
-keep-hc-files retain intermediate .hc files [dynamic]
-keep-llvm-file or
-keep-llvm-files retain intermediate LLVM .ll files [dynamic]
-keep-s-file or
-keep-s-files retain intermediate .s files [dynamic]
retain all intermediate temporary files [dynamic]

Temporary Files

set the directory for temporary files [dynamic]

Finding Imports

add dir, dir2, etc. to import path [dynamic/:set]
Empty the import directory list [dynamic/:set]

Interface File Options

Dump the new interface to stdout [dynamic]
Show the differences vs. the old interface [dynamic]
Dump a minimal set of imports [dynamic]
--show-iface file
See . []

Recompilation Checking

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

Interactive-Mode Options

Disable reading of .ghci files [dynamic]
Read additional .ghci files [dynamic]
Break on uncaught exceptions and errors [dynamic]
Break on any exception thrown [dynamic]
Set the number of entries GHCi keeps for :history [dynamic]
Enable usage of Show instances in :print [dynamic]
Turn on printing of binding results in GHCi [dynamic]
Turn off printing of binding contents in GHCi [dynamic]
Turn off implicit qualified import of everything in GHCi [dynamic]
Select the function to use for printing evaluated expressions in GHCi [dynamic]


-this-package-key P
Compile to be part of package P [dynamic]
-package P
Expose package P [dynamic/:set]
Hide all packages by default [dynamic]
-hide-package name
Hide package P [dynamic/:set]
-ignore-package name
Ignore package P [dynamic/:set]
-package-db file
Add file to the package db stack. [dynamic]
Clear the package db stack. [dynamic]
Remove the global package db from the stack. [dynamic]
Add the global package db to the stack. [dynamic]
Remove the user's package db from the stack. [dynamic]
Add the user's package db to the stack. [dynamic]
Don't automatically link in the base and rts packages. [dynamic]
-trust P
Expose package P and set it to be trusted [dynamic/:set]
-distrust P
Expose package P and set it to be distrusted [dynamic/:set]
Distrust all packages by default [dynamic/:set]

Language Options

set the limit for type-class context reduction. Default is 100. [dynamic]
Deprecated. Enable most language extensions; see for exactly which ones. [dynamic]
Make tuple pattern matching irrefutable [dynamic]
Enable Safe Haskell trusted package requirement for trustworthy modules. [dynamic]
set the limit for type function reductions. Default is 200. [dynamic]
Allow the user to write ambiguous types, and the type inference engine to infer them. [dynamic]
Enable arrow notation extension [dynamic]
As of GHC 7.10, this option is not needed, and should not be used. Automatically derive Typeable instances for every datatype and type class declaration. Implies -XDeriveDataTypeable. [dynamic]
Enable bang patterns. [dynamic]
Enable support for binary literals. [dynamic]
Enable the CAPI calling convention. [dynamic]
Enable constrained class methods. [dynamic]
Enable a kind of constraints. [dynamic]
Enable the C preprocessor. [dynamic]
Enable datatype promotion. [dynamic]
Enable default signatures. [dynamic]
Enable deriving for any class. [dynamic]
Enable deriving for the Data class. Implied by -XAutoDeriveTypeable. [dynamic]
Enable deriving for the Functor class. Implied by -XDeriveTraversable. [dynamic]
Enable deriving for the Foldable class. Implied by -XDeriveTraversable. [dynamic]
Enable deriving for the Generic class. [dynamic]
Enable deriving for the Traversable class. Implies -XDeriveFunctor and -XDeriveFoldable. [dynamic]
Enable record field disambiguation. Implied by -XRecordWildCards. [dynamic]
Allow empty case alternatives. [dynamic]
Enable empty data declarations. [dynamic]
Enable existential quantification. [dynamic]
Enable explicit universal quantification. Implied by -XScopedTypeVariables, -XLiberalTypeSynonyms, -XRankNTypes and -XExistentialQuantification. [dynamic]
Enable using the keyword type to specify the namespace of entries in imports and exports (). Implied by -XTypeOperators and -XTypeFamilies. [dynamic]
Use GHCi's extended default rules in a normal module. [dynamic]
Enable flexible contexts. Implied by -XImplicitParams. [dynamic]
Enable flexible instances. Implies -XTypeSynonymInstances. Implied by -XImplicitParams. [dynamic]
Enable foreign function interface. [dynamic]
Enable functional dependencies. Implies -XMultiParamTypeClasses. [dynamic]
Enable generalised algebraic data types. Implies -XGADTSyntax and -XMonoLocalBinds. [dynamic]
Enable generalised algebraic data type syntax. [dynamic]
Enable newtype deriving. [dynamic]
Deprecated, does nothing. No longer enables generic classes. See also GHC's support for generic programming. [dynamic]
Enable Implicit Parameters. Implies -XFlexibleContexts and -XFlexibleInstances. [dynamic]
Don't implicitly import Prelude. Implied by -XRebindableSyntax. [dynamic]
Enable impredicative types. Implies -XRankNTypes. [dynamic]
Enable incoherent instances. Implies -XOverlappingInstances. [dynamic]
Enable instance signatures. [dynamic]
Enable interruptible FFI. [dynamic]
Enable kind signatures. Implied by -XTypeFamilies and -XPolyKinds. [dynamic]
Enable lambda-case expressions. [dynamic]
Enable liberalised type synonyms. [dynamic]
Allow "#" as a postfix modifier on identifiers. [dynamic]
Enable monad comprehensions. [dynamic]
Enable do not generalise local bindings. Implied by -XTypeFamilies and -XGADTs. [dynamic]
Disable the monomorphism restriction. [dynamic]
Enable multi parameter type classes. Implied by -XFunctionalDependencies. [dynamic]
Enable multi-way if-expressions. [dynamic]
Enable record puns. [dynamic]
Enable named wildcards. [dynamic]
Enable support for negative literals. [dynamic]
Disable support for n+k patterns. [dynamic]
Deprecated, does nothing. nullary (no parameter) type classes are now enabled using -XMultiParamTypeClasses. [dynamic]
Enable support for 'fractional' integer literals. [dynamic]
Enable overlapping instances. [dynamic]
Enable overloaded lists. [dynamic]
Enable overloaded string literals. [dynamic]
Enable package-qualified imports. [dynamic]
Enable parallel arrays. Implies -XParallelListComp. [dynamic]
Enable parallel list comprehensions. Implied by -XParallelArrays. [dynamic]
Enable partial type signatures. [dynamic]
Enable pattern guards. [dynamic]
Enable pattern synonyms. [dynamic]
Enable kind polymorphism. Implies -XKindSignatures. [dynamic]
Enable polymorphic components for data constructors. [dynamic, synonym for -XRankNTypes]
Enable postfix operators. [dynamic]
Enable quasiquotation. [dynamic]
Enable rank-2 types. [dynamic, synonym for -XRankNTypes]
Enable rank-N types. Implied by -XImpredicativeTypes. [dynamic]
Employ rebindable syntax. Implies -XNoImplicitPrelude. [dynamic]
Enable record wildcards. Implies -XDisambiguateRecordFields. [dynamic]
Enable recursive do (mdo) notation. [dynamic]
(deprecated) Relaxed checking for mutually-recursive polymorphic functions. [dynamic]
Enable role annotations. [dynamic]
Enable the Safe Haskell Safe mode. [dynamic]
Enable lexically-scoped type variables. [dynamic]
Enable standalone deriving. [dynamic]
Enable Template Haskell. [dynamic]
Disable support for traditional record syntax (as supported by Haskell 98) C {f = x} [dynamic]
Enable generalised list comprehensions. [dynamic]
Enable the Safe Haskell Trustworthy mode. [dynamic]
Enable tuple sections. [dynamic]
Enable type families. Implies -XExplicitNamespaces, -XKindSignatures and -XMonoLocalBinds. [dynamic]
Enable type operators. Implies -XExplicitNamespaces. [dynamic]
Enable type synonyms in instance heads. Implied by -XFlexibleInstances. [dynamic]
Enable unboxed tuples. [dynamic]
Enable undecidable instances. [dynamic]
Enable unicode syntax. [dynamic]
Enable unlifted FFI types. [dynamic]
Enable Safe Haskell Unsafe mode. [dynamic]
Enable view patterns. [dynamic]


enable normal warnings [dynamic]
disable all warnings [dynamic]
enable almost all warnings (details in ) [dynamic]
make warnings fatal [dynamic]
make warnings non-fatal [dynamic]
Turn type errors into warnings, deferring the error until runtime. Implies -fdefer-typed-holes. [dynamic]
Convert typed hole errors into warnings, deferring the error until runtime. Implied by -fdefer-type-errors. See also -fwarn-typed-holes. [dynamic]
Make suggestions for mis-spelled names. [dynamic]
warn about uses of commandline flags that are deprecated [dynamic]
warn when a constraint appears duplicated in a type signature [dynamic]
warn when an entity is exported multiple times [dynamic]
warn when a .hi file in the current directory shadows a library [dynamic]
warn about uses of Prelude numeric conversions that are probably the identity (and hence could be omitted) [dynamic]
warn when the Prelude is implicitly imported [dynamic]
warn when a pattern match could fail [dynamic]
warn when a pattern match in a lambda expression or pattern binding could fail [dynamic]
warn when a record update could fail [dynamic]
(deprecated) warn when a pattern binding looks lazy but must be strict [dynamic]
warn when fields of a record are uninitialised [dynamic]
warn when an import declaration does not explicitly list all the names brought into scope [dynamic]
warn when class methods are undefined [dynamic]
warn about top-level functions without signatures [dynamic]
warn about top-level functions without signatures, only if they are exported. takes precedence over -fwarn-missing-signatures [dynamic]
warn about polymorphic local bindings without signatures [dynamic]
warn when the Monomorphism Restriction is applied [dynamic]
warn when names are shadowed [dynamic]
-fwarn-orphans, -fwarn-auto-orphans
warn when the module contains orphan instance declarations or rewrite rules [dynamic]
warn about overlapping patterns [dynamic]
warn if there are tabs in the source file [dynamic]
warn when defaulting happens [dynamic]
warn about uses of pragmas that GHC doesn't recognise [dynamic]
warn if promoted constructors are not ticked [dynamic]
warn about bindings that are unused [dynamic]
warn about unnecessary imports [dynamic]
warn about variables in patterns that aren't used [dynamic]
warn about do bindings that appear to throw away values of types other than () [dynamic]
warn about do bindings that appear to throw away monadic values that you should have bound instead [dynamic]
warn if the module being compiled is regarded to be unsafe. Should be used to check the safety status of modules when using safe inference. Works on all module types, even those using explicit Safe Haskell modes (such as -XTrustworthy) and so can be used to have the compiler check any assumptions made. [dynamic]
warn if the module being compiled is regarded to be safe. Should be used to check the safety status of modules when using safe inference. Works on all module types, even those using explicit Safe Haskell modes (such as -XTrustworthy) and so can be used to have the compiler check any assumptions made. [dynamic]
warn if the module being compiled is marked as -XTrustworthy but it could instead be marked as -XSafe, a more informative bound. Can be used to detect once a Safe Haskell bound can be improved as dependencies are updated. [dynamic]
warn about uses of functions & types that have warnings or deprecated pragmas [dynamic]
(deprecated) warn on definitions conflicting with the Applicative-Monad Proposal (AMP) [dynamic]
Report warnings when typed hole errors are deferred until runtime. See -fdefer-typed-holes. [dynamic]
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 . [dynamic]
warn when encountering a request to derive an instance of class Typeable. As of GHC 7.10, such declarations are unnecessary and are ignored by the compiler because GHC has a custom solver for discharging this type of constraint. [dynamic]

Optimisation Levels

Disable optimisations (default) [dynamic]
-O or -O1
Enable level 1 optimisations [dynamic]
Enable level 2 optimisations [dynamic]
Enable level 2 optimisations, set -fmax-simplifier-iterations=20 and -fsimplifier-phases=3. [dynamic]

Individual Optimisations

Enable call-arity optimisation. Implied by -O. [dynamic]
Enable case-merging. Implied by -O. [dynamic]
Enable Cmm common block elimination. Implied by -O. [dynamic]
Enable Cmm sinking. Implied by -O. [dynamic]
Switch off CPR analysis in the demand analyser. [static]
Enable common sub-expression elimination. Implied by -O. [dynamic]
Make dictionary-valued expressions seem cheap to the optimiser. [dynamic]
Make dictionaries strict [dynamic]
Use a special demand transformer for dictionary selectors. Always enabled by default. [dynamic]
Enable eta-reduction. Implied by -O. [dynamic]
Enable lambda eta-expansion. Always enabled by default. [dynamic]
Turn on eager blackholing [dynamic]
Switch on all rewrite rules (including rules generated by automatic specialisation of overloaded functions). Implied by -O. [dynamic]
Enable excess intermediate precision [dynamic]
Expose all unfoldings, even for very large or recursive functions. [dynamic]
Turn on the float-in transformation. Implied by -O. [dynamic]
Turn on full laziness (floating bindings outwards). Implied by -O. [dynamic]
Allow worker-wrapper to convert a function closure into a thunk if the function does not use any of its arguments. Off by default. [dynamic]
Ignore assertions in the source. Implied by -O. [dynamic]
Ignore pragmas in interface files. Implied by -O0 only. [dynamic]
Run demand analysis again, at the end of the simplification pipeline [dynamic]
Turn on the liberate-case transformation. Implied by -O2. [dynamic]
Set the size threshold for the liberate-case transformation to n (default: 2000) [dynamis]
Turn saturated self-recursive tail-calls into local jumps in the generated assembly. Implied by -O. [dynamic]
Set the maximum size of inline array allocations to n bytes (default: 128). GHC will allocate non-pinned arrays of statically known size in the current nursery block if they're no bigger than n bytes, ignoring GC overheap. This value should be quite a bit smaller than the block size (typically: 4096). [dynamic]
Inline memcpy calls if they would generate no more than n pseudo instructions (default: 32). [dynamic]
Inline memset calls if they would generate no more than n pseudo instructions (default: 32). [dynamic]
Set the maximum number of bindings to display in type error messages (default 6). [dynamic]
Set the max iterations for the simplifier (default 4). [dynamic]
If a worker has that many arguments, none will be unpacked anymore (default: 10) [dynamic]
Turn off the coercion optimiser [static]
Turn off pre-inlining [dynamic]
Turn off the "state hack" whereby any lambda with a real-world state token as argument is considered to be single-entry. Hence OK to inline things inside it. [static]
Don't generate interface pragmas. Implied by -O0 only. [dynamic]
Omit heap checks when no allocation is being performed. [dynamic]
Make GHC be more precise about its treatment of bottom (but see also -fno-state-hack). In particular, GHC will not eta-expand through a case expression. [dynamic]
Use the graph colouring register allocator for register allocation in the native code generator. Implied by -O2. [dynamic]
Use the iterative coalescing graph colouring register allocator in the native code generator. [dynamic]
Set the number of phases for the simplifier (default 2). Ignored with -O0. [dynamic]
Set the percentage factor for simplifier ticks (default 100) [dynamic]
Turn on the SpecConstr transformation. Implied by -O2. [dynamic]
Set to n (default: 3) the maximum number of specialisations that will be created for any one function by the SpecConstr transformation [dynamic]
Set the size threshold for the SpecConstr transformation to n (default: 2000) [dynamic]
Turn on specialisation of overloaded functions. Implied by -O. [dynamic]
Turn on the static argument transformation. [dynamic]
Turn on strictness analysis. Implied by -O. [dynamic]
Run an additional strictness analysis before simplifier phase n [dynamic]
Flatten strict constructor fields with a pointer-sized representation. Implied by -O. [dynamic]
Flatten strict constructor fields [dynamic]
Tweak unfolding settings. Default: 750 [dynamic]
Tweak unfolding settings. Default: 30 [dynamic]
Tweak unfolding settings. Default: 60 [dynamic]
Tweak unfolding settings. Default: 1.5 [dynamic]
Tweak unfolding settings. Default: 60 [dynamic]
Enable vectorisation avoidance. Always enabled by default. [dynamic]
Enable vectorisation of nested data parallelism [dynamic]

Profiling Options

Turn on profiling [dynamic]
Auto-add SCCs to all bindings not marked INLINE [dynamic]
Auto-add SCCs to all top-level bindings not marked INLINE [dynamic]
Auto-add SCCs to all exported bindings not marked INLINE [dynamic]
Auto-add SCCs to all CAFs [dynamic]
Do not collect entry counts [dynamic]
Turn on ticky-ticky profiling [dynamic]

Program Coverage Options

Turn on Haskell program coverage instrumentation [dynamic]
-hpcdir dir
Directory to deposit .mix files during compilation (default is .hpc) [dynamic]

Haskell Pre-Processor Options

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

C Pre-Processor Options

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

Code Generation Options

Use the native code generator [dynamic]
Compile using the LLVM code generator [dynamic]
Omit code generation [dynamic]
Always write interface files [dynamic]
Generate byte-code [dynamic]
Generate object code [dynamic]

Linking Options

Generate a shared library (as opposed to an executable) [dynamic]
On Darwin/OS X/iOS only, generate a standalone static library (as opposed to an executable). This is the usual way to compile for iOS. [dynamic]
Generate position-independent code (where available) [dynamic]
Use dynamic Haskell libraries (if available) [dynamic]
Build dynamic object files as well as static object files during compilation [dynamic]
Set the output path for the dynamically linked objects [dynamic]
Set the output suffix for dynamic object files [dynamic]
Selects one of a number of modes for finding shared libraries at runtime. [dynamic]
-framework name
On Darwin/OS X/iOS only, link in the framework name. This option corresponds to the -framework option for Apple's Linker. [dynamic]
-framework-path name
On Darwin/OS X/iOS only, add dir to the list of directories searched for frameworks. This option corresponds to the -F option for Apple's Linker. [dynamic]
Link in library lib [dynamic]
Add dir to the list of directories searched for libraries [dynamic]
Set main module and function [dynamic]
DLL-creation mode (Windows only) [dynamic]
Don't assume this program contains main [dynamic]
-rtsopts, -rtsopts={none,some,all}
Control whether the RTS behaviour can be tweaked via command-line flags and the GHCRTS environment variable. Using none means no RTS flags can be given; some means only a minimum of safe options can be given (the default), and all (or no argument at all) means that all RTS flags are permitted. [dynamic]
Set the default RTS options to opts. [dynamic]
Omit linking [dynamic]
Split objects (for libraries) [dynamic]
Use static Haskell libraries [dynamic]
Use the threaded runtime [dynamic]
Use the debugging runtime [dynamic]
For linking, this simply implies -debug; see . [dynamic]
Enable runtime event tracing [dynamic]
Do not generate a manifest file (Windows only) [dynamic]
Do not embed the manifest in the executable (Windows only) [dynamic]
Don't generate an import library for a DLL (Windows only) [dynamic]
-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]
This instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. Currently Linux and Windows/MinGW32 only. This is equivalent to using -optl -rdynamic on Linux, and -optl -export-all-symbols on Windows. [dynamic]

Plugin Options

Load a plugin exported by a given module [dynamic]
Give arguments to a plugin module; module must be specified with -fplugin [dynamic]

Replacing Phases

-pgmL cmd
Use cmd as the literate pre-processor [dynamic]
-pgmP cmd
Use cmd as the C pre-processor (with -cpp only) [dynamic]
-pgmc cmd
Use cmd as the C compiler [dynamic]
-pgmlo cmd
Use cmd as the LLVM optimiser [dynamic]
-pgmlc cmd
Use cmd as the LLVM compiler [dynamic]
-pgms cmd
Use cmd as the splitter [dynamic]
-pgma cmd
Use cmd as the assembler [dynamic]
-pgml cmd
Use cmd as the linker [dynamic]
-pgmdll cmd
Use cmd as the DLL generator [dynamic]
-pgmF cmd
Use cmd as the pre-processor (with -F only) [dynamic]
-pgmwindres cmd
Use cmd as the program for embedding manifests on Windows. [dynamic]
-pgmlibtool cmd
Use cmd as the command for libtool (with -staticlib only). [dynamic]
-pgmreadelf cmd
Use cmd as the command for readelf (part of Unix binutils) [dynamic]

Forcing Options to Particular Phases

-optL option
pass option to the literate pre-processor [dynamic]
-optP option
pass option to cpp (with -cpp only) [dynamic]
-optF option
pass option to the custom pre-processor [dynamic]
-optc option
pass option to the C compiler [dynamic]
-optlo option
pass option to the LLVM optimiser [dynamic]
-optlc option
pass option to the LLVM compiler [dynamic]
-opta option
pass option to the assembler [dynamic]
-optl option
pass option to the linker [dynamic]
-optdll option
pass option to the DLL generator [dynamic]
-optwindres option
pass option to windres. [dynamic]

Platform-Specific Options

(x86 only) Use SSE2 for floating point [dynamic]

Compiler Debugging Options

Turn on internal sanity checking [dynamic]
Dump to files instead of stdout [dynamic]
Dump assembly [dynamic]
Dump interpreter byte code [dynamic]
Dump C-- output [dynamic]
Print a one-line summary of the size of the Core program at the end of the optimisation pipeline [dynamic]
Dump CSE output [dynamic]
Dump deriving output [dynamic]
Dump desugarer output [dynamic]
Dump foreign export stubs [dynamic]
Dump after instrumentation for program coverage [dynamic]
Dump inlining info [dynamic]
Dump LLVM intermediate code [dynamic]
Dump occurrence analysis output [dynamic]
Dump the results of C-- to C-- optimising passes [dynamic]
Dump parse tree [dynamic]
Dump prepared core [dynamic]
Dump renamer output [dynamic]
Dump rule firing info [dynamic]
Dump detailed rule firing info [dynamic]
Dump rules [dynamic]
Dump vectoriser input and output [dynamic]
Dump final simplifier output [dynamic]
Dump output from each simplifier iteration [dynamic]
Dump specialiser output [dynamic]
Dump TH spliced expressions, and what they evaluate to [dynamic]
Dump final STG [dynamic]
Dump strictness analyser output [dynamic]
Dump strictness signatures [dynamic]
Dump typechecker output [dynamic]
Show evaluated TH declarations in a .th.hs file [dynamic]
Dump type signatures [dynamic]
Dump worker-wrapper output [dynamic]
Trace interface files [dynamic]
Trace typechecker [dynamic]
Trace vectoriser [dynamic]
Trace renamer [dynamic]
Renamer stats [dynamic]
Dump simplifier stats [dynamic]
Suppress unsolicited debugging output [static]
Turn on debug printing (more verbose) [static]
Set the depth for printing expressions in error msgs [dynamic]
Set the width of debugging output. For example -dppr-cols200 [dynamic]
Print single alternative case expressions as strict lets. [dynamic]
In core dumps, suppress everything (except for uniques) that is suppressible. [dynamic]
Suppress the printing of uniques in debug output (easier to use diff) [dynamic]
Suppress extended information about identifiers where they are bound [dynamic]
Suppress the printing of module qualification prefixes [dynamic]
Suppress type signatures [dynamic]
Suppress type applications [dynamic]
Suppress the printing of coercions in Core dumps to make them shorter [dynamic]
Dump haskell source stats [dynamic]
C-- pass sanity checking [dynamic]
STG pass sanity checking [dynamic]
Dump STG stats [dynamic]
Show output from each core-to-core pass [dynamic]
Show output from each STG-to-STG pass [dynamic]
Print out each pass name as it happens [dynamic]
Show statistics for fast string usage when finished [dynamic]
Report sites with rules that could have fired but didn't. Takes a string argument. [dynamic]

Misc Compiler Options

When compiling with --make, compile N modules in parallel. [dynamic]
Don't complain about .hi file mismatches [dynamic]
Set simplification history size [dynamic]
Do not use the load/store the GHCi command history from/to ghci_history. [dynamic]
Turn off the GHCi sandbox. Means computations are run in the main thread, rather than a forked thread. [dynamic]




This manual page was generated from the XML documentation of GHC with blood, sweat, tears and a breaks-if-you-look-at-it-the-wrong-way XSL stylesheet originally written by Michael Weber <michaelw@debian.org> for the Debian GNU/Linux system (but may be used by others).


Glasgow FP Suite Glasgow Haskell Compiler 2002-10-25