Feature proposal: ghc --full-flag-help ?

Simon Marlow simonmarhaskell at gmail.com
Wed Mar 14 07:18:20 EDT 2007

Marc Weber wrote:
> On Tue, Mar 13, 2007 at 01:57:10PM +0100, Marc Weber wrote:
>> Hi
>> I did notice a lot of times that I just didn't remember the name of
>> option X. How to look it up? Walk through html or pdf documentation?
> Just printing a link to ghc online docs is not enough because:
>   * maybe no internet availible
>   * internet slow?
>   * You still need to search/ scroll (too much effort)
>   * getting help on flags is default behaviour of any linux application
>     and most haskell developers are working on this os I think.
>     Have you ever tried  info bash, info grep, info whatsoever and got
>     the result "please visit http:// .. ?
>     That's like invoking ghc printing "This is only a fake. Please
>     execute realghc instead"
> I'd love to implement this. But I might need some time.
> I already know where to start (hacking on ghc intro on the ghc
> documentation site .. ;-)
> How should it look like?

We already have support for man pages, I think we should try to avoid 
duplication here.  If your GHC man page is installed correctly, then 'man ghc' 
should give you a nice consise list of options (see attached file, and scripts 
in docs/man in a GHC tree).

So I think if we are to have a 'ghc --full-help' then it should just output the 
man page, as Ketil suggested.  But we should make this work and output the 
correct man page regardless of whether 'man ghc' works, because you might have 
multiple GHC versions installed, and/or the system might not even have a man 
command (Windows).  So every GHC installation should include a text version of 
the man page, that should be fairly easy to arrange.


-------------- next part --------------
GHC(1)                     Glasgow Haskell Compiler                     GHC(1)

       GHC - the Glasgow Haskell Compiler

       gghhcc [_o_p_t_i_o_n|_f_i_l_e_n_a_m_e]...
       gghhccii [_o_p_t_i_o_n|_f_i_l_e_n_a_m_e]...

       This  manual  page  documents  briefly the gghhcc and gghhccii commands.  Note
       that gghhccii is not yet available on all architectures.   Extensive  docu-
       mentation   is  available  in  various  other  formats  including  DVI,
       PostScript and HTML; see below.

       Each of GHC's command line options is classified as  either  _s_t_a_t_i_c  or
       _d_y_n_a_m_i_c.   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  --vv,  --ccpppp,  --ffaassmm,
       --ffvviiaa--CC,  and --##iinncclluuddee.  The OPTIONS sections lists the status of each

       Common suffixes of file names for Haskell are:

       ..hhss    Haskell source code; preprocess, compile

       ..llhhss   literate Haskell source; unlit, preprocess, compile

       ..hhii    Interface file; contains information about exported symbols

       ..hhcc    intermediate C files

       .._x__oo   way _x object files; common ways are: pp, uu, ss

       .._x__hhii  way _x interface files

   HHeellpp aanndd vveerrbboossiittyy ooppttiioonnss
       -?    -help    -n    -v    -v_n    -V    --version     --numeric-version
       --print-libdir  -ferror-spans  -H_s_i_z_e  -Rghc-timing

   WWhhiicchh pphhaasseess ttoo rruunn
       -E  -C  -S  -c  -x _s_u_f_f_i_x

   AAlltteerrnnaattiivvee mmooddeess ooff ooppeerraattiioonn
       --interactive  --make  -e expr  -M

   RReeddiirreeccttiinngg oouuttppuutt
       -hcsuf  _s_u_f_f_i_x  -hidir _d_i_r  -hisuf _s_u_f_f_i_x  -o _f_i_l_e_n_a_m_e  -odir _d_i_r  -ohi
       _f_i_l_e_n_a_m_e   -osuf _s_u_f_f_i_x  -stubdir _d_i_r

   KKeeeeppiinngg iinntteerrmmeeddiiaattee ffiilleess
       -keep-hc-file  -keep-s-file  -keep-raw-s-file  -keep-tmp-files

   TTeemmppoorraarryy ffiilleess

   FFiinnddiinngg iimmppoorrttss
       -i_d_i_r_1:_d_i_r_2:...  -i

   IInntteerrffaaccee ffiillee ooppttiioonnss
       -ddump-hi  -ddump-hi-diffs  -ddump-minimal-imports  --show-iface _f_i_l_e

   RReeccoommppiillaattiioonn cchheecckkiinngg
       -fforce-recomp -fno-force-recomp

   IInntteerraaccttiivvee--mmooddee ooppttiioonnss
       -ignore-dot-ghci  -read-dot-ghci  -fdebugging  -fno-debugging

       -package-name _P  -package  _P   -hide-all-packages   -hide-package  _n_a_m_e
       -ignore-package _n_a_m_e  -package-conf _f_i_l_e  -no-user-package-conf

   LLaanngguuaaggee ooppttiioonnss
       -fallow-overlapping-instances          -fno-allow-overlapping-instances
       -fallow-incoherent-instances            -fno-allow-incoherent-instances
       -fallow-undecidable-instances          -fno-allow-undecidable-instances
       -fcontext-stack=N_n 20  -farrows -fno-arrows   -ffi  or  -fffi  -fno-ffi
       -fgenerics     -fno-fgenerics      -fglasgow-exts     -fno-glasgow-exts
       -fimplicit-params      -fno-implicit-params        -firrefutable-tuples
       -fno-irrefutable-tuples     -fno-implicit-prelude    -fimplicit-prelude
       -fno-monomorphism-restriction                -fmonomorphism-restriction
       -fno-mono-pat-binds      -fmono-pat-binds      -fextended-default-rules
       -fno-extended-default-rules                        -foverloaded-strings
       -fno-overloaded-strings                         -fscoped-type-variables
       -fno-scoped-type-variables      -fth      -fno-th       -fbang-patterns

       -W     -w      -w      -Wall    -w     -Werror      -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-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-unused-binds    -fno-warn-unused-binds     -fwarn-unused-imports
       -fno-warn-unused-imports                          -fwarn-unused-matches

   OOppttiimmiissaattiioonn lleevveellss
       -O -O0  -O_n -O0

   IInnddiivviidduuaall ooppttiimmiissaattiioonnss
       -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
       -frules-off    -frules-off     -fignore-asserts     -fno-ignore-asserts
       -fignore-interface-pragmas                -fno-ignore-interface-pragmas
       -fliberate-case-threshold                  -fno-liberate-case-threshold
       -fomit-interface-pragmas -fno-omit-interface-pragmas  -fmax-worker-args
       -fmax-simplifier-iterations          -fno-state-hack           -fno-cse
       -fno-full-laziness           -fno-pre-inlining          -fno-strictness
       -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

   PPrrooffiilliinngg ooppttiioonnss
       -auto  -no-auto   -auto-all  -no-auto-all   -caf-all -no-caf-all  -prof

   HHaasskkeellll pprree--pprroocceessssoorr ooppttiioonnss

   CC pprree--pprroocceessssoorr ooppttiioonnss
       -cpp  -D_s_y_m_b_o_l=_v_a_l_u_e -U  -U_s_y_m_b_o_l  -I_d_i_r

   CC ccoommppiilleerr ooppttiioonnss
       -#include _f_i_l_e

   CCooddee ggeenneerraattiioonn ooppttiioonnss
       -fasm   -fvia-C   -fno-code

   LLiinnkkiinngg ooppttiioonnss
       -fPIC  -dynamic  -framework _n_a_m_e  -framework-path  _n_a_m_e   -l_l_i_b   -L_d_i_r
       -main-is    --mk-dll    -no-hs-main    -no-link   -split-objs   -static
       -threaded  -debug

   RReeppllaacciinngg pphhaasseess
       -pgmL _c_m_d  -pgmP _c_m_d  -pgmc _c_m_d  -pgmm _c_m_d  -pgms _c_m_d  -pgma _c_m_d  -pgml
       _c_m_d  -pgmdll _c_m_d  -pgmF _c_m_d

   FFoorrcciinngg ooppttiioonnss ttoo ppaarrttiiccuullaarr pphhaasseess
       -optL  _o_p_t_i_o_n   -optP  _o_p_t_i_o_n  -optF _o_p_t_i_o_n  -optc _o_p_t_i_o_n  -optm _o_p_t_i_o_n
       -opta _o_p_t_i_o_n  -optl _o_p_t_i_o_n  -optdll _o_p_t_i_o_n  -optdep _o_p_t_i_o_n

   PPllaattffoorrmm--ssppeecciiffiicc ooppttiioonnss

   EExxtteerrnnaall ccoorree ffiillee ooppttiioonnss

   CCoommppiilleerr ddeebbuuggggiinngg ooppttiioonnss
       -dcore-lint   -ddump-asm    -ddump-bcos    -ddump-cmm    -ddump-cpranal
       -ddump-cse    -ddump-deriv    -ddump-ds   -ddump-flatC   -ddump-foreign
       -ddump-inlinings   -ddump-occur-anal    -ddump-opt-cmm    -ddump-parsed
       -ddump-prep         -ddump-rn         -ddump-rules         -ddump-simpl
       -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    -dppr-debug    -dppr-noprags    -dppr-user-length
       -dsource-stats        -dcmm-lint         -dstg-lint         -dstg-stats
       -dverbose-core2core           -dverbose-stg2stg           -dshow-passes
       -dfaststring-stats  -unreg

   MMiisscc ccoommppiilleerr ooppttiioonnss
       -fno-hi-version-check       -dno-black-holing       -fno-method-sharing
       -fhistory-size            -funregisterised            -fno-asm-mangling

       --??     help

       --hheellpp  help

       --nn     do a dry run

       --vv     verbose mode (equivalent to --vv33)

       --vv_n    set verbosity level

       --VV     display GHC version

              display GHC version

              display GHC version (numeric only)

              display GHC library directory

              output full span in error messages

       --HH_s_i_z_e Set the minimum heap size to _s_i_z_e

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

       --EE     Stop after preprocessing (.hspp file)

       --CC     Stop after generating C (.hc file)

       --SS     Stop after generating assembly (.s file)

       --cc     Do not link

       --xx _s_u_f_f_i_x
              Override default behaviour for source files

              Interactive mode - normally used by just running ghci

       ----mmaakkee Build a multi-module Haskell program, automatically figuring out
              dependencies.  Likely  to be much easier, and faster, than using

       --ee eexxpprr
              Evaluate _e_x_p_r

       --MM     Generate dependency information suitable for use in a  Makefile.

       --hhccssuuff _s_u_f_f_i_x
              set the suffix to use for intermediate C files

       --hhiiddiirr _d_i_r
              set directory for interface files

       --hhiissuuff _s_u_f_f_i_x
              set the suffix to use for interface files

       --oo _f_i_l_e_n_a_m_e
              set output filename

       --ooddiirr _d_i_r
              set output directory

       --oohhii _f_i_l_e_n_a_m_e
              set the filename in which to put the interface

       --oossuuff _s_u_f_f_i_x
              set the output file suffix

       --ssttuubbddiirr _d_i_r
              redirect FFi stub files

              retain intermediate .hc files

              retain intermediate .s files

              retain intermediate .raw_s files

              retain all intermediate temporary files

              set the directory for temporary files

              add _d_i_r, _d_i_r_2, etc. to import path

       --ii     Empty the import directory list

              Dump the new interface to stdout

              Show the differences vs. the old interface

              Dump a minimal set of imports

       ----sshhooww--iiffaaccee _f_i_l_e
              Read the interface in _f_i_l_e and dump it as text to stdout.

              Turn off recompilation checking; implied by any --dddduummpp--XX option

              Disable reading of .ghci files

              Enable reading of .ghci files

              Generate bytecode enabled for debugging

              Do not include debugging information in bytecodes

       --ppaacckkaaggee--nnaammee _P
              Compile to be part of package _P

       --ppaacckkaaggee _P
              Expose package _P

              Hide all packages by default

       --hhiiddee--ppaacckkaaggee _n_a_m_e
              Hide package _P

       --iiggnnoorree--ppaacckkaaggee _n_a_m_e
              Ignore package _P

       --ppaacckkaaggee--ccoonnff _f_i_l_e
              Load more packages from _f_i_l_e

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

              Enable overlapping instances

              Enable  incoherent  instances.  Implies  --ffaallllooww--oovveerrllaappppiinngg--iinn--

              Enable undecidable instances

              set the limit for context reduction

              Enable arrow notation extension

       --ffffii or --ffffffii
              Enable foreign function interface (implied by --ffggllaassggooww--eexxttss)

              Enable generic classes

              Enable most language extensions

              Enable Implicit Parameters. Implied by --ffggllaassggooww--eexxttss.

              Make tuple pattern matching irrefutable

              Don't implicitly import Prelude

              Disable the monomorphism restriction

              Make pattern bindings polymorphic

              Use GHCi's extended default rules in a normal module

              Enable overloaded string literals.

              Enable  lexically-scoped  type  variables.  Implied  by  --ffggllaass--

       --fftthh   Enable Template Haskell. No longer implied by --ffggllaassggooww--eexxttss.

              Enable bang patterns.

       --WW     enable normal warnings

       --ww     disable all warnings

       --WWaallll  enable all warnings

              make warnings fatal

              warn about uses of functions & types 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 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 about bindings that are unused

              warn about unnecessary imports

              warn about variables in patterns that aren't used

       --OO     Enable default optimisation (level 1)

       --OO_n    Set optimisation level _n

              Enable case-merging

              Make dictionaries strict

              Enable eta-reduction

              Enable lambda eta-reduction

              Enable excess intermediate precision

              Switch off all rewrite rules (including rules generated by auto-
              matic specialisation of overloaded functions)

              Ignore assertions in the source

              Ignore pragmas in interface files

              Tweak the liberate-case optimisation (default: 10)

              Don't generate interface pragmas

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

              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.

              Turn off common sub-expression

              Turn off full laziness (floating bindings outwards).

              Turn off pre-inlining

              Turn off strictness analysis

              Flatten strict constructor fields

              Tweak unfolding settings

              Tweak unfolding settings

              Tweak unfolding settings

              Tweak unfolding settings

              Tweak unfolding settings

       --aauuttoo  Auto-add _scc_s to all exported functions

              Auto-add _scc_s to all top-level functions

              Auto-add _scc_s to all CAFs

       --pprrooff  Turn on profiling

       --ttiicckkyy Turn on ticky-ticky profiling

       --FF     Enable the use of a pre-processor (set with --ppggmmFF)

       --ccpppp   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

       --II_d_i_r  Add _d_i_r to the directory search list for #include files

       --##iinncclluuddee _f_i_l_e
              Include _f_i_l_e when compiling the .hc file

       --ffaassmm  Use the native code generator

              Compile via C

              Omit code generation

       --ffPPIICC  Generate position-independent code (where available)

              Use dynamic Haskell libraries (if available)

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

       --ffrraammeewwoorrkk--ppaatthh _n_a_m_e
              On  Darwin/MacOS  X  only,  add  _d_i_r  to the list of directories
              searched for frameworks. This option corresponds to the  --FF  op-
              tion for Apple's Linker.

       --ll_l_i_b  Link in library _l_i_b

       --LL_d_i_r  Add _d_i_r 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

       --ddeebbuugg Use the debugging runtime

       --ppggmmLL _c_m_d
              Use _c_m_d as the literate pre-processor

       --ppggmmPP _c_m_d
              Use _c_m_d as the C pre-processor (with --ccpppp only)

       --ppggmmcc _c_m_d
              Use _c_m_d as the C compiler

       --ppggmmmm _c_m_d
              Use _c_m_d as the mangler

       --ppggmmss _c_m_d
              Use _c_m_d as the splitter

       --ppggmmaa _c_m_d
              Use _c_m_d as the assembler

       --ppggmmll _c_m_d
              Use _c_m_d as the linker

       --ppggmmddllll _c_m_d
              Use _c_m_d as the DLL generator

       --ppggmmFF _c_m_d
              Use _c_m_d as the pre-processor (with --FF only)

       --ooppttLL _o_p_t_i_o_n
              pass _o_p_t_i_o_n to the literate pre-processor

       --ooppttPP _o_p_t_i_o_n
              pass _o_p_t_i_o_n to cpp (with --ccpppp only)

       --ooppttFF _o_p_t_i_o_n
              pass _o_p_t_i_o_n to the custom pre-processor

       --ooppttcc _o_p_t_i_o_n
              pass _o_p_t_i_o_n to the C compiler

       --ooppttmm _o_p_t_i_o_n
              pass _o_p_t_i_o_n to the mangler

       --ooppttaa _o_p_t_i_o_n
              pass _o_p_t_i_o_n to the assembler

       --ooppttll _o_p_t_i_o_n
              pass _o_p_t_i_o_n to the linker

       --ooppttddllll _o_p_t_i_o_n
              pass _o_p_t_i_o_n to the DLL generator

       --ooppttddeepp _o_p_t_i_o_n
              pass _o_p_t_i_o_n to the dependency generator

              (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 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 iteration

              Dump specialiser output

              Dump TH splided 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

              Turn on debug printing (more verbose)

              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

       --uunnrreegg Enable unregisterised compilation

              Don't complain about .hi file mismatches

              Turn off black holing (probably doesn't work)

              Don't share specialisations of overloaded functions

              Set simplification history size

              Unregisterised compilation (use --uunnrreegg instead)

              Turn off assembly mangling (use --uunnrreegg instead)

              Turn off printing of binding results in GHCi


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

Glasgow FP Suite                  2002-10-25                            GHC(1)

More information about the Glasgow-haskell-users mailing list