ghc51
The glasgow haskell compiler
Usage
ghc [{option | filename}] ...
Overview
This manual page documents briefly the ghc command. 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, 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 |
.x
|
way x object files; common ways are: |
.x
|
way x interface files |
Options
Help and verbosity options
-? -help -v -vn --version --numeric-version --print-libdir
Which phases to run
-E -C -S -c
Redirecting output
-hcsuf suffix -hidir dir -hisuf suffix -o filename -odir dir -ohi filename -osuf suffix
Keeping intermediate files
-keep-hc-file -keep-s-file -keep-raw-s-file -keep-tmp-files
Temporary files
-tmpdir
Finding imports
-idir1:dir2:... -i
Interface file options
-ddump-hi -ddump-hi-diffs --show-iface file
Recompilation checking
-no-recomp -recomp
Interactive-mode options
-ignore-dot-ghci -read-dot-ghci
Packages
-package name -package-conf file -package-name name
Language options
-fallow-overlapping-instances -fno-allow-overlapping-instances -fallow-undecidable-instances -fno-allow-undecidable-instances -fgenerics -fno-fgenerics -fglasgow-exts -fno-glasgow-exts -ffi or -fffi -fno-ffi -fwith -fno-with -fignore-asserts -fno-ignore-asserts -fno-implicit-prelude -fno-monomorphism-restriction -firrefutable-tuples -fno-irrefutable-tuples -fcontext-stackn
Warnings
-W -w -w -Wall -w -fwarn-deprecations -fno-warn-deprecations -fwarn-duplicate-exports -fno-warn-duplicate-exports -fwarn-hi-shadowing -fno-warn-hi-shadowing -fwarn-incomplete-patterns -fno-warn-incomplete-patterns -fwarn-misc -fno-warn-misc -fwarn-missing-fields -fno-warn-missing-fields -fwarn-missing-methods -fno-warn-missing-methods -fwarn-missing-signatures -fno-warn-missing-signatures -fwarn-name-shadowing -fno-warn-name-shadowing -fwarn-overlapping-patterns -fno-warn-overlapping-patterns -fwarn-simple-patterns -fno-warn-simple-patterns -fwarn-type-defaults -fno-warn-type-defaults -fwarn-unused-binds -fno-warn-unused-binds -fwarn-unused-imports -fno-warn-unused-imports -fwarn-unused-matches -fno-warn-unused-matches
Optimisation levels
-O -O0 -On -O0
Individual optimisations
-fcase-merge -fno-case-merge -fdicts-strict -fno-dicts-strict -fdo-eta-reduction -fno-do-eta-reduction -fdo-lambda-eta-expansion -fno-do-lambda-eta-expansion -fexcess-precision -fno-excess-precision -ffoldr-build-on -fno-foldr-build-on -fignore-asserts -fno-ignore-asserts -fignore-interface-pragmas -fno-ignore-interface-pragmas -flet-no-escape -fno-let-no-escape -fliberate-case-threshold -fno-liberate-case-threshold -fomit-interface-pragmas -fno-omit-interface-pragmas -fmax-worker-args -fmax-simplifier-iterations -fno-cpr -fno-cse -fno-pre-inlining -fno-strictness -fnumbers-strict -fno-numbers-strict -funbox-strict-fields -fno-unbox-strict-fields -funfolding-creation-threshold -fno-unfolding-creation-threshold -funfolding-fun-discount -fno-unfolding-fun-discount -funfolding-keeness-factor -fno-unfolding-keeness-factor -funfolding-update-in-place -fno-unfolding-update-in-place -funfolding-use-threshold -fno-unfolding-use-threshold -fusagesp -fno-usagesp
Profiling options
-auto -no-auto -auto-all -no-auto-all -auto-dicts -no-auto-dicts -caf-all -no-caf-all -prof -ticky
Parallelism options
-gransim -parallel -smp
C pre-processor options
-cpp -Dsymbol="value" -U -Usymbol -Idir
C compiler options
-#include file
Code generation options
-fasm -fvia-C -fno-code
Linking options
-dynamic -llib -Ldir -package name -framework name -framework-path name -split-objs -static -no-hs-main
Replacing phases
-pgmL cmd -pgmP cmd -pgmc cmd -pgma cmd -pgml cmd -pgmdll cmd -pgmdep cmd -pgmF cmd
Forcing options to particular phases
-optL option -optP option -optc option -opta option -optl option -optdll option -optdep option
Platform-specific options
-mv8 -monly-[32]-regs
External core file options
-fext-core
Compiler debugging options
-dcore-lint -ddump-absC -ddump-asm -ddump-bcos -ddump-cpranal -ddump-cse -ddump-deriv -ddump-ds -ddump-flatC -ddump-foreign -ddump-inlinings -ddump-occur-anal -ddump-parsed -ddump-realC -ddump-rn -ddump-rules -ddump-sat -ddump-simpl -ddump-simpl-iterations -ddump-spec -ddump-stg -ddump-stranal -ddump-tc -ddump-types -ddump-usagesp -ddump-worker-wrapper -ddump-rn-trace -ddump-rn-stats -ddump-stix -ddump-simpl-stats -dppr-debug -dppr-noprags -dppr-user-length -dsource-stats -dstg-lint -dstg-stats -dusagesp-lint -dverbose-core2core -dverbose-stg2stg -unreg
Misc compiler options
-funfold-casms-in-hi-file -femit-extern-decls -fglobalise-toplev-names -fno-hi-version-check -dno-black-holing -fno-method-sharing -fno-prune-decls -fno-prune-tydecls -fhistory-size -funregisterised -fno-asm-mangling
Options
-
-? -
help [static]
-
-help -
help [static]
-
-v -
verbose mode (equivalent to
-v3) [dynamic]
-
-vn -
set verbosity level [dynamic]
-
--version -
display GHC version [static]
-
--numeric-version -
display GHC version (numeric only) [static]
-
--print-libdir -
display GHC library directory [static]
Which phases to run
|
Stop after preprocessing ( |
|---|---|
|
Stop after generating C ( |
|
Stop after generating assembly ( |
|
Stop after compiling to object code ( |
Redirecting output
|
set the suffix to use for intermediate C files [static] |
|---|---|
|
set directory for interface files [static] |
|
set the suffix to use for interface files [static] |
|
set output filename [static] |
|
set output directory [static] |
|
set the filename in which to put the interface [static] |
|
set the output file suffix [static] |
Keeping intermediate files
|
retain intermediate |
|---|---|
|
retain intermediate |
|
retain intermediate |
|
retain all intermediate temporary files [static] |
Temporary files
-tmpdir-
set the directory for temporary files [static]
Finding imports
|
add dir1, dir2, etc. to import path [static] |
|---|---|
|
Empty the import directory list [static] |
Options
-
-ddump-hi -
Dump the new interface to stdout [dynamic]
-
-ddump-hi-diffs -
Show the differences vs. the old interface [dynamic]
-
--show-iface file -
Read the interface in file and dump it as text to
stdout. [static]
Recompilation checking
-no-recomp-
Turn off recompilation checking [static]
Options
-
-ignore-dot-ghci -
Disable reading of .ghci files [static]
-
-read-dot-ghci -
Enable reading of .ghci files [static]
Packages
|
Use package name [static] |
|---|---|
|
Load more packages from file [static] |
|
Compile code for package name [static] |
Options
-
-fallow-overlapping-instances -
Enable overlapping instances [dynamic]
-
-fallow-undecidable-instances -
Enable undecidable instances [dynamic]
-
-fgenerics -
Enable generics [dynamic]
-
-fglasgow-exts -
Enable most language extensions [dynamic]
-
-ffi or -fffi -
Enable foreign function interface (implied by
-fglasgow-exts) [dynamic]
-
-fwith -
Enable deprecated
withkeyword [dynamic]
-
-fignore-asserts -
Ignore assertions [dynamic]
-
-fno-implicit-prelude -
Don't implicitly
import Prelude[dynamic]
-
-fno-monomorphism-restriction -
Disable the monomorphism restriction [dynamic]
-
-firrefutable-tuples -
Make tuple pattern matching irrefutable [dynamic]
-
-fcontext-stackn -
set the limit for context reduction [dynamic]
Warnings
|
enable normal warnings [dynamic] |
|---|---|
|
disable all warnings [dynamic] |
|
enable all warnings [dynamic] |
|
warn about uses of functions & types that are deprecated [dynamic] |
|
warn when an entity is exported multiple times [dynamic] |
|
warn when a |
|
warn when a pattern match could fail [dynamic] |
|
enable miscellaneous warnings [dynamic] |
|
warn when fields of a record are uninitialised [dynamic] |
|
warn when class methods are undefined [dynamic] |
|
warn about top-level functions without signatures [dynamic] |
|
warn when names are shadowed [dynamic] |
|
warn about overlapping patterns [dynamic] |
|
warn about lambda-patterns that can fail [dynamic] |
|
warn when defaulting happens [dynamic] |
|
warn about bindings that are unused [dynamic] |
|
warn about unnecessary imports [dynamic] |
|
warn about variables in patterns that aren't used [dynamic] |
Optimisation levels
|
Enable default optimisation (level 1) [static] |
|---|---|
|
Set optimisation level n [static] |
Individual optimisations
-fcase-merge-
Enable case-merging [static]
-fdicts-strict-
Make dictionaries strict [dynamic]
-fdo-eta-reduction-
Enable eta-reduction [static]
-fdo-lambda-eta-expansion-
Enable lambda eta-reduction [static]
-fexcess-precision-
Enable excess intermediate precision [static]
-ffoldr-build-on-
Enable foldr-build optimisation [static]
-fignore-asserts-
Ignore assertions in the source [static]
-fignore-interface-pragmas-
Ignore pragmas in interface files [static]
-flet-no-escape-
Enable let-no-escape optimisation [static]
-fliberate-case-threshold-
Tweak the liberate-case optimisation (default: 10) [static]
-fomit-interface-pragmas-
Don't generate interface pragmas [static]
-fmax-worker-args-
If a worker has that many arguments, none will be unpacked anymore (default: 10) [static]
-fmax-simplifier-iterations-
Set the max iterations for the simplifier [static]
-fno-cpr-
Turn off CPR analysis [static]
-fno-cse-
Turn off common sub-expression [static]
-fno-pre-inlining-
Turn off pre-inlining [static]
-fno-strictness-
Turn off strictness analysis [static]
-fnumbers-strict-
Make numbers strict [dynamic]
-funbox-strict-fields-
Flatten strict constructor fields [static]
-funfolding-creation-threshold-
Tweak unfolding settings [static]
-funfolding-fun-discount-
Tweak unfolding settings [static]
-funfolding-keeness-factor-
Tweak unfolding settings [static]
-funfolding-update-in-place-
Tweak unfolding settings [static]
-funfolding-use-threshold-
Tweak unfolding settings [static]
-fusagesp-
Turn on UsageSP analysis [static]
Options
-
-auto -
Auto-add
_scc_s to all exported functions [static]
-
-auto-all -
Auto-add
_scc_s to all top-level functions [static]
-
-auto-dicts -
Auto-add
_scc_s to all dictionaries [static]
-
-caf-all -
Auto-add
_scc_s to all CAFs [static]
-
-prof -
Turn on profiling [static]
-
-ticky -
Turn on ticky-ticky profiling [static]
Options
-
-gransim -
Enable GRANSIM [static]
-
-parallel -
Enable Parallel Haskell [static]
-
-smp -
Enable SMP support [static]
Options
-
-cpp -
Run the C pre-processor on Haskell source files [dynamic]
-
-Dsymbol="value" -
Define a symbol in the C pre-processor [dynamic]
-
-Usymbol -
Undefine a symbol in the C pre-processor [dynamic]
-
-Idir -
Add dir to the directory search list for
#includefiles [static]
Options
-
-#include file -
Include file when compiling the .hc file [dynamic]
Options
-
-fasm -
Use the native code generator [dynamic]
-
-fvia-C -
Compile via C [dynamic]
-
-fno-code -
Omit code generation [static]
Options
-
-dynamic -
Use dynamic Haskell libraries (if available) [static]
-
-llib -
Link in library lib [static]
-
-Ldir -
Add dir to the list of directories searched for libraries [static]
-
-package name -
Link in package name [static]
-
-framework name -
On Darwin/MacOS X only, link in the framework name. This option corresponds to the
-frameworkoption for Apple's Linker. [static]
-
-framework-path name -
On Darwin/MacOS X only, add dir to the list of directories searched for frameworks. This option corresponds to the
-Foption for Apple's Linker. [static]
-
-split-objs -
Split objects (for libraries) [static]
-
-static -
Use static Haskell libraries [static]
-
-no-hs-main -
Don't asssume this program contains
main[static]
Replacing phases
|
Use cmd as the literate pre-processor [static] |
|---|---|
|
Use cmd as the C pre-processor (with |
|
Use cmd as the C compiler [static] |
|
Use cmd as the assembler [static] |
|
Use cmd as the linker [static] |
|
Use cmd as the DLL generator [static] |
|
Use cmd as the dependency generator [static] |
|
Use cmd as the pre-processor (with |
Forcing options to particular phases
|
pass option to the literate pre-processor [dynamic] |
|---|---|
|
pass option to cpp (with |
|
pass option to the C compiler [dynamic] |
|
pass option to the assembler [dynamic] |
|
pass option to the linker [static] |
|
pass option to the DLL generator [static] |
|
pass option to the dependency generator [static] |
Options
-
-mv8 -
(SPARC only) enable version 8 support [static]
-monly-[32]-regs-
(x86 only) give some registers back to the C compiler [dynamic]
Options
-
-fext-core -
Generate .hcr external Core files [static]
Options
-
-dcore-lint -
Turn on internal sanity checking [dynamic]
-
-ddump-absC -
Dump abstract C [dynamic]
-
-ddump-asm -
Dump assembly [dynamic]
-
-ddump-bcos -
Dump interpreter byte code [dynamic]
-
-ddump-cpranal -
Dump output from CPR analysis [dynamic]
-
-ddump-cse -
Dump CSE output [dynamic]
-
-ddump-deriv -
Dump deriving output [dynamic]
-
-ddump-ds -
Dump desugarer output [dynamic]
-
-ddump-flatC -
Dump `flat' C [dynamic]
-
-ddump-foreign -
Dump
foreign exportstubs [dynamic]
-
-ddump-inlinings -
Dump inlining info [dynamic]
-
-ddump-occur-anal -
Dump occurrence analysis output [dynamic]
-
-ddump-parsed -
Dump parse tree [dynamic]
-
-ddump-realC -
Dump `real' C [dynamic]
-
-ddump-rn -
Dump renamer output [dynamic]
-
-ddump-rules -
Dump rules [dynamic]
-
-ddump-sat -
Dump saturated output [dynamic]
-
-ddump-simpl -
Dump final simplifier output [dynamic]
-
-ddump-simpl-iterations -
Dump output from each simplifier iteration [dynamic]
-
-ddump-spec -
Dump specialiser output [dynamic]
-
-ddump-stg -
Dump final STG [dynamic]
-
-ddump-stranal -
Dump strictness analyser output [dynamic]
-
-ddump-tc -
Dump typechecker output [dynamic]
-
-ddump-types -
Dump type signatures [dynamic]
-
-ddump-usagesp -
Dump UsageSP analysis output [dynamic]
-
-ddump-worker-wrapper -
Dump worker-wrapper output [dynamic]
-
-ddump-rn-trace -
Trace renamer [dynamic]
-
-ddump-rn-stats -
Renamer stats [dynamic]
-
-ddump-stix -
Native code generator intermediate form [dynamic]
-
-ddump-simpl-stats -
Dump simplifier stats [dynamic]
-
-dppr-debug -
Turn on debug printing (more verbose) [static]
-
-dppr-noprags -
Don't output pragma info in dumps [static]
-
-dppr-user-length -
Set the depth for printing expressions in error msgs [static]
-
-dsource-stats -
Dump haskell source stats [dynamic]
-
-dstg-lint -
STG pass sanity checking [dynamic]
-
-dstg-stats -
Dump STG stats [dynamic]
-
-dusagesp-lint -
UsageSP sanity checker [dynamic]
-
-dverbose-core2core -
Show output from each core-to-core pass [dynamic]
-
-dverbose-stg2stg -
Show output from each STG-to-STG pass [dynamic]
-
-unreg -
Enable unregisterised compilation [static]
Options
-
-funfold-casms-in-hi-file -
Allow casms in unfoldings [static]
-
-femit-extern-decls -
??? [static]
-
-fglobalise-toplev-names -
Make all top-level names global (for
-split-objs) [static]
-
-fno-hi-version-check -
Don't complain about
.hifile mismatches [static]
-
-dno-black-holing -
Turn off black holing (probably doesn't work) [static]
-
-fno-method-sharing -
Don't share specialisations of overloaded functions [static]
-
-fno-prune-decls -
Renamer: don't prune declarations [static]
-
-fno-prune-tydecls -
Renamer: don't prune type declarations [static]
-
-fhistory-size -
Set simplification history size [static]
-
-funregisterised -
Unregisterised compilation (use
-unreginstead) [static]
-
-fno-asm-mangling -
Turn off assembly mangling (use
-unreginstead) [static]
Files
/usr/lib/ghc-5.04.3