Man Linux: Main Page and Category List


       GHC - the Glasgow Haskell Compiler


       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,  and -#include.  The OPTIONS sections lists the status of each

       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

       .x_o   way x object files; common ways are: p, u, s

       .x_hi  way x interface files


   Help and verbosity options
       -?  -help  -n  -v  -vn  -V   --supported-languages   --info   --version
       --numeric-version  --print-libdir  -ferror-spans  -Hsize  -Rghc-timing

   Which phases to run
       -E  -C  -S  -c  -x suffix

   Alternative modes of operation
       --interactive  --make  -e expr  -M

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

   Keeping intermediate files
       -keep-hc-file or
                        -keep-hc-files  -keep-s-file or
                        -keep-s-files  -keep-raw-s-file or
                        -keep-raw-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          -read-dot-ghci           -fbreak-on-exception
       -fno-break-on-exception       -fbreak-on-error      -fno-break-on-error
       -fprint-evld-with-show  -fno-print-evld-with-show   -fprint-bind-result
       -fno-print-bind-result                         -fno-print-bind-contents

       -package-name P  -package  P   -hide-all-packages   -hide-package  name
       -ignore-package name  -package-conf file  -no-user-package-conf

   Language options
       -fglasgow-exts         -fno-glasgow-exts         -XOverlappingInstances
       -XNoOverlappingInstances  -XIncoherentInstances -XNoIncoherentInstances
       -XUndecidableInstances   -XNoUndecidableInstances    -fcontext-stack=Nn
       -XArrows             -XNoArrows              -XDisambiguateRecordFields
       -XNoDisambiguateRecordFields                 -XForeignFunctionInterface
       -XNoForeignFunctionInterface  -XGenerics -XNoGenerics  -XImplicitParams
       -XNoImplicitParams      -firrefutable-tuples    -fno-irrefutable-tuples
       -XNoImplicitPrelude   -XImplicitPrelude     -XNoMonomorphismRestriction
       -XMonomorphismRrestriction      -XNoNPlusKPatterns     -XNPlusKPatterns
       -XNoMonoPatBinds  -XMonoPatBinds   -XRelaxedPolyRec  -XNoRelaxedPolyRec
       -XExtendedDefaultRules   -XNoExtendedDefaultRules   -XOverloadedStrings
       -XNoOverloadedStrings       -XGADTs      -XNoGADTs       -XTypeFamilies
       -XNoTypeFamilies      -XScopedTypeVariables     -XNoScopedTypeVariables
       -XMonoLocalBinds         -XNoMonoLocalBinds           -XTemplateHaskell
       -XNoTemplateHaskell    -XQuasiQuotes   -XNoQuasiQuotes   -XBangPatterns
       -XNoBangPatterns   -XCPP  -XNoCPP   -XPatternGuards   -XNoPatternGuards
       -XViewPatterns   -XNoViewPatterns    -XUnicodeSyntax  -XNoUnicodeSyntax
       -XMagicHash           -XNoMagicHash             -XNewQualifiedOperators
       -XNoNewQualifiedOperators       -XExplicitForALl     -XNoExplicitForAll
       -XPolymorphicComponents     -XNoPolymorphicComponents      -XRank2Types
       -XNoRank2Types    -XRankNTypes   -XNoRankNTypes    -XImpredicativeTypes
       -XNoImpredicativeTypes                      -XExistentialQuantification
       -XNoExistentialQuantification     -XKindSignatures   -XNoKindSignatures
       -XEmptyDataDecls         -XNoEmptyDataDecls          -XParallelListComp
       -XNoParallelListComp      -XTransformListComp     -XNoTransformListComp
       -XUnliftedFFITypes     -XNoUnliftedFFITypes       -XLiberalTypeSynonyms
       -XNoLiberalTypeSynonyms         -XTypeOperators       -XNoTypeOperators
       -XRecursiveDo  -XNoRecursiveDo   -XPArr   -XNoPArr    -XRecordWildCards
       -XNoRecordWildCards          -XNamedFieldPuns        -XNoNamedFieldPuns
       -XDisambiguateRecordFields                 -XNoDisambiguateRecordFields
       -XUnboxedTuples         -XNoUnboxedTuples          -XStandaloneDeriving
       -XNoStandaloneDeriving    -XDeriveDataTypeable   -XNoDeriveDataTypeable
       -XGeneralizedNewtypeDeriving             -XNoGeneralizedNewtypeDeriving
       -XTypeSynonymInstances   -XNoTypeSynonymInstances    -XFlexibleContexts
       -XNoFlexibleContexts      -XFlexibleInstances     -XNoFlexibleInstances
       -XConstrainedClassMethods                   -XNoConstrainedClassMethods
       -XMultiParamTypeClasses                       -XNoMultiParamTypeClasses
       -XFunctionalDependencies  -XNoFunctionalDependencies   -XPackageImports

       -W  -w   -w   -Wall  -w  -Werror   -Wwarn   -fwarn-unrecognised-pragmas
       -fno-warn-unrecognised-pragmas             -fwarn-warnings-deprecations
       -fno-warn-warnings-deprecations                 -fwarn-deprecated-flags
       -fno-warn-deprecated-flags                     -fwarn-duplicate-exports
       -fno-warn-duplicate-exports  -fwarn-hi-shadowing -fno-warn-hi-shadowing
       -fwarn-implicit-prelude                      -fno-warn-implicit-prelude
       -fwarn-incomplete-patterns                -fno-warn-incomplete-patterns
       -fwarn-incomplete-record-updates    -fno-warn-incomplete-record-updates
       -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-orphans        -fno-warn-orphans
       -fwarn-overlapping-patterns              -fno-warn-overlapping-patterns
       -fwarn-simple-patterns      -fno-warn-simple-patterns       -fwarn-tabs
       -fno-warn-tabs        -fwarn-type-defaults      -fno-warn-type-defaults
       -fwarn-monomorphism-restriction      -fno-warn-monomorphism-restriction
       -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

   Optimisation levels
       -O -O0  -On -O0

   Individual optimisations
       -fcase-merge    -fno-case-merge     -fdicts-strict    -fno-dicts-strict
       -fmethod-sharing         -fno-method-sharing         -fdo-eta-reduction
       -fno-do-eta-reduction                         -fdo-lambda-eta-expansion
       -fno-do-lambda-eta-expansion   -fexcess-precision -fno-excess-precision
       -fignore-asserts    -fno-ignore-asserts      -fignore-interface-pragmas
       -fno-ignore-interface-pragmas                  -fomit-interface-pragmas
       -fno-omit-interface-pragmas    -fmax-worker-args    -fsimplifier-phases
       -fmax-simplifier-iterations   -fno-state-hack   -fcse   -ffull-laziness
       -frewrite-rules   -fno-rewrite-rules    -fstrictness      -fspec-constr
       -fspec-constr-threshold=n                    -fno-spec-constr-threshold
       -fspec-constr-count=n      -fno-spec-constr-count       -fliberate-case
       -fstatic-argument-transformation            -fliberate-case-threshold=n
       -fno-liberate-case-threshold                      -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-use-threshold
       -fno-unfolding-use-threshold  -fno-pre-inlining  -feager-blackholing

   Profiling options
       -auto  -no-auto   -auto-all  -no-auto-all   -caf-all -no-caf-all  -prof

   Program coverage options
       -fhpc  -hpcdir dir

   Haskell pre-processor options

   C pre-processor options
       -cpp  -Dsymbol=value -U  -Usymbol  -Idir

   Code generation options
       -fasm   -fvia-C   -fno-code  -fbyte-code  -fobject-code

   Linking options
       -shared  -fPIC  -dynamic  -dynload   -framework  name   -framework-path
       name    -llib    -Ldir    -main-is    --mk-dll   -no-hs-main   -no-link
       -split-objs  -static  -threaded  -debug   -eventlog   -fno-gen-manifest
       -fno-embed-manifest  -fno-shared-implib

   Replacing phases
       -pgmL cmd  -pgmP cmd  -pgmc cmd  -pgmm cmd  -pgms cmd  -pgma cmd  -pgml
       cmd  -pgmdll cmd  -pgmF cmd  -pgmwindres cmd

   Forcing options to particular phases
       -optL option  -optP option  -optF option  -optc  option   -optm  option
       -opta option  -optl option  -optdll option  -optwindres option

   Platform-specific options

   External core file options

   Compiler debugging options
       -dcore-lint    -ddump-asm    -ddump-bcos    -ddump-cmm   -ddump-cpranal
       -ddump-cse   -ddump-deriv   -ddump-ds    -ddump-flatC    -ddump-foreign
       -ddump-hpc     -ddump-inlinings     -ddump-occur-anal    -ddump-opt-cmm
       -ddump-parsed   -ddump-prep   -ddump-rn    -ddump-rules    -ddump-simpl
       -ddump-simpl-phases         -ddump-simpl-iterations         -ddump-spec
       -ddump-splices   -ddump-stg   -ddump-stranal   -ddump-tc   -ddump-types
       -ddump-worker-wrapper          -ddump-if-trace          -ddump-tc-trace
       -ddump-rn-trace  -ddump-rn-stats  -ddump-simpl-stats  -dno-debug-output
       -dppr-debug    -dsuppress-uniques    -dppr-noprags    -dppr-user-length
       -dsource-stats        -dcmm-lint         -dstg-lint         -dstg-stats
       -dverbose-core2core           -dverbose-stg2stg           -dshow-passes

   Misc compiler options
       -fno-hi-version-check         -dno-black-holing          -fhistory-size
       -funregisterised  -fno-asm-mangling


       -?     help

       -help  help

       -n     do a dry run

       -v     verbose mode (equivalent to -v3)

       -vn    set verbosity level

       -V     display GHC version

              display the supported language extensions

       --info display information about the compiler

              display GHC version

              display GHC version (numeric only)

              display GHC library directory

              output full span in error messages

       -Hsize Set the minimum heap size to size

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


       -E     Stop after preprocessing (.hspp file)

       -C     Stop after generating C (.hc file)

       -S     Stop after generating assembly (.s file)

       -c     Do not link

       -x suffix
              Override default behaviour for source files


              Interactive  mode  - normally used by just running ghci; see for

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

       -e expr
              Evaluate expr; see for details.

       -M     Generate dependency information suitable for use in a  Makefile;
              see for details.


       -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

       -o filename
              set output filename

       -odir dir
              set directory for object files

       -ohi filename
              set the filename in which to put the interface

       -osuf suffix
              set the output file suffix

       -stubdir dir
              redirect FFi stub files

       -outputdir dir
              set output directory


       -keep-hc-file or
                               -keep-hc-files retain intermediate .hc files

       -keep-s-file or
                               -keep-s-files retain intermediate .s files

       -keep-raw-s-file or
                               -keep-raw-s-files  retain  intermediate  .raw_s

              retain all intermediate temporary files


              set the directory for temporary files


              add dir, dir2, etc. to import path

       -i     Empty the import directory list


              Dump the new interface to stdout

              Show the differences vs. the old interface

              Dump a minimal set of imports

       --show-iface file
              See .


              Turn off recompilation checking; implied by any -ddump-X option


              Disable reading of .ghci files

              Enable reading of .ghci files

              Break on any exception thrown

              Break on uncaught exceptions and errors

              Enable usage of Show instances in :print

              Turn on printing of binding results in GHCi

              Turn off printing of binding contents in GHCi

              Turn off implicit qualified import of everything in GHCi


       -package-name P
              Compile to be part of package P

       -package P
              Expose package P

              Hide all packages by default

       -hide-package name
              Hide package P

       -ignore-package name
              Ignore package P

       -package-conf file
              Load more packages from file

              Don't load the user's package config file.


              Enable most language extensions

              Enable overlapping instances

              Enable incoherent instances. Implies -XOverlappingInstances

              Enable undecidable instances

              set the limit for context reduction. Default is 20.

              Enable arrow notation extension

              Enable record field disambiguation

              Enable foreign function interface (implied by -fglasgow-exts)

              Enable generic classes

              Enable Implicit Parameters. Implied by -fglasgow-exts.

              Make tuple pattern matching irrefutable

              Don't implicitly import Prelude

              Disable the monomorphism restriction

              Disable support for n+k patterns

              Make pattern bindings polymorphic

              Relaxed checking for mutually-recursive polymorphic functions

              Use GHCi's extended default rules in a normal module

              Enable overloaded string literals.

              Enable generalised algebraic data types.

              Enable type families.

              Enable   lexically-scoped    type    variables.    Implied    by

              Enable do not generalise local bindings.

              Enable Template Haskell. No longer implied by -fglasgow-exts.

              Enable quasiquotation.

              Enable bang patterns.

       -XCPP  Enable the C preprocessor.

              Enable pattern guards.

              Enable view patterns.

              Enable unicode syntax.

              Allow "#" as a postfix modifier on identifiers.

              Enable new qualified operator syntax

              Enable    explicit    universal   quantification.   Implied   by
              -XScopedTypeVariables,   -XLiberalTypeSynonyms,    -XRank2Types,
              -XRankNTypes,                           -XPolymorphicComponents,

              Enable polymorphic components for data constructors.

              Enable rank-2 types.

              Enable rank-N types.

              Enable impredicative types.

              Enable existential quantification.

              Enable kind signatures.

              Enable empty data declarations.

              Enable parallel list comprehensions.

              Enable generalised list comprehensions.

              Enable unlifted FFI types.

              Enable liberalised type synonyms.

              Enable type operators.

              Enable recursive do (mdo) notation.

       -XPArr Enable parallel arrays.

              Enable record wildcards.

              Enable record puns.

              Enable record field disambiguation.

              Enable unboxed tuples.

              Enable standalone deriving.

              Enable deriving for the Data and Typeable classes.

              Enable newtype deriving.

              Enable type synonyms in instance heads.

              Enable flexible contexts.

              Enable flexible instances.

              Enable constrained class methods.

              Enable multi parameter type classes.

              Enable functional dependencies.

              Enable package-qualified imports.


       -W     enable normal warnings

       -w     disable all warnings

       -Wall  enable almost all warnings (details in )

              make warnings fatal

       -Wwarn make warnings non-fatal

              warn about uses of pragmas that GHC doesn't recognise

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

              warn about uses of commandline flags that are deprecated

              warn when an entity is exported multiple times

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

              warn when the Prelude is implicitly imported

              warn when a pattern match could fail

              warn when a record update could fail

              warn when fields of a record are uninitialised

              warn when class methods are undefined

              warn about top-level functions without signatures

              warn when names are shadowed

              warn  when  the  module contains orphan instance declarations or
              rewrite rules

              warn about overlapping patterns

              warn about lambda-patterns that can fail

              warn if there are tabs in the source file

              warn when defaulting happens

              warn when the Monomorphism Restriction is applied

              warn about bindings that are unused

              warn about unnecessary imports

              warn about variables in patterns that aren't used

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

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


       -O     Enable default optimisation (level 1)

       -On    Set optimisation level n


              Enable case-merging. Implied by -O.

              Make dictionaries strict

              Share specialisations of overloaded functions (default)

              Enable eta-reduction. Implied by -O.

              Enable lambda eta-reduction

              Enable excess intermediate precision

              Ignore assertions in the source

              Ignore pragmas in interface files

              Don't generate interface pragmas

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

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

              Set the max iterations for the simplifier

              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.

       -fcse  Turn on common sub-expression elimination. Implied by -O.

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

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

              Turn on strictness analysis. Implied by -O.

              Turn on the SpecConstr transformation. Implied by -O2.

              Set  the  size  threshold for the SpecConstr transformation to n
              (default: 200)

              Set to n (default: 3) the maximum number of specialisations that
              will   be  created  for  any  one  function  by  the  SpecConstr

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

              Turn on the static argument transformation. Implied by -O2.

              Set the size threshold for the liberate-case transformation to n
              (default: 200)

              Flatten strict constructor fields

              Tweak unfolding settings

              Tweak unfolding settings

              Tweak unfolding settings

              Tweak unfolding settings

              Turn off pre-inlining

              Turn on eager blackholing


       -auto  Auto-add _scc_s to all exported functions

              Auto-add _scc_s to all top-level functions

              Auto-add _scc_s to all CAFs

       -prof  Turn on profiling

       -ticky Turn on ticky-ticky profiling


       -fhpc  Turn on Haskell program coverage instrumentation

       -hpcdir dir
              Directory  to  deposit .mix files during compilation (default is


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


       -cpp   Run the C pre-processor on Haskell source files

              Define a symbol in the C pre-processor

              Undefine a symbol in the C pre-processor

       -Idir  Add dir to the directory search list for #include files


       -fasm  Use the native code generator

              Compile via C

              Omit code generation

              Generate byte-code

              Generate object code


              Generate a shared library (as opposed to an executable)

       -fPIC  Generate position-independent code (where available)

              Use dynamic Haskell libraries (if available)

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

       -framework name
              On  Darwin/MacOS X only, link in the framework name. This option
              corresponds to the -framework option for Apple's Linker.

       -framework-path name
              On Darwin/MacOS X only, add  dir  to  the  list  of  directories
              searched  for  frameworks.  This  option  corresponds  to the -F
              option for Apple's Linker.

       -llib  Link in library lib

       -Ldir  Add dir to the list of directories searched for libraries

              Set main module and function

              DLL-creation mode (Windows only)

              Don't assume this program contains main

              Omit linking

              Split objects (for libraries)

              Use static Haskell libraries

              Use the threaded runtime

       -debug Use the debugging runtime

              Enable runtime event tracing

              Do not generate a manifest file (Windows only)

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

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


       -pgmL cmd
              Use cmd as the literate pre-processor

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

       -pgmc cmd
              Use cmd as the C compiler

       -pgmm cmd
              Use cmd as the mangler

       -pgms cmd
              Use cmd as the splitter

       -pgma cmd
              Use cmd as the assembler

       -pgml cmd
              Use cmd as the linker

       -pgmdll cmd
              Use cmd as the DLL generator

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

       -pgmwindres cmd
              Use cmd as the program for embedding manifests on Windows.


       -optL option
              pass option to the literate pre-processor

       -optP option
              pass option to cpp (with -cpp only)

       -optF option
              pass option to the custom pre-processor

       -optc option
              pass option to the C compiler

       -optm option
              pass option to the mangler

       -opta option
              pass option to the assembler

       -optl option
              pass option to the linker

       -optdll option
              pass option to the DLL generator

       -optwindres option
              pass option to windres.


              (x86 only) give some registers back to the C compiler


              Generate .hcr external Core files


              Turn on internal sanity checking

              Dump assembly

              Dump interpreter byte code

              Dump C-- output

              Dump output from CPR analysis

              Dump CSE output

              Dump deriving output

              Dump desugarer output

              Dump `flat' C

              Dump foreign export stubs

              Dump after instrumentation for program coverage

              Dump inlining info

              Dump occurrence analysis output

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

              Dump parse tree

              Dump prepared core

              Dump renamer output

              Dump rules

              Dump final simplifier output

              Dump output from each simplifier phase

              Dump output from each simplifier iteration

              Dump specialiser output

              Dump TH spliced expressions, and what they evaluate to

              Dump final STG

              Dump strictness analyser output

              Dump typechecker output

              Dump type signatures

              Dump worker-wrapper output

              Trace interface files

              Trace typechecker

              Trace renamer

              Renamer stats

              Dump simplifier stats

              Suppress unsolicited debugging output

              Turn on debug printing (more verbose)

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

              Don't output pragma info in dumps

              Set the depth for printing expressions in error msgs

              Dump haskell source stats

              C-- pass sanity checking

              STG pass sanity checking

              Dump STG stats

              Show output from each core-to-core pass

              Show output from each STG-to-STG pass

              Print out each pass name as it happens

              Show statistics for fast string usage when finished


              Don't complain about .hi file mismatches

              Turn off black holing (probably doesn't work)

              Set simplification history size

              Unregisterised compilation (use -unreg instead)

              Turn off assembly mangling (use -unreg instead)




       Copyright 2002, The University Court of the University of Glasgow.
       All rights reserved.


       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 <>
       for the Debian GNU/Linux system (but may be used by others).