1GHC(1) Glasgow Haskell Compiler GHC(1)
2
3
4
6 ghc - the Glasgow Haskell Compiler
7
9 ghc [option|filename]
10 ghci [option|filename]
11
13 This manual page documents briefly the ghc and ghci commands. Note that
14 ghci is not yet available on all architectures. Extensive documentation
15 is available in various other formats including PDF <https://down‐
16 loads.haskell.org/ghc/latest/docs/users_guide.pdf> and HTML
17 <https://downloads.haskell.org/ghc/latest/docs/html/>.
18
19 Each of GHC's command line options is classified as either static or
20 dynamic. A static flag may only be specified on the command line,
21 whereas a dynamic flag may also be given in an OPTIONS pragma in a
22 source file or set from the GHCi command-line with :set .
23
24 As a rule of thumb, all the language options are dynamic, as are the
25 warning options and the debugging options.
26
27 The rest are static, with the notable exceptions of -v, -cpp, -fasm,
28 -fvia-C, -fllvm, and -#include. The OPTIONS sections lists the status
29 of each flag.
30
31 Common suffixes of file names for Haskell are:
32
33 .hs Haskell source code; preprocess, compile
34
35 .lhs literate Haskell source; unlit, preprocess, compile
36
37 .hi Interface file; contains information about exported symbols
38
39 .hc intermediate C files
40
41 .⟨way⟩_o
42 object files for "way" ⟨way⟩; common ways are:
43
44 dyn dynamically-linked
45
46 p built with profiling
47
48 .⟨way⟩_hi
49 interface files for "way" ⟨way⟩; common ways are:
50
52 Code generation
53 -dynamic-too -fasm -fllvm -fbyte-code -fexternal-dynamic-refs
54 -fllvm -fasm -fno-code -fobject-code -fPIC -fPIE -fwrite-inter‐
55 face
56
57 Debugging the compiler
58 -dcmm-lint -dcore-lint -ddump-asm -ddump-asm-expanded
59 -ddump-asm-liveness -ddump-asm-native -ddump-asm-regalloc
60 -ddump-asm-regalloc-stages -ddump-asm-stats -ddump-bcos
61 -ddump-cfg-weights -ddump-cmm -ddump-cmm-caf -ddump-cmm-cbe
62 -ddump-cmm-cfg -ddump-cmm-cps -ddump-cmm-from-stg
63 -ddump-cmm-info -ddump-cmm-opt -ddump-cmm-proc
64 -ddump-cmm-procmap -ddump-cmm-raw -ddump-cmm-sink -ddump-cmm-sp
65 -ddump-cmm-split -ddump-cmm-switch -ddump-cmm-verbose
66 -ddump-cmm-verbose-by-proc -ddump-core-stats -ddump-cpr-signa‐
67 tures -ddump-cpranal -ddump-cse -ddump-deriv -ddump-ds
68 -ddump-ds-preopt -ddump-ec-trace -ddump-file-prefix=⟨str⟩
69 -ddump-foreign -ddump-hie -ddump-hpc -ddump-if-trace -ddump-in‐
70 linings -ddump-json -ddump-llvm -ddump-mod-map -ddump-occur-anal
71 -ddump-opt-cmm -ddump-parsed -ddump-parsed-ast -ddump-prep
72 -ddump-rn -ddump-rn-ast -ddump-rn-stats -ddump-rn-trace
73 -ddump-rtti -ddump-rule-firings -ddump-rule-rewrites
74 -ddump-rules -ddump-simpl -ddump-simpl-iterations
75 -ddump-simpl-stats -ddump-spec -ddump-splices -ddump-stg
76 -ddump-stg-final -ddump-stg-unarised -ddump-str-signatures
77 -ddump-stranal -ddump-tc -ddump-tc-ast -ddump-tc-trace
78 -ddump-ticked -ddump-timings -ddump-to-file -ddump-types
79 -ddump-verbose-inlinings -ddump-worker-wrapper -dfast‐
80 string-stats -dhex-word-literals -dinitial-unique=⟨s⟩ -din‐
81 line-check=⟨str⟩ -dlinear-core-lint -dno-debug-output -dde‐
82 bug-output -dno-typeable-binds -dppr-case-as-let -dppr-cols=⟨n⟩
83 -dppr-debug -dppr-user-length -drule-check=⟨str⟩ -dshow-passes
84 -dstg-lint -dsuppress-all -dsuppress-coercions -dsuppress-idinfo
85 -dsuppress-module-prefixes -dsuppress-stg-free-vars -dsup‐
86 press-ticks -dsuppress-timestamps -dsuppress-type-applications
87 -dsuppress-type-signatures -dsuppress-unfoldings -dsup‐
88 press-uniques -dsuppress-var-kinds -dth-dec-file -dunique-incre‐
89 ment=⟨i⟩ -dverbose-core2core -dverbose-stg2stg -falignment-sani‐
90 tisation -fcatch-bottoms -fllvm-fill-undef-with-garbage
91 -fproc-alignment -g -g⟨n⟩
92
93 C pre-processor
94 -cpp -D⟨symbol⟩[=⟨value⟩] -U⟨symbol⟩ -I⟨dir⟩ -U⟨symbol⟩
95
96 Finding imports
97 -i -i⟨dir⟩[:⟨dir⟩]*
98
99 Interactive mode
100 -fbreak-on-error -fno-break-on-error -fbreak-on-exception
101 -fno-break-on-exception -fghci-hist-size=⟨n⟩ -fghci-leak-check
102 -fno-ghci-leak-check -flocal-ghci-history -fno-local-ghci-his‐
103 tory -fno-it -fno-no-it -fprint-bind-result -fno-print-bind-re‐
104 sult -fprint-evld-with-show -fshow-loaded-modules -ghci-script
105 -ignore-dot-ghci -interactive-print ⟨name⟩
106
107 Interface files
108 --show-iface ⟨file⟩ -ddump-hi -ddump-hi-diffs -ddump-minimal-im‐
109 ports
110
111 Keeping intermediate files
112 -keep-hc-file -keep-hc-files -keep-hi-files -no-keep-hi-files
113 -keep-hscpp-file -keep-hscpp-files -keep-llvm-file
114 -keep-llvm-files -keep-o-files -no-keep-o-files -keep-s-file
115 -keep-s-files -keep-tmp-files
116
117 Language options
118 -XAllowAmbiguousTypes -XApplicativeDo -XArrows -XBangPatterns
119 -XBinaryLiterals -XBlockArguments -XCApiFFI -XConstrainedClass‐
120 Methods -XConstraintKinds -XCPP -XCUSKs -XDataKinds -XDatatype‐
121 Contexts -XDefaultSignatures -XDeriveAnyClass -XDeriveDataTy‐
122 peable -XDeriveFoldable -XDeriveFunctor -XDeriveGeneric -XDeriv‐
123 eLift -XDeriveTraversable -XDerivingStrategies -XDerivingVia
124 -XDisambiguateRecordFields -XDuplicateRecordFields -XEmptyCase
125 -XEmptyDataDecls -XEmptyDataDeriving -XExistentialQuantification
126 -XExplicitForAll -XExplicitNamespaces -XExtendedDefaultRules
127 -XFlexibleContexts -XFlexibleInstances -XForeignFunctionInter‐
128 face -XFunctionalDependencies -XGADTs -XGADTSyntax -XGener‐
129 alisedNewtypeDeriving -XGeneralizedNewtypeDeriving -XGHCForeign‐
130 ImportPrim -XHaskell2010 -XHaskell98 -XHexFloatLiterals -XIm‐
131 plicitParams -XImportQualifiedPost -XImpredicativeTypes -XInco‐
132 herentInstances -XInstanceSigs -XInterruptibleFFI -XKindSigna‐
133 tures -XLambdaCase -XLexicalNegation -XLiberalTypeSynonyms
134 -XLinearTypes -XMagicHash -XMonadComprehensions -XMonad‐
135 FailDesugaring -XMonoLocalBinds -XMultiParamTypeClasses -XMulti‐
136 WayIf -XNamedFieldPuns -XNamedWildCards -XNegativeLiterals
137 -XNoImplicitPrelude -XNoMonomorphismRestriction -XNonde‐
138 creasingIndentation -XNoPatternGuards -XNoTraditionalRecordSyn‐
139 tax -XNPlusKPatterns -XNullaryTypeClasses -XNumDecimals -XNumer‐
140 icUnderscores -XOverlappingInstances -XOverloadedLabels -XOver‐
141 loadedLists -XOverloadedStrings -XPackageImports -XParallelList‐
142 Comp -XPartialTypeSignatures -XPatternSynonyms -XPolyKinds
143 -XPostfixOperators -XQualifiedDo -XQuantifiedConstraints
144 -XQuasiQuotes -XRank2Types -XRankNTypes -XRebindableSyntax
145 -XRecordWildCards -XRecursiveDo -XRoleAnnotations -XSafe -XS‐
146 copedTypeVariables -XStandaloneDeriving -XStandaloneKindSigna‐
147 tures -XStarIsType -XStaticPointers -XStrict -XStrictData -XTem‐
148 plateHaskell -XTemplateHaskellQuotes -XTransformListComp
149 -XTrustworthy -XTupleSections -XTypeApplications -XTypeFamilies
150 -XTypeFamilyDependencies -XTypeInType -XTypeOperators -XTypeSyn‐
151 onymInstances -XUnboxedSums -XUnboxedTuples -XUndecidableIn‐
152 stances -XUndecidableSuperClasses -XUnicodeSyntax -XUnliftedFFI‐
153 Types -XUnliftedNewtypes -XUnsafe -XViewPatterns
154
155 Linking options
156 -c -debug -dylib-install-name ⟨path⟩ -dynamic -dynload -eventlog
157 -fkeep-cafs -flink-rts -fno-embed-manifest -fno-gen-manifest
158 -fno-shared-implib -framework ⟨name⟩ -framework-path ⟨dir⟩
159 -fuse-rpaths -fno-use-rpaths -fwhole-archive-hs-libs -L ⟨dir⟩ -l
160 ⟨lib⟩ -main-is ⟨thing⟩ -no-hs-main -no-rtsopts-suggestions
161 -package ⟨name⟩ -pie -rdynamic -rtsopts[=⟨none|some|all|ig‐
162 nore|ignoreAll⟩] -shared -split-sections -static -staticlib
163 -threaded -with-rtsopts=⟨opts⟩
164
165 Miscellaneous options
166 -fexternal-interpreter -fglasgow-exts -fno-glasgow-exts
167 -fno-safe-haskell -ghcversion-file ⟨path to ghcversion.h⟩ -H
168 ⟨size⟩ -j[⟨n⟩]
169
170 Modes of operation
171 --frontend ⟨module⟩ --help -? --info --interactive --make
172 --mk-dll --numeric-version --print-libdir --show-iface ⟨file⟩
173 --show-options --supported-extensions --supported-languages
174 --version -V -e ⟨expr⟩ -M
175
176 Individual optimizations
177 -fasm-shortcutting -fno-asm-shortcutting -fbinary-blob-thresh‐
178 old=⟨n⟩ -fblock-layout-cfg -fno-block-layout-cfg -fblock-lay‐
179 out-weightless -fno-block-layout-weightless -fblock-lay‐
180 out-weights -fcall-arity -fno-call-arity -fcase-folding
181 -fno-case-folding -fcase-merge -fno-case-merge -fcmm-elim-com‐
182 mon-blocks -fno-cmm-elim-common-blocks -fcmm-sink -fno-cmm-sink
183 -fcmm-static-pred -fno-cmm-static-pred -fcpr-anal -fno-cpr-anal
184 -fcross-module-specialise -fno-cross-module-specialise -fcse
185 -fno-cse -fdicts-cheap -fno-dicts-cheap -fdicts-strict
186 -fno-dicts-strict -fdmd-tx-dict-sel -fno-dmd-tx-dict-sel
187 -fdo-eta-reduction -fno-do-eta-reduction -fdo-lambda-eta-expan‐
188 sion -fno-do-lambda-eta-expansion -feager-blackholing -fen‐
189 able-rewrite-rules -fno-enable-rewrite-rules -fexcess-precision
190 -fno-excess-precision -fexitification -fno-exitification -fex‐
191 pose-all-unfoldings -fno-expose-all-unfoldings -ffloat-in
192 -fno-float-in -ffull-laziness -fno-full-laziness -ffun-to-thunk
193 -fno-fun-to-thunk -fignore-asserts -fno-ignore-asserts -fig‐
194 nore-interface-pragmas -fno-ignore-interface-pragmas
195 -flate-dmd-anal -fno-late-dmd-anal -flate-specialise
196 -fno-late-specialise -fliberate-case -fno-liberate-case -fliber‐
197 ate-case-threshold=⟨n⟩ -fno-liberate-case-threshold
198 -fllvm-pass-vectors-in-regs -fno-llvm-pass-vectors-in-regs
199 -floopification -fno-loopification -fmax-inline-alloc-size=⟨n⟩
200 -fmax-inline-memcpy-insns=⟨n⟩ -fmax-inline-memset-insns=⟨n⟩
201 -fmax-simplifier-iterations=⟨n⟩ -fmax-uncovered-patterns=⟨n⟩
202 -fmax-worker-args=⟨n⟩ -fno-opt-coercion -fno-pre-inlining
203 -fno-state-hack -fomit-interface-pragmas -fno-omit-inter‐
204 face-pragmas -fomit-yields -fno-omit-yields -foptimal-applica‐
205 tive-do -fno-optimal-applicative-do -fpedantic-bottoms
206 -fno-pedantic-bottoms -fregs-graph -fno-regs-graph -fregs-itera‐
207 tive -fno-regs-iterative -fsimpl-tick-factor=⟨n⟩ -fsimpli‐
208 fier-phases=⟨n⟩ -fsolve-constant-dicts -fno-solve-constant-dicts
209 -fspec-constr -fno-spec-constr -fspec-constr-count=⟨n⟩
210 -fno-spec-constr-count -fspec-constr-keen -fno-spec-constr-keen
211 -fspec-constr-threshold=⟨n⟩ -fno-spec-constr-threshold -fspe‐
212 cialise -fno-specialise -fspecialise-aggressively -fno-spe‐
213 cialise-aggressively -fstatic-argument-transformation
214 -fno-static-argument-transformation -fstg-cse -fno-stg-cse
215 -fstg-lift-lams -fno-stg-lift-lams -fstg-lift-lams-known
216 -fno-stg-lift-lams-known -fstg-lift-lams-non-rec-args
217 -fno-stg-lift-lams-non-rec-args-any -fstg-lift-lams-rec-args
218 -fno-stg-lift-lams-rec-args-any -fstrictness -fno-strictness
219 -fstrictness-before=⟨n⟩ -funbox-small-strict-fields -fno-un‐
220 box-small-strict-fields -funbox-strict-fields -fno-un‐
221 box-strict-fields -funfolding-creation-threshold=⟨n⟩ -funfold‐
222 ing-dict-discount=⟨n⟩ -funfolding-fun-discount=⟨n⟩ -funfold‐
223 ing-keeness-factor=⟨n⟩ -funfolding-use-threshold=⟨n⟩
224 -fworker-wrapper
225
226 Optimization levels
227 -O -O1 -O0 -O0 -O2 -O0 -O⟨n⟩ -O0
228
229 Package options
230 -clear-package-db -distrust ⟨pkg⟩ -distrust-all-packages -fpack‐
231 age-trust -global-package-db -hide-all-packages -hide-package
232 ⟨pkg⟩ -ignore-package ⟨pkg⟩ -no-auto-link-packages
233 -no-global-package-db -no-user-package-db -package ⟨pkg⟩ -pack‐
234 age-db ⟨file⟩ -package-env ⟨file⟩|⟨name⟩ -package-id ⟨unit-id⟩
235 -this-unit-id ⟨unit-id⟩ -trust ⟨pkg⟩ -user-package-db
236
237 Phases of compilation
238 -C -c -E -F -S -x ⟨suffix⟩
239
240 Overriding external programs
241 -pgma ⟨cmd⟩ -pgmc ⟨cmd⟩ -pgmdll ⟨cmd⟩ -pgmF ⟨cmd⟩ -pgmi ⟨cmd⟩
242 -pgminstall_name_tool ⟨cmd⟩ -pgmL ⟨cmd⟩ -pgml ⟨cmd⟩ -pgmlc ⟨cmd⟩
243 -pgmlibtool ⟨cmd⟩ -pgmlm ⟨cmd⟩ -pgmlo ⟨cmd⟩ -pgmotool ⟨cmd⟩
244 -pgmP ⟨cmd⟩ -pgms ⟨cmd⟩ -pgmwindres ⟨cmd⟩
245
246 Phase-specific options
247 -opta ⟨option⟩ -optc ⟨option⟩ -optcxx ⟨option⟩ -optdll ⟨option⟩
248 -optF ⟨option⟩ -opti ⟨option⟩ -optL ⟨option⟩ -optl ⟨option⟩
249 -optlc ⟨option⟩ -optlm ⟨option⟩ -optlo ⟨option⟩ -optP ⟨option⟩
250 -optwindres ⟨option⟩ -pgmc-supports-no-pie
251
252 Platform-specific options
253 -mbmi2 -msse2 -msse4.2
254
255 Compiler plugins
256 -fclear-plugins -fplugin-opt=⟨module⟩:⟨args⟩ -fplugin-trustwor‐
257 thy -fplugin=⟨module⟩ -hide-all-plugin-packages -plugin-package
258 ⟨pkg⟩ -plugin-package-id ⟨pkg-id⟩
259
260 Profiling
261 -fno-prof-auto -fprof-auto -fno-prof-cafs -fprof-cafs
262 -fno-prof-count-entries -fprof-count-entries -fprof-auto
263 -fno-prof-auto -fprof-auto-calls -fno-prof-auto-calls
264 -fprof-auto-exported -fno-prof-auto -fprof-auto-top
265 -fno-prof-auto -fprof-cafs -fno-prof-cafs -prof -ticky
266
267 Program coverage
268 -fhpc
269
270 Recompilation checking
271 -fforce-recomp -fno-force-recomp -fignore-hpc-changes -fno-ig‐
272 nore-hpc-changes -fignore-optim-changes -fno-ignore-op‐
273 tim-changes
274
275 Redirecting output
276 --exclude-module=⟨file⟩ -ddump-mod-cycles -dep-makefile ⟨file⟩
277 -dep-suffix ⟨suffix⟩ -dumpdir ⟨dir⟩ -hcsuf ⟨suffix⟩ -hidir ⟨dir⟩
278 -hiedir ⟨dir⟩ -hiesuf ⟨suffix⟩ -hisuf ⟨suffix⟩ -include-cpp-deps
279 -include-pkg-deps -o ⟨file⟩ -odir ⟨dir⟩ -ohi ⟨file⟩ -osuf ⟨suf‐
280 fix⟩ -outputdir ⟨dir⟩ -stubdir ⟨dir⟩
281
282 Temporary files
283 -tmpdir ⟨dir⟩
284
285 Verbosity options
286 -fabstract-refinement-hole-fits -fno-abstract-refine‐
287 ment-hole-fits -fdefer-diagnostics -fdiagnostics-color=⟨al‐
288 ways|auto|never⟩ -fdiagnostics-show-caret -fno-diagnos‐
289 tics-show-caret -ferror-spans -fhide-source-paths -fkeep-going
290 -fmax-refinement-hole-fits=⟨n⟩ -fno-max-refinement-hole-fits
291 -fmax-relevant-binds=⟨n⟩ -fno-max-relevant-binds
292 -fmax-valid-hole-fits=⟨n⟩ -fno-max-valid-hole-fits
293 -fno-show-valid-hole-fits -fno-sort-valid-hole-fits
294 -fsort-valid-hole-fits -fprint-axiom-incomps -fno-print-ax‐
295 iom-incomps -fprint-equality-relations -fno-print-equality-rela‐
296 tions -fprint-expanded-synonyms -fno-print-expanded-synonyms
297 -fprint-explicit-coercions -fno-print-explicit-coercions
298 -fprint-explicit-foralls -fno-print-explicit-foralls -fprint-ex‐
299 plicit-kinds -fno-print-explicit-kinds -fprint-explicit-run‐
300 time-reps -fno-print-explicit-runtime-reps -fprint-potential-in‐
301 stances -fno-print-potential-instances -fprint-typechecker-elab‐
302 oration -fno-print-typechecker-elaboration -fprint-unicode-syn‐
303 tax -fno-print-unicode-syntax -frefinement-level-hole-fits=⟨n⟩
304 -fno-refinement-level-hole-fits -freverse-errors -fno-re‐
305 verse-errors -fshow-docs-of-hole-fits
306 -fno-show-docs-of-hole-fits -fshow-hole-constraints
307 -fshow-hole-matches-of-hole-fits
308 -fno-show-hole-matches-of-hole-fits -fshow-prove‐
309 nance-of-hole-fits -fno-show-provenance-of-hole-fits
310 -fshow-type-app-of-hole-fits -fno-show-type-app-of-hole-fits
311 -fshow-type-app-vars-of-hole-fits
312 -fno-show-type-app-vars-of-hole-fits -fshow-type-of-hole-fits
313 -fno-type-of-hole-fits -fsort-by-size-hole-fits
314 -fno-sort-by-size-hole-fits -fsort-by-subsumption-hole-fits
315 -fno-sort-by-subsumption-hole-fits -funclutter-valid-hole-fits
316 -Rghc-timing -v -v⟨n⟩
317
318 Warnings
319 -fdefer-out-of-scope-variables -fno-defer-out-of-scope-variables
320 -fdefer-type-errors -fno-defer-type-errors -fdefer-typed-holes
321 -fno-defer-typed-holes -fenable-th-splice-warnings -fno-en‐
322 able-th-splices -fhelpful-errors -fno-helpful-errors -fmax-pm‐
323 check-models=⟨n⟩ -fshow-warning-groups -fno-show-warning-groups
324 -fvia-C -W -w -w -Wall -w -Wall-missed-specialisations
325 -Wno-all-missed-specialisations -Wauto-orphans -Wcompat
326 -Wno-compat -Wcompat-unqualified-imports -Wno-compat-unquali‐
327 fied-imports -Wcpp-undef -Wdefault -Wdeferred-out-of-scope-vari‐
328 ables -Wno-deferred-out-of-scope-variables -Wdeferred-type-er‐
329 rors -Wno-deferred-type-errors -Wdeprecated-flags -Wno-depre‐
330 cated-flags -Wdeprecations -Wno-deprecations -Wderiving-defaults
331 -Wno-deriving-defaults -Wderiving-typeable -Wno-deriving-ty‐
332 peable -Wdodgy-exports -Wno-dodgy-exports -Wdodgy-foreign-im‐
333 ports -Wno-dodgy-foreign-import -Wdodgy-imports -Wno-dodgy-im‐
334 ports -Wduplicate-constraints -Wno-duplicate-constraints -Wdu‐
335 plicate-exports -Wno-duplicate-exports -Wempty-enumerations
336 -Wno-empty-enumerations -Werror -Wwarn -Weverything -Whi-shadow‐
337 ing -Wno-hi-shadowing -Widentities -Wno-identities -Wim‐
338 plicit-kind-vars -Wno-implicit-kind-vars -Wimplicit-prelude
339 -Wno-implicit-prelude -Winaccessible-code -Wno-inaccessible-code
340 -Wincomplete-patterns -Wno-incomplete-patterns -Wincom‐
341 plete-record-updates -Wno-incomplete-record-updates -Wincom‐
342 plete-uni-patterns -Wno-incomplete-uni-patterns -Win‐
343 ferred-safe-imports -Wno-inferred-safe-imports -Win‐
344 line-rule-shadowing -Wno-inline-rule-shadowing -Winvalid-haddock
345 -Wmissed-extra-shared-lib -Wno-missed-extra-shared-lib
346 -Wmissed-specialisations -Wno-missed-specialisations -Wmiss‐
347 ing-deriving-strategies -Wno-missing-deriving-strategies -Wmiss‐
348 ing-export-lists -fnowarn-missing-export-lists -Wmissing-ex‐
349 ported-signatures -Wno-missing-exported-signatures -Wmissing-ex‐
350 ported-sigs -Wno-missing-exported-sigs -Wmissing-fields
351 -Wno-missing-fields -Wmissing-home-modules -Wno-miss‐
352 ing-home-modules -Wmissing-import-lists -fnowarn-missing-im‐
353 port-lists -Wmissing-local-signatures -Wno-missing-local-signa‐
354 tures -Wmissing-local-sigs -Wno-missing-local-sigs -Wmiss‐
355 ing-methods -Wno-missing-methods -Wmissing-monadfail-instances
356 -Wno-missing-monadfail-instances -Wmissing-pattern-synonym-sig‐
357 natures -Wno-missing-pattern-synonym-signatures -Wmiss‐
358 ing-safe-haskell-mode -Wno-missing-safe-haskell-mode -Wmiss‐
359 ing-signatures -Wno-missing-signatures -Wmissing-space-af‐
360 ter-bang -Wmonomorphism-restriction -Wno-monomorphism-restric‐
361 tion -Wname-shadowing -Wno-name-shadowing -Wno-compat -Wcompat
362 -Wnoncanonical-monad-instances -Wno-noncanonical-monad-instances
363 -Wnoncanonical-monadfail-instances -Wno-noncanonical-monad‐
364 fail-instances -Wnoncanonical-monoid-instances -Wno-noncanoni‐
365 cal-monoid-instances -Worphans -Wno-orphans -Woverflowed-liter‐
366 als -Wno-overflowed-literals -Woverlapping-patterns -Wno-over‐
367 lapping-patterns -Wpartial-fields -Wno-partial-fields -Wpar‐
368 tial-type-signatures -Wno-partial-type-signatures -Wredun‐
369 dant-constraints -Wno-redundant-constraints -Wredun‐
370 dant-record-wildcards -Wno-redundant-record-wildcards -Wsafe
371 -Wno-safe -Wsemigroup -Wno-semigroup -Wsimplifiable-class-con‐
372 straints -Wno-simplifiable-class-constraints -Wstar-binder
373 -Wno-star-binder -Wstar-is-type -Wno-star-is-type -Wtabs
374 -Wno-tabs -Wtrustworthy-safe -Wno-safe -Wtype-defaults
375 -Wno-type-defaults -Wtyped-holes -Wno-typed-holes -Wun‐
376 banged-strict-patterns -Wno-unbanged-strict-patterns -Wuni‐
377 code-bidirectional-format-characters -Wunrecognised-pragmas
378 -Wno-unrecognised-pragmas -Wunrecognised-warning-flags -Wno-un‐
379 recognised-warning-flags -Wunsafe -Wno-unsafe -Wunsup‐
380 ported-calling-conventions -Wno-unsupported-calling-conventions
381 -Wunsupported-llvm-version -Wno-monomorphism-restriction
382 -Wunticked-promoted-constructors -Wno-unticked-promoted-con‐
383 structors -Wunused-binds -Wno-unused-binds -Wunused-do-bind
384 -Wno-unused-do-bind -Wunused-foralls -Wno-unused-foralls
385 -Wunused-imports -Wno-unused-imports -Wunused-local-binds
386 -Wno-unused-local-binds -Wunused-matches -Wno-unused-matches
387 -Wunused-packages -Wno-unused-packages -Wunused-pattern-binds
388 -Wno-unused-pattern-binds -Wunused-record-wildcards -Wno-un‐
389 used-record-wildcards -Wunused-top-binds -Wno-unused-top-binds
390 -Wunused-type-patterns -Wno-unused-type-patterns -Wwarn -Werror
391 -Wwarnings-deprecations -Wno-warnings-deprecations
392 -Wwrong-do-bind -Wno-wrong-do-bind
393
394 Code generation
395 -dynamic-too
396 Build dynamic object files as well as static object files during
397 compilation
398
399 -fasm Use the native code generator
400
401 -fbyte-code
402 Generate byte-code
403
404 -fexternal-dynamic-refs
405 Generate code for linking against dynamic libraries
406
407 -fllvm Compile using the LLVM code generator
408
409 -fno-code
410 Omit code generation
411
412 -fobject-code
413 Generate object code
414
415 -fPIC Generate position-independent code (where available)
416
417 -fPIE Generate code for a position-independent executable (where
418 available)
419
420 -fwrite-interface
421 Always write interface files
422
423 Debugging the compiler
424 -dcmm-lint
425 C-\- pass sanity checking
426
427 -dcore-lint
428 Turn on internal sanity checking
429
430 -ddump-asm
431 Dump final assembly
432
433 -ddump-asm-expanded
434 Dump the result of the synthetic instruction expansion pass.
435
436 -ddump-asm-liveness
437 Dump assembly augmented with register liveness
438
439 -ddump-asm-native
440 Dump initial assembly
441
442 -ddump-asm-regalloc
443 Dump the result of register allocation
444
445 -ddump-asm-regalloc-stages
446 Dump the build/spill stages of the -fregs-graph register alloca‐
447 tor.
448
449 -ddump-asm-stats
450 Dump statistics from the register allocator.
451
452 -ddump-bcos
453 Dump interpreter byte code
454
455 -ddump-cfg-weights
456 Dump the assumed weights of the CFG.
457
458 -ddump-cmm
459 Dump the final C-\- output
460
461 -ddump-cmm-caf
462 Dump the results of the C-\- CAF analysis pass.
463
464 -ddump-cmm-cbe
465 Dump the results of common block elimination
466
467 -ddump-cmm-cfg
468 Dump the results of the C-\- control flow optimisation pass.
469
470 -ddump-cmm-cps
471 Dump the results of the CPS pass
472
473 -ddump-cmm-from-stg
474 Dump STG-to-C-\- output
475
476 -ddump-cmm-info
477 Dump the results of the C-\- info table augmentation pass.
478
479 -ddump-cmm-opt
480 Dump the results of C-\- to C-\- optimising passes
481
482 -ddump-cmm-proc
483 Dump the results of proc-point analysis
484
485 -ddump-cmm-procmap
486 Dump the results of the C-\- proc-point map pass.
487
488 -ddump-cmm-raw
489 Dump raw C-\-
490
491 -ddump-cmm-sink
492 Dump the results of the C-\- sinking pass.
493
494 -ddump-cmm-sp
495 Dump the results of the C-\- stack layout pass.
496
497 -ddump-cmm-split
498 Dump the results of the C-\- proc-point splitting pass.
499
500 -ddump-cmm-switch
501 Dump the results of switch lowering passes
502
503 -ddump-cmm-verbose
504 Write output from main C-\- pipeline passes to files
505
506 -ddump-cmm-verbose-by-proc
507 Show output from main C-\- pipeline passes (grouped by proc)
508
509 -ddump-core-stats
510 Print a one-line summary of the size of the Core program at the
511 end of the optimisation pipeline
512
513 -ddump-cpr-signatures
514 Dump CPR signatures
515
516 -ddump-cpranal
517 Dump CPR analysis output
518
519 -ddump-cse
520 Dump CSE output
521
522 -ddump-deriv
523 Dump deriving output
524
525 -ddump-ds
526 Dump desugarer output.
527
528 -ddump-ec-trace
529 Trace exhaustiveness checker
530
531 -ddump-file-prefix=⟨str⟩
532 Set the prefix of the filenames used for debugging output.
533
534 -ddump-foreign
535 Dump foreign export stubs
536
537 -ddump-hie
538 Dump the hie file syntax tree
539
540 -ddump-hpc
541 An alias for -ddump-ticked.
542
543 -ddump-if-trace
544 Trace interface files
545
546 -ddump-inlinings
547 Dump inlinings performed by the simplifier.
548
549 -ddump-json
550 Dump error messages as JSON documents
551
552 -ddump-llvm
553 Dump LLVM intermediate code.
554
555 -ddump-mod-map
556 Dump the state of the module mapping database.
557
558 -ddump-occur-anal
559 Dump occurrence analysis output
560
561 -ddump-opt-cmm
562 Dump the results of C-\- to C-\- optimising passes
563
564 -ddump-parsed
565 Dump parse tree
566
567 -ddump-parsed-ast
568 Dump parser output as a syntax tree
569
570 -ddump-prep
571 Dump prepared core
572
573 -ddump-rn
574 Dump renamer output
575
576 -ddump-rn-ast
577 Dump renamer output as a syntax tree
578
579 -ddump-rn-stats
580 Renamer stats
581
582 -ddump-rn-trace
583 Trace renamer
584
585 -ddump-rtti
586 Trace runtime type inference
587
588 -ddump-rule-firings
589 Dump rule firing info
590
591 -ddump-rule-rewrites
592 Dump detailed rule firing info
593
594 -ddump-rules
595 Dump rewrite rules
596
597 -ddump-simpl
598 Dump final simplifier output
599
600 -ddump-simpl-iterations
601 Dump output from each simplifier iteration
602
603 -ddump-simpl-stats
604 Dump simplifier stats
605
606 -ddump-spec
607 Dump specialiser output
608
609 -ddump-splices
610 Dump TH spliced expressions, and what they evaluate to
611
612 -ddump-stg
613 Show CoreToStg output
614
615 -ddump-stg-final
616 Show output of last STG pass.
617
618 -ddump-stg-unarised
619 Show unarised STG
620
621 -ddump-str-signatures
622 Dump strictness signatures
623
624 -ddump-stranal
625 Dump strictness analyser output
626
627 -ddump-tc
628 Dump typechecker output
629
630 -ddump-tc-ast
631 Dump typechecker output as a syntax tree
632
633 -ddump-tc-trace
634 Trace typechecker
635
636 -ddump-ticked
637 Dump the code instrumented by HPC (Observing Code Coverage).
638
639 -ddump-timings
640 Dump per-pass timing and allocation statistics
641
642 -ddump-to-file
643 Dump to files instead of stdout
644
645 -ddump-types
646 Dump type signatures
647
648 -ddump-verbose-inlinings
649 Dump all considered inlinings
650
651 -ddump-worker-wrapper
652 Dump worker-wrapper output
653
654 -dfaststring-stats
655 Show statistics for fast string usage when finished
656
657 -dhex-word-literals
658 Print values of type Word# in hexadecimal.
659
660 -dinitial-unique=⟨s⟩
661 Start UniqSupply allocation from ⟨s⟩.
662
663 -dinline-check=⟨str⟩
664 Dump information about inlining decisions
665
666 -dlinear-core-lint
667 Turn on internal sanity checking
668
669 -dno-debug-output
670 Suppress unsolicited debugging output
671
672 -dno-typeable-binds
673 Don't generate bindings for Typeable methods
674
675 -dppr-case-as-let
676 Print single alternative case expressions as strict lets.
677
678 -dppr-cols=⟨n⟩
679 Set the width of debugging output. For example -dppr-cols200
680
681 -dppr-debug
682 Turn on debug printing (more verbose)
683
684 -dppr-user-length
685 Set the depth for printing expressions in error msgs
686
687 -drule-check=⟨str⟩
688 Dump information about potential rule application
689
690 -dshow-passes
691 Print out each pass name as it happens
692
693 -dstg-lint
694 STG pass sanity checking
695
696 -dsuppress-all
697 In dumps, suppress everything (except for uniques) that is sup‐
698 pressible.
699
700 -dsuppress-coercions
701 Suppress the printing of coercions in Core dumps to make them
702 shorter
703
704 -dsuppress-idinfo
705 Suppress extended information about identifiers where they are
706 bound
707
708 -dsuppress-module-prefixes
709 Suppress the printing of module qualification prefixes
710
711 -dsuppress-stg-free-vars
712 Suppress the printing of closure free variable lists in STG out‐
713 put
714
715 -dsuppress-ticks
716 Suppress "ticks" in the pretty-printer output.
717
718 -dsuppress-timestamps
719 Suppress timestamps in dumps
720
721 -dsuppress-type-applications
722 Suppress type applications
723
724 -dsuppress-type-signatures
725 Suppress type signatures
726
727 -dsuppress-unfoldings
728 Suppress the printing of the stable unfolding of a variable at
729 its binding site
730
731 -dsuppress-uniques
732 Suppress the printing of uniques in debug output (easier to use
733 diff)
734
735 -dsuppress-var-kinds
736 Suppress the printing of variable kinds
737
738 -dth-dec-file
739 Dump evaluated TH declarations into *.th.hs files
740
741 -dunique-increment=⟨i⟩
742 Set the increment for the generated Unique's to ⟨i⟩.
743
744 -dverbose-core2core
745 Show output from each core-to-core pass
746
747 -dverbose-stg2stg
748 Show output from each STG-to-STG pass
749
750 -falignment-sanitisation
751 Compile with alignment checks for all info table dereferences.
752
753 -fcatch-bottoms
754 Add a default error alternative to case expressions without a
755 default alternative.
756
757 -fllvm-fill-undef-with-garbage
758 Intruct LLVM to fill dead STG registers with garbage
759
760 -fproc-alignment
761 Align functions at given boundary.
762
763 -g Produce DWARF debug information in compiled object files. ⟨n⟩
764 can be 0, 1, or 2, with higher numbers producing richer output.
765 If ⟨n⟩ is omitted, level 2 is assumed.
766
767 C pre-processor
768 -cpp Run the C pre-processor on Haskell source files
769
770 -D⟨symbol⟩[=⟨value⟩]
771 Define a symbol in the C pre-processor
772
773 -I⟨dir⟩
774 Add ⟨dir⟩ to the directory search list for #include files
775
776 -U⟨symbol⟩
777 Undefine a symbol in the C pre-processor
778
779 Finding imports
780 -i Empty the import directory list
781
782 -i⟨dir⟩[:⟨dir⟩]*
783 add ⟨dir⟩, ⟨dir2⟩, etc. to import path
784
785 Interactive mode
786 -fbreak-on-error
787 Break on uncaught exceptions and errors
788
789 -fbreak-on-exception
790 Break on any exception thrown
791
792 -fghci-hist-size=⟨n⟩
793 Set the number of entries GHCi keeps for :history. See The GHCi
794 Debugger.
795
796 -fghci-leak-check
797 (Debugging only) check for space leaks when loading new modules
798 in GHCi.
799
800 -flocal-ghci-history
801 Use current directory for the GHCi command history file
802 .ghci-history.
803
804 -fno-it
805 No longer set the special variable it.
806
807 -fprint-bind-result
808 Turn on printing of binding results in GHCi
809
810 -fprint-evld-with-show
811 Instruct :print to use Show instances where possible.
812
813 -fshow-loaded-modules
814 Show the names of modules that GHCi loaded after a :load com‐
815 mand.
816
817 -ghci-script
818 Read additional .ghci files
819
820 -ignore-dot-ghci
821 Disable reading of .ghci files
822
823 -interactive-print ⟨name⟩
824 Select the function to use for printing evaluated expressions in
825 GHCi
826
827 Interface files
828 --show-iface ⟨file⟩
829 See Modes of operation.
830
831 -ddump-hi
832 Dump the new interface to stdout
833
834 -ddump-hi-diffs
835 Show the differences vs. the old interface
836
837 -ddump-minimal-imports
838 Dump a minimal set of imports
839
840 Keeping intermediate files
841 -keep-hc-file
842 Retain intermediate .hc files.
843
844 -keep-hi-files
845 Retain intermediate .hi files (the default).
846
847 -keep-hscpp-file
848 Retain intermediate .hscpp files.
849
850 -keep-llvm-file
851 Retain intermediate LLVM .ll files. Implies -fllvm.
852
853 -keep-o-files
854 Retain intermediate .o files (the default).
855
856 -keep-s-file
857 Retain intermediate .s files.
858
859 -keep-tmp-files
860 Retain all intermediate temporary files.
861
862 Language options
863 -XAllowAmbiguousTypes
864 Allow the user to write ambiguous types, and the type inference
865 engine to infer them.
866
867 -XApplicativeDo
868 Enable Applicative do-notation desugaring
869
870 -XArrows
871 Enable arrow notation extension
872
873 -XBangPatterns
874 Enable bang patterns.
875
876 -XBinaryLiterals
877 Enable support for binary literals.
878
879 -XBlockArguments
880 Allow do blocks and other constructs as function arguments.
881
882 -XCApiFFI
883 Enable the CAPI calling convention.
884
885 -XConstrainedClassMethods
886 Enable constrained class methods.
887
888 -XConstraintKinds
889 Enable a kind of constraints.
890
891 -XCPP Enable the C preprocessor.
892
893 -XCUSKs
894 Enable detection of complete user-supplied kind signatures.
895
896 -XDataKinds
897 Enable datatype promotion.
898
899 -XDatatypeContexts
900 Allow contexts on data types.
901
902 -XDefaultSignatures
903 Enable default signatures.
904
905 -XDeriveAnyClass
906 Enable deriving for any class.
907
908 -XDeriveDataTypeable
909 Enable deriving for the Data class. Implied by (deprecated) Au‐
910 toDeriveTypeable.
911
912 -XDeriveFoldable
913 Enable deriving for the Foldable class. Implied by Derive‐
914 Traversable.
915
916 -XDeriveFunctor
917 Enable deriving for the Functor class. Implied by Derive‐
918 Traversable.
919
920 -XDeriveGeneric
921 Enable deriving for the Generic class.
922
923 -XDeriveLift
924 Enable deriving for the Lift class
925
926 -XDeriveTraversable
927 Enable deriving for the Traversable class. Implies DeriveFunc‐
928 tor and DeriveFoldable.
929
930 -XDerivingStrategies
931 Enables deriving strategies.
932
933 -XDerivingVia
934 Enable deriving instances via types of the same runtime repre‐
935 sentation. Implies DerivingStrategies.
936
937 -XDisambiguateRecordFields
938 Enable record field disambiguation. Implied by RecordWildCards.
939
940 -XDuplicateRecordFields
941 Allow definition of record types with identically-named fields.
942
943 -XEmptyCase
944 Allow empty case alternatives.
945
946 -XEmptyDataDecls
947 Allow definition of empty data types.
948
949 -XEmptyDataDeriving
950 Allow deriving instances of standard type classes for empty data
951 types.
952
953 -XExistentialQuantification
954 Enable liberalised type synonyms.
955
956 -XExplicitForAll
957 Enable explicit universal quantification. Implied by Scoped‐
958 TypeVariables, LiberalTypeSynonyms, RankNTypes and Existen‐
959 tialQuantification.
960
961 -XExplicitNamespaces
962 Enable using the keyword type to specify the namespace of en‐
963 tries in imports and exports (Explicit namespaces in import/ex‐
964 port). Implied by TypeOperators and TypeFamilies.
965
966 -XExtendedDefaultRules
967 Use GHCi's extended default rules in a normal module.
968
969 -XFlexibleContexts
970 Enable flexible contexts.
971
972 -XFlexibleInstances
973 Enable flexible instances. Implies TypeSynonymInstances.
974
975 -XForeignFunctionInterface
976 Enable foreign function interface.
977
978 -XFunctionalDependencies
979 Enable functional dependencies. Implies MultiParamTypeClasses.
980
981 -XGADTs
982 Enable generalised algebraic data types. Implies GADTSyntax and
983 MonoLocalBinds.
984
985 -XGADTSyntax
986 Enable generalised algebraic data type syntax.
987
988 -XGeneralisedNewtypeDeriving
989 Enable newtype deriving.
990
991 -XGeneralizedNewtypeDeriving
992 Enable newtype deriving.
993
994 -XGHCForeignImportPrim
995 Enable prim calling convention. Intended for internal use only.
996
997 -XHaskell2010
998 Use the Haskell 2010 language variant.
999
1000 -XHaskell98
1001 Use the Haskell 98 language variant.
1002
1003 -XHexFloatLiterals
1004 Enable support for hexadecimal floating point literals.
1005
1006 -XImplicitParams
1007 Enable Implicit Parameters.
1008
1009 -XImportQualifiedPost
1010 ImportQualifiedPost allows the syntax import M qualified
1011
1012 -XImpredicativeTypes
1013 Enable impredicative types. Implies RankNTypes.
1014
1015 -XIncoherentInstances
1016 Enable incoherent instances. Implies OverlappingInstances.
1017
1018 -XInstanceSigs
1019 Enable instance signatures.
1020
1021 -XInterruptibleFFI
1022 Enable interruptible FFI.
1023
1024 -XKindSignatures
1025 Enable kind signatures. Implied by TypeFamilies and PolyKinds.
1026
1027 -XLambdaCase
1028 Enable lambda-case expressions.
1029
1030 -XLexicalNegation
1031 Use whitespace to determine whether the minus sign stands for
1032 negation or subtraction.
1033
1034 -XLiberalTypeSynonyms
1035 Enable liberalised type synonyms.
1036
1037 -XLinearTypes
1038 Enable linear types.
1039
1040 -XMagicHash
1041 Allow # as a postfix modifier on identifiers.
1042
1043 -XMonadComprehensions
1044 Enable monad comprehensions.
1045
1046 -XMonadFailDesugaring
1047 Enable monadfail desugaring.
1048
1049 -XMonoLocalBinds
1050 Enable do not generalise local bindings. Implied by TypeFami‐
1051 lies and GADTs.
1052
1053 -XMultiParamTypeClasses
1054 Enable multi parameter type classes. Implied by FunctionalDe‐
1055 pendencies.
1056
1057 -XMultiWayIf
1058 Enable multi-way if-expressions.
1059
1060 -XNamedFieldPuns
1061 Enable record puns.
1062
1063 -XNamedWildCards
1064 Enable named wildcards.
1065
1066 -XNegativeLiterals
1067 Enable support for negative literals.
1068
1069 -XNoImplicitPrelude
1070 Don't implicitly import Prelude. Implied by RebindableSyntax.
1071
1072 -XNoMonomorphismRestriction
1073 Disable the monomorphism restriction.
1074
1075 -XNondecreasingIndentation
1076 Allow nested contexts to be at the same indentation level as its
1077 enclosing context.
1078
1079 -XNoPatternGuards
1080 Disable pattern guards. Implied by Haskell98.
1081
1082 -XNoTraditionalRecordSyntax
1083 Disable support for traditional record syntax (as supported by
1084 Haskell 98) C {f = x}
1085
1086 -XNPlusKPatterns
1087 Enable support for n+k patterns. Implied by Haskell98.
1088
1089 -XNullaryTypeClasses
1090 Deprecated, does nothing. nullary (no parameter) type classes
1091 are now enabled using MultiParamTypeClasses.
1092
1093 -XNumDecimals
1094 Enable support for 'fractional' integer literals.
1095
1096 -XNumericUnderscores
1097 Enable support for numeric underscores.
1098
1099 -XOverlappingInstances
1100 Enable overlapping instances.
1101
1102 -XOverloadedLabels
1103 Enable overloaded labels.
1104
1105 -XOverloadedLists
1106 Enable overloaded lists.
1107
1108 -XOverloadedStrings
1109 Enable overloaded string literals.
1110
1111 -XPackageImports
1112 Enable package-qualified imports.
1113
1114 -XParallelListComp
1115 Enable parallel list comprehensions.
1116
1117 -XPartialTypeSignatures
1118 Enable partial type signatures.
1119
1120 -XPatternSynonyms
1121 Enable pattern synonyms.
1122
1123 -XPolyKinds
1124 Enable kind polymorphism. Implies KindSignatures.
1125
1126 -XPostfixOperators
1127 Enable postfix operators.
1128
1129 -XQualifiedDo
1130 Enable qualified do-notation desugaring.
1131
1132 -XQuantifiedConstraints
1133 Allow forall quantifiers in constraints.
1134
1135 -XQuasiQuotes
1136 Enable quasiquotation.
1137
1138 -XRank2Types
1139 Enable rank-2 types. Synonym for RankNTypes.
1140
1141 -XRankNTypes
1142 Enable rank-N types. Implied by ImpredicativeTypes.
1143
1144 -XRebindableSyntax
1145 Employ rebindable syntax. Implies NoImplicitPrelude.
1146
1147 -XRecordWildCards
1148 Enable record wildcards. Implies DisambiguateRecordFields.
1149
1150 -XRecursiveDo
1151 Enable recursive do (mdo) notation.
1152
1153 -XRoleAnnotations
1154 Enable role annotations.
1155
1156 -XSafe Enable the Safe Haskell Safe mode.
1157
1158 -XScopedTypeVariables
1159 Enable lexically-scoped type variables.
1160
1161 -XStandaloneDeriving
1162 Enable standalone deriving.
1163
1164 -XStandaloneKindSignatures
1165 Allow the use of standalone kind signatures.
1166
1167 -XStarIsType
1168 Treat * as Data.Kind.Type.
1169
1170 -XStaticPointers
1171 Enable static pointers.
1172
1173 -XStrict
1174 Make bindings in the current module strict by default.
1175
1176 -XStrictData
1177 Enable default strict datatype fields.
1178
1179 -XTemplateHaskell
1180 Enable Template Haskell.
1181
1182 -XTemplateHaskellQuotes
1183 Enable quotation subset of Template Haskell.
1184
1185 -XTransformListComp
1186 Enable generalised list comprehensions.
1187
1188 -XTrustworthy
1189 Enable the Safe Haskell Trustworthy mode.
1190
1191 -XTupleSections
1192 Enable tuple sections.
1193
1194 -XTypeApplications
1195 Enable type application syntax in terms and types.
1196
1197 -XTypeFamilies
1198 Enable type families. Implies ExplicitNamespaces, KindSigna‐
1199 tures, and MonoLocalBinds.
1200
1201 -XTypeFamilyDependencies
1202 Enable injective type families. Implies TypeFamilies.
1203
1204 -XTypeInType
1205 Deprecated. Enable kind polymorphism and datatype promotion.
1206
1207 -XTypeOperators
1208 Enable type operators. Implies ExplicitNamespaces.
1209
1210 -XTypeSynonymInstances
1211 Enable type synonyms in instance heads. Implied by FlexibleIn‐
1212 stances.
1213
1214 -XUnboxedSums
1215 Enable unboxed sums.
1216
1217 -XUnboxedTuples
1218 Enable the use of unboxed tuple syntax.
1219
1220 -XUndecidableInstances
1221 Enable undecidable instances.
1222
1223 -XUndecidableSuperClasses
1224 Allow all superclass constraints, including those that may re‐
1225 sult in non-termination of the typechecker.
1226
1227 -XUnicodeSyntax
1228 Enable unicode syntax.
1229
1230 -XUnliftedFFITypes
1231 Enable unlifted FFI types
1232
1233 -XUnliftedNewtypes
1234 Enable unlifted newtypes.
1235
1236 -XUnsafe
1237 Enable Safe Haskell Unsafe mode.
1238
1239 -XViewPatterns
1240 Enable view patterns.
1241
1242 Linking options
1243 -c Stop after generating object (.o) file
1244
1245 -debug Use the debugging runtime
1246
1247 -dylib-install-name ⟨path⟩
1248 Set the install name (via -install_name passed to Apple's
1249 linker), specifying the full install path of the library file.
1250 Any libraries or executables that link with it later will pick
1251 up that path as their runtime search location for it. (Dar‐
1252 win/OS X only)
1253
1254 -dynamic
1255 Build dynamically-linked object files and executables
1256
1257 -dynload
1258 Selects one of a number of modes for finding shared libraries at
1259 runtime.
1260
1261 -eventlog
1262 Enable runtime event tracing
1263
1264 -fkeep-cafs
1265 Do not garbage-collect CAFs (top-level expressions) at runtime
1266
1267 -flink-rts
1268 Link the runtime when generating a shared or static library
1269
1270 -fno-embed-manifest
1271 Do not embed the manifest in the executable (Windows only)
1272
1273 -fno-gen-manifest
1274 Do not generate a manifest file (Windows only)
1275
1276 -fno-shared-implib
1277 Don't generate an import library for a DLL (Windows only)
1278
1279 -framework ⟨name⟩
1280 On Darwin/OS X/iOS only, link in the framework ⟨name⟩. This op‐
1281 tion corresponds to the -framework option for Apple's Linker.
1282
1283 -framework-path ⟨dir⟩
1284 On Darwin/OS X/iOS only, add ⟨dir⟩ to the list of directories
1285 searched for frameworks. This option corresponds to the -F op‐
1286 tion for Apple's Linker.
1287
1288 -fuse-rpaths
1289 Set the rpath based on -L flags
1290
1291 -fwhole-archive-hs-libs
1292 When linking a binary executable, this inserts the flag
1293 -Wl,--whole-archive before any -l flags for Haskell libraries,
1294 and -Wl,--no-whole-archive afterwards
1295
1296 -L ⟨dir⟩
1297 Add ⟨dir⟩ to the list of directories searched for libraries
1298
1299 -l ⟨lib⟩
1300 Link in library ⟨lib⟩
1301
1302 -main-is ⟨thing⟩
1303 Set main module and function
1304
1305 -no-hs-main
1306 Don't assume this program contains main
1307
1308 -no-rtsopts-suggestions
1309 Don't print RTS suggestions about linking with
1310 -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩].
1311
1312 -package ⟨name⟩
1313 Expose package ⟨pkg⟩
1314
1315 -pie Instruct the linker to produce a position-independent exe‐
1316 cutable.
1317
1318 -rdynamic
1319 This instructs the linker to add all symbols, not only used
1320 ones, to the dynamic symbol table. Currently Linux and Win‐
1321 dows/MinGW32 only. This is equivalent to using -optl -rdynamic
1322 on Linux, and -optl -export-all-symbols on Windows.
1323
1324 -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩]
1325 Control whether the RTS behaviour can be tweaked via com‐
1326 mand-line flags and the GHCRTS environment variable. Using none
1327 means no RTS flags can be given; some means only a minimum of
1328 safe options can be given (the default); all (or no argument at
1329 all) means that all RTS flags are permitted; ignore means RTS
1330 flags can be given, but are treated as regular arguments and
1331 passed to the Haskell program as arguments; ignoreAll is the
1332 same as ignore, but GHCRTS is also ignored. -rtsopts does not
1333 affect -with-rtsopts behavior; flags passed via -with-rtsopts
1334 are used regardless of -rtsopts.
1335
1336 -shared
1337 Generate a shared library (as opposed to an executable)
1338
1339 -split-sections
1340 Split sections for link-time dead-code stripping
1341
1342 -static
1343 Use static Haskell libraries
1344
1345 -staticlib
1346 Generate a standalone static library (as opposed to an exe‐
1347 cutable). This is useful when cross compiling. The library to‐
1348 gether with all its dependencies ends up in in a single static
1349 library that can be linked against.
1350
1351 -threaded
1352 Use the threaded runtime
1353
1354 -with-rtsopts=⟨opts⟩
1355 Set the default RTS options to ⟨opts⟩.
1356
1357 Miscellaneous options
1358 -fexternal-interpreter
1359 Run interpreted code in a separate process
1360
1361 -fglasgow-exts
1362 Deprecated. Enable most language extensions; see Controlling ex‐
1363 tensions for exactly which ones.
1364
1365 -fno-safe-haskell
1366 Disable Safe Haskell
1367
1368 -ghcversion-file ⟨path to ghcversion.h⟩
1369 (GHC as a C compiler only) Use this ghcversion.h file
1370
1371 -H ⟨size⟩
1372 Set the minimum size of the heap to ⟨size⟩
1373
1374 -j[⟨n⟩]
1375 When compiling with --make, compile ⟨n⟩ modules in parallel.
1376
1377 Modes of operation
1378 --frontend ⟨module⟩
1379 run GHC with the given frontend plugin; see Frontend plugins for
1380 details.
1381
1382 --help Display help
1383
1384 --info display information about the compiler
1385
1386 --interactive
1387 Interactive mode - normally used by just running ghci; see Using
1388 GHCi for details.
1389
1390 --make Build a multi-module Haskell program, automatically figuring out
1391 dependencies. Likely to be much easier, and faster, than using
1392 make; see Using ghc --make for details.
1393
1394 --mk-dll
1395 DLL-creation mode (Windows only)
1396
1397 --numeric-version
1398 display GHC version (numeric only)
1399
1400 --print-libdir
1401 display GHC library directory
1402
1403 --show-iface ⟨file⟩
1404 display the contents of an interface file.
1405
1406 --show-options
1407 display the supported command line options
1408
1409 --supported-extensions
1410 display the supported language extensions
1411
1412 --version
1413 display GHC version
1414
1415 -e ⟨expr⟩
1416 Evaluate expr; see Expression evaluation mode for details.
1417
1418 -M generate dependency information suitable for use in a Makefile;
1419 see Dependency generation for details.
1420
1421 Individual optimizations
1422 -fasm-shortcutting
1423 Enable shortcutting on assembly. Implied by -O2.
1424
1425 -fbinary-blob-threshold=⟨n⟩
1426 default: 500K. Tweak assembly generator for binary blobs.
1427
1428 -fblock-layout-cfg
1429 Use the new cfg based block layout algorithm.
1430
1431 -fblock-layout-weightless
1432 Ignore cfg weights for code layout.
1433
1434 -fblock-layout-weights
1435 Sets edge weights used by the new code layout algorithm.
1436
1437 -fcall-arity
1438 Enable call-arity optimisation. Implied by -O.
1439
1440 -fcase-folding
1441 Enable constant folding in case expressions. Implied by -O.
1442
1443 -fcase-merge
1444 Enable case-merging. Implied by -O.
1445
1446 -fcmm-elim-common-blocks
1447 Enable Cmm common block elimination. Implied by -O.
1448
1449 -fcmm-sink
1450 Enable Cmm sinking. Implied by -O.
1451
1452 -fcmm-static-pred
1453 Enable static control flow prediction. Implied by -O.
1454
1455 -fcpr-anal
1456 Turn on CPR analysis in the demand analyser. Implied by -O.
1457
1458 -fcross-module-specialise
1459 Turn on specialisation of overloaded functions imported from
1460 other modules.
1461
1462 -fcse Enable common sub-expression elimination. Implied by -O.
1463
1464 -fdicts-cheap
1465 Make dictionary-valued expressions seem cheap to the optimiser.
1466
1467 -fdicts-strict
1468 Make dictionaries strict
1469
1470 -fdmd-tx-dict-sel
1471 Use a special demand transformer for dictionary selectors. Al‐
1472 ways enabled by default.
1473
1474 -fdo-eta-reduction
1475 Enable eta-reduction. Implied by -O.
1476
1477 -fdo-lambda-eta-expansion
1478 Enable lambda eta-expansion. Always enabled by default.
1479
1480 -feager-blackholing
1481 Turn on eager blackholing
1482
1483 -fenable-rewrite-rules
1484 Switch on all rewrite rules (including rules generated by auto‐
1485 matic specialisation of overloaded functions). Implied by -O.
1486
1487 -fexcess-precision
1488 Enable excess intermediate precision
1489
1490 -fexitification
1491 Enables exitification optimisation. Implied by -O.
1492
1493 -fexpose-all-unfoldings
1494 Expose all unfoldings, even for very large or recursive func‐
1495 tions.
1496
1497 -ffloat-in
1498 Turn on the float-in transformation. Implied by -O.
1499
1500 -ffull-laziness
1501 Turn on full laziness (floating bindings outwards). Implied by
1502 -O.
1503
1504 -ffun-to-thunk
1505 Allow worker-wrapper to convert a function closure into a thunk
1506 if the function does not use any of its arguments. Off by de‐
1507 fault.
1508
1509 -fignore-asserts
1510 Ignore assertions in the source. Implied by -O.
1511
1512 -fignore-interface-pragmas
1513 Ignore pragmas in interface files. Implied by -O0 only.
1514
1515 -flate-dmd-anal
1516 Run demand analysis again, at the end of the simplification
1517 pipeline
1518
1519 -flate-specialise
1520 Run a late specialisation pass
1521
1522 -fliberate-case
1523 Turn on the liberate-case transformation. Implied by -O2.
1524
1525 -fliberate-case-threshold=⟨n⟩
1526 default: 2000. Set the size threshold for the liberate-case
1527 transformation to ⟨n⟩
1528
1529 -fllvm-pass-vectors-in-regs
1530 Pass vector value in vector registers for function calls
1531
1532 -floopification
1533 Turn saturated self-recursive tail-calls into local jumps in the
1534 generated assembly. Implied by -O.
1535
1536 -fmax-inline-alloc-size=⟨n⟩
1537 default: 128. Set the maximum size of inline array allocations
1538 to ⟨n⟩ bytes (default: 128).
1539
1540 -fmax-inline-memcpy-insns=⟨n⟩
1541 default: 32. Inline memcpy calls if they would generate no more
1542 than ⟨n⟩ pseudo instructions.
1543
1544 -fmax-inline-memset-insns=⟨n⟩
1545 default: 32. Inline memset calls if they would generate no more
1546 than ⟨n⟩ pseudo instructions
1547
1548 -fmax-simplifier-iterations=⟨n⟩
1549 default: 4. Set the max iterations for the simplifier.
1550
1551 -fmax-uncovered-patterns=⟨n⟩
1552 default: 4. Set the maximum number of patterns to display in
1553 warnings about non-exhaustive ones.
1554
1555 -fmax-worker-args=⟨n⟩
1556 default: 10. Maximum number of value arguments for a worker.
1557
1558 -fno-opt-coercion
1559 Turn off the coercion optimiser
1560
1561 -fno-pre-inlining
1562 Turn off pre-inlining
1563
1564 -fno-state-hack
1565 Turn off the state hackwhereby any lambda with a real-world
1566 state token as argument is considered to be single-entry. Hence
1567 OK to inline things inside it.
1568
1569 -fomit-interface-pragmas
1570 Don't generate interface pragmas. Implied by -O0 only.
1571
1572 -fomit-yields
1573 Omit heap checks when no allocation is being performed.
1574
1575 -foptimal-applicative-do
1576 Use a slower but better algorithm for ApplicativeDo
1577
1578 -fpedantic-bottoms
1579 Make GHC be more precise about its treatment of bottom (but see
1580 also -fno-state-hack). In particular, GHC will not eta-expand
1581 through a case expression.
1582
1583 -fregs-graph
1584 Use the graph colouring register allocator for register alloca‐
1585 tion in the native code generator. Implied by -O2.
1586
1587 -fregs-iterative
1588 Use the iterative coalescing graph colouring register allocator
1589 in the native code generator.
1590
1591 -fsimpl-tick-factor=⟨n⟩
1592 default: 100. Set the percentage factor for simplifier ticks.
1593
1594 -fsimplifier-phases=⟨n⟩
1595 default: 2. Set the number of phases for the simplifier. Ig‐
1596 nored with -O0.
1597
1598 -fsolve-constant-dicts
1599 When solving constraints, try to eagerly solve super classes us‐
1600 ing available dictionaries.
1601
1602 -fspec-constr
1603 Turn on the SpecConstr transformation. Implied by -O2.
1604
1605 -fspec-constr-count=⟨n⟩
1606 default: 3.* Set to ⟨n⟩ the maximum number of specialisations
1607 that will be created for any one function by the SpecConstr
1608 transformation.
1609
1610 -fspec-constr-keen
1611 Specialize a call with an explicit constructor argument, even if
1612 the argument is not scrutinised in the body of the function
1613
1614 -fspec-constr-threshold=⟨n⟩
1615 default: 2000. Set the size threshold for the SpecConstr trans‐
1616 formation to ⟨n⟩.
1617
1618 -fspecialise
1619 Turn on specialisation of overloaded functions. Implied by -O.
1620
1621 -fspecialise-aggressively
1622 Turn on specialisation of overloaded functions regardless of
1623 size, if unfolding is available
1624
1625 -fstatic-argument-transformation
1626 Turn on the static argument transformation.
1627
1628 -fstg-cse
1629 Enable common sub-expression elimination on the STG intermediate
1630 language
1631
1632 -fstg-lift-lams
1633 Enable late lambda lifting on the STG intermediate language. Im‐
1634 plied by -O2.
1635
1636 -fstg-lift-lams-known
1637 Allow turning known into unknown calls while performing late
1638 lambda lifting.
1639
1640 -fstg-lift-lams-non-rec-args
1641 Create top-level non-recursive functions with at most <n> param‐
1642 eters while performing late lambda lifting.
1643
1644 -fstg-lift-lams-rec-args
1645 Create top-level recursive functions with at most <n> parameters
1646 while performing late lambda lifting.
1647
1648 -fstrictness
1649 Turn on strictness analysis. Implied by -O. Implies
1650 -fworker-wrapper
1651
1652 -fstrictness-before=⟨n⟩
1653 Run an additional strictness analysis before simplifier phase
1654 ⟨n⟩
1655
1656 -funbox-small-strict-fields
1657 Flatten strict constructor fields with a pointer-sized represen‐
1658 tation. Implied by -O.
1659
1660 -funbox-strict-fields
1661 Flatten strict constructor fields
1662
1663 -funfolding-creation-threshold=⟨n⟩
1664 default: 750. Tweak unfolding settings.
1665
1666 -funfolding-dict-discount=⟨n⟩
1667 default: 30. Tweak unfolding settings.
1668
1669 -funfolding-fun-discount=⟨n⟩
1670 default: 60. Tweak unfolding settings.
1671
1672 -funfolding-keeness-factor=⟨n⟩
1673 This has been deprecated in GHC 9.0.1.
1674
1675 -funfolding-use-threshold=⟨n⟩
1676 default: 80. Tweak unfolding settings.
1677
1678 -fworker-wrapper
1679 Enable the worker-wrapper transformation.
1680
1681 Optimization levels
1682 -O Enable level 1 optimisations
1683
1684 -O0 Disable optimisations (default)
1685
1686 -O2 Enable level 2 optimisations
1687
1688 -O⟨n⟩ Any -On where n > 2 is the same as -O2.
1689
1690 Package options
1691 -clear-package-db
1692 Clear the package db stack.
1693
1694 -distrust ⟨pkg⟩
1695 Expose package ⟨pkg⟩ and set it to be distrusted. See Safe
1696 Haskell.
1697
1698 -distrust-all-packages
1699 Distrust all packages by default. See Safe Haskell.
1700
1701 -fpackage-trust
1702 Enable Safe Haskell trusted package requirement for trustworthy
1703 modules.
1704
1705 -global-package-db
1706 Add the global package db to the stack.
1707
1708 -hide-all-packages
1709 Hide all packages by default
1710
1711 -hide-package ⟨pkg⟩
1712 Hide package ⟨pkg⟩
1713
1714 -ignore-package ⟨pkg⟩
1715 Ignore package ⟨pkg⟩
1716
1717 -no-auto-link-packages
1718 Don't automatically link in the base and rts packages.
1719
1720 -no-global-package-db
1721 Remove the global package db from the stack.
1722
1723 -no-user-package-db
1724 Remove the user's package db from the stack.
1725
1726 -package ⟨pkg⟩
1727 Expose package ⟨pkg⟩
1728
1729 -package-db ⟨file⟩
1730 Add ⟨file⟩ to the package db stack.
1731
1732 -package-env ⟨file⟩|⟨name⟩
1733 Use the specified package environment.
1734
1735 -package-id ⟨unit-id⟩
1736 Expose package by id ⟨unit-id⟩
1737
1738 -this-unit-id ⟨unit-id⟩
1739 Compile to be part of unit (i.e. package) ⟨unit-id⟩
1740
1741 -trust ⟨pkg⟩
1742 Expose package ⟨pkg⟩ and set it to be trusted. See Safe Haskell.
1743
1744 -user-package-db
1745 Add the user's package db to the stack.
1746
1747 Phases of compilation
1748 -C Stop after generating C (.hc file)
1749
1750 -c Stop after generating object (.o) file
1751
1752 -E Stop after preprocessing (.hspp file)
1753
1754 -F Enable the use of a pre-processor (set with -pgmF ⟨cmd⟩)
1755
1756 -S Stop after generating assembly (.s file)
1757
1758 -x ⟨suffix⟩
1759 Override default behaviour for source files
1760
1761 Overriding external programs
1762 -pgma ⟨cmd⟩
1763 Use ⟨cmd⟩ as the assembler
1764
1765 -pgmc ⟨cmd⟩
1766 Use ⟨cmd⟩ as the C compiler
1767
1768 -pgmdll ⟨cmd⟩
1769 Use ⟨cmd⟩ as the DLL generator
1770
1771 -pgmF ⟨cmd⟩
1772 Use ⟨cmd⟩ as the pre-processor (with -F only)
1773
1774 -pgmi ⟨cmd⟩
1775 Use ⟨cmd⟩ as the external interpreter command.
1776
1777 -pgminstall_name_tool ⟨cmd⟩
1778 Use ⟨cmd⟩ as the program to inject runpath into mach-o dylibs on
1779 macOS
1780
1781 -pgmL ⟨cmd⟩
1782 Use ⟨cmd⟩ as the literate pre-processor
1783
1784 -pgml ⟨cmd⟩
1785 Use ⟨cmd⟩ as the linker
1786
1787 -pgmlc ⟨cmd⟩
1788 Use ⟨cmd⟩ as the LLVM compiler
1789
1790 -pgmlibtool ⟨cmd⟩
1791 Use ⟨cmd⟩ as the command for libtool (with -staticlib only).
1792
1793 -pgmlm ⟨cmd⟩
1794 Use ⟨cmd⟩ as the linker when merging object files
1795
1796 -pgmlo ⟨cmd⟩
1797 Use ⟨cmd⟩ as the LLVM optimiser
1798
1799 -pgmotool ⟨cmd⟩
1800 Use ⟨cmd⟩ as the program to inspect mach-o dylibs on macOS
1801
1802 -pgmP ⟨cmd⟩
1803 Use ⟨cmd⟩ as the C pre-processor (with -cpp only)
1804
1805 -pgms ⟨cmd⟩
1806 Use ⟨cmd⟩ as the splitter
1807
1808 -pgmwindres ⟨cmd⟩
1809 Use ⟨cmd⟩ as the program for embedding manifests on Windows.
1810
1811 Phase-specific options
1812 -opta ⟨option⟩
1813 pass ⟨option⟩ to the assembler
1814
1815 -optc ⟨option⟩
1816 pass ⟨option⟩ to the C compiler
1817
1818 -optcxx ⟨option⟩
1819 pass ⟨option⟩ to the C++ compiler
1820
1821 -optdll ⟨option⟩
1822 pass ⟨option⟩ to the DLL generator
1823
1824 -optF ⟨option⟩
1825 pass ⟨option⟩ to the custom pre-processor
1826
1827 -opti ⟨option⟩
1828 pass ⟨option⟩ to the interpreter sub-process.
1829
1830 -optL ⟨option⟩
1831 pass ⟨option⟩ to the literate pre-processor
1832
1833 -optl ⟨option⟩
1834 pass ⟨option⟩ to the linker
1835
1836 -optlc ⟨option⟩
1837 pass ⟨option⟩ to the LLVM compiler
1838
1839 -optlm ⟨option⟩
1840 pass ⟨option⟩ to the linker when merging object files.
1841
1842 -optlo ⟨option⟩
1843 pass ⟨option⟩ to the LLVM optimiser
1844
1845 -optP ⟨option⟩
1846 pass ⟨option⟩ to cpp (with -cpp only)
1847
1848 -optwindres ⟨option⟩
1849 pass ⟨option⟩ to windres.
1850
1851 -pgmc-supports-no-pie
1852 Indicate that the C compiler supports -no-pie
1853
1854 Platform-specific options
1855 -mbmi2 (x86 only) Use BMI2 for bit manipulation operations
1856
1857 -msse2 (x86 only) Use SSE2 for floating-point operations
1858
1859 -msse4.2
1860 (x86 only) Use SSE4.2 for floating-point operations
1861
1862 Compiler plugins
1863 -fclear-plugins
1864 Clear the list of active plugins
1865
1866 -fplugin-opt=⟨module⟩:⟨args⟩
1867 Give arguments to a plugin module; module must be specified with
1868 -fplugin=⟨module⟩
1869
1870 -fplugin-trustworthy
1871 Trust the used plugins and no longer mark the compiled module as
1872 unsafe
1873
1874 -fplugin=⟨module⟩
1875 Load a plugin exported by a given module
1876
1877 -hide-all-plugin-packages
1878 Hide all packages for plugins by default
1879
1880 -plugin-package ⟨pkg⟩
1881 Expose ⟨pkg⟩ for plugins
1882
1883 -plugin-package-id ⟨pkg-id⟩
1884 Expose ⟨pkg-id⟩ for plugins
1885
1886 Profiling
1887 -fno-prof-auto
1888 Disables any previous -fprof-auto, -fprof-auto-top, or
1889 -fprof-auto-exported options.
1890
1891 -fno-prof-cafs
1892 Disables any previous -fprof-cafs option.
1893
1894 -fno-prof-count-entries
1895 Do not collect entry counts
1896
1897 -fprof-auto
1898 Auto-add SCC\ s to all bindings not marked INLINE
1899
1900 -fprof-auto-calls
1901 Auto-add SCC\ s to all call sites
1902
1903 -fprof-auto-exported
1904 Auto-add SCC\ s to all exported bindings not marked INLINE
1905
1906 -fprof-auto-top
1907 Auto-add SCC\ s to all top-level bindings not marked INLINE
1908
1909 -fprof-cafs
1910 Auto-add SCC\ s to all CAFs
1911
1912 -prof Turn on profiling
1913
1914 -ticky Turn on ticky-ticky profiling
1915
1916 Program coverage
1917 -fhpc Turn on Haskell program coverage instrumentation
1918
1919 Recompilation checking
1920 -fforce-recomp
1921 Turn off recompilation checking. This is implied by any -ddump-X
1922 option when compiling a single file (i.e. when using -c).
1923
1924 -fignore-hpc-changes
1925 Do not recompile modules just to match changes to HPC flags.
1926 This is especially useful for avoiding recompilation when using
1927 GHCi, and is enabled by default for GHCi.
1928
1929 -fignore-optim-changes
1930 Do not recompile modules just to match changes to optimisation
1931 flags. This is especially useful for avoiding recompilation when
1932 using GHCi, and is enabled by default for GHCi.
1933
1934 Redirecting output
1935 --exclude-module=⟨file⟩
1936 Regard ⟨file⟩ as "stable"; i.e., exclude it from having depen‐
1937 dencies on it.
1938
1939 -ddump-mod-cycles
1940 Dump module cycles
1941
1942 -dep-makefile ⟨file⟩
1943 Use ⟨file⟩ as the makefile
1944
1945 -dep-suffix ⟨suffix⟩
1946 Make dependencies that declare that files with suffix
1947 .⟨suf⟩⟨osuf⟩ depend on interface files with suffix .⟨suf⟩hi
1948
1949 -dumpdir ⟨dir⟩
1950 redirect dump files
1951
1952 -hcsuf ⟨suffix⟩
1953 set the suffix to use for intermediate C files
1954
1955 -hidir ⟨dir⟩
1956 set directory for interface files
1957
1958 -hiedir ⟨dir⟩
1959 set directory for extended interface files
1960
1961 -hiesuf ⟨suffix⟩
1962 set the suffix to use for extended interface files
1963
1964 -hisuf ⟨suffix⟩
1965 set the suffix to use for interface files
1966
1967 -include-cpp-deps
1968 Include preprocessor dependencies
1969
1970 -include-pkg-deps
1971 Regard modules imported from packages as unstable
1972
1973 -o ⟨file⟩
1974 set output filename
1975
1976 -odir ⟨dir⟩
1977 set directory for object files
1978
1979 -ohi ⟨file⟩
1980 set the filename in which to put the interface
1981
1982 -osuf ⟨suffix⟩
1983 set the output file suffix
1984
1985 -outputdir ⟨dir⟩
1986 set output directory
1987
1988 -stubdir ⟨dir⟩
1989 redirect FFI stub files
1990
1991 Temporary files
1992 -tmpdir ⟨dir⟩
1993 set the directory for temporary files
1994
1995 Verbosity options
1996 -fabstract-refinement-hole-fits
1997 default: off. Toggles whether refinements where one or more of
1998 the holes are abstract are reported.
1999
2000 -fdefer-diagnostics
2001 Defer and group diagnostic messages by severity
2002
2003 -fdiagnostics-color=⟨always|auto|never⟩
2004 Use colors in error messages
2005
2006 -fdiagnostics-show-caret
2007 Whether to show snippets of original source code
2008
2009 -ferror-spans
2010 Output full span in error messages
2011
2012 -fhide-source-paths
2013 hide module source and object paths
2014
2015 -fkeep-going
2016 Continue compilation as far as possible on errors
2017
2018 -fmax-refinement-hole-fits=⟨n⟩
2019 default: 6. Set the maximum number of refinement hole fits for
2020 typed holes to display in type error messages.
2021
2022 -fmax-relevant-binds=⟨n⟩
2023 default: 6. Set the maximum number of bindings to display in
2024 type error messages.
2025
2026 -fmax-valid-hole-fits=⟨n⟩
2027 default: 6. Set the maximum number of valid hole fits for typed
2028 holes to display in type error messages.
2029
2030 -fno-show-valid-hole-fits
2031 Disables showing a list of valid hole fits for typed holes in
2032 type error messages.
2033
2034 -fno-sort-valid-hole-fits
2035 Disables the sorting of the list of valid hole fits for typed
2036 holes in type error messages.
2037
2038 -fprint-axiom-incomps
2039 Display equation incompatibilities in closed type families
2040
2041 -fprint-equality-relations
2042 Distinguish between equality relations when printing
2043
2044 -fprint-expanded-synonyms
2045 In type errors, also print type-synonym-expanded types.
2046
2047 -fprint-explicit-coercions
2048 Print coercions in types
2049
2050 -fprint-explicit-foralls
2051 Print explicit forall quantification in types. See also Explic‐
2052 itForAll
2053
2054 -fprint-explicit-kinds
2055 Print explicit kind foralls and kind arguments in types. See
2056 also KindSignatures
2057
2058 -fprint-explicit-runtime-reps
2059 Print RuntimeRep variables in types which are runtime-represen‐
2060 tation polymorphic.
2061
2062 -fprint-potential-instances
2063 display all available instances in type error messages
2064
2065 -fprint-typechecker-elaboration
2066 Print extra information from typechecker.
2067
2068 -fprint-unicode-syntax
2069 Use unicode syntax when printing expressions, types and kinds.
2070 See also UnicodeSyntax
2071
2072 -frefinement-level-hole-fits=⟨n⟩
2073 default: off. Sets the level of refinement of the refinement
2074 hole fits, where level n means that hole fits of up to n holes
2075 will be considered.
2076
2077 -freverse-errors
2078 Output errors in reverse order
2079
2080 -fshow-docs-of-hole-fits
2081 Toggles whether to show the documentation of the valid hole fits
2082 in the output.
2083
2084 -fshow-hole-constraints
2085 Show constraints when reporting typed holes.
2086
2087 -fshow-hole-matches-of-hole-fits
2088 Toggles whether to show the type of the additional holes in re‐
2089 finement hole fits.
2090
2091 -fshow-provenance-of-hole-fits
2092 Toggles whether to show the provenance of the valid hole fits in
2093 the output.
2094
2095 -fshow-type-app-of-hole-fits
2096 Toggles whether to show the type application of the valid hole
2097 fits in the output.
2098
2099 -fshow-type-app-vars-of-hole-fits
2100 Toggles whether to show what type each quantified variable takes
2101 in a valid hole fit.
2102
2103 -fshow-type-of-hole-fits
2104 Toggles whether to show the type of the valid hole fits in the
2105 output.
2106
2107 -fsort-by-size-hole-fits
2108 Sort valid hole fits by size.
2109
2110 -fsort-by-subsumption-hole-fits
2111 Sort valid hole fits by subsumption.
2112
2113 -funclutter-valid-hole-fits
2114 Unclutter the list of valid hole fits by not showing provenance
2115 nor type applications of suggestions.
2116
2117 -Rghc-timing
2118 Summarise timing stats for GHC (same as +RTS -tstderr).
2119
2120 -v verbose mode (equivalent to -v3)
2121
2122 -v⟨n⟩ set verbosity level
2123
2124 Warnings
2125 -fdefer-out-of-scope-variables
2126 Convert variable out of scope variables errors into warnings.
2127 Implied by -fdefer-type-errors. See also
2128 -Wdeferred-out-of-scope-variables.
2129
2130 -fdefer-type-errors
2131 Turn type errors into warnings, deferring the error until run‐
2132 time. Implies -fdefer-typed-holes and
2133 -fdefer-out-of-scope-variables. See also -Wdeferred-type-errors
2134
2135 -fdefer-typed-holes
2136 Convert typed hole errors into warnings, deferring the error un‐
2137 til runtime. Implied by -fdefer-type-errors. See also
2138 -Wtyped-holes.
2139
2140 -fenable-th-splice-warnings
2141 Generate warnings for Template Haskell splices
2142
2143 -fhelpful-errors
2144 Make suggestions for mis-spelled names.
2145
2146 -fmax-pmcheck-models=⟨n⟩
2147 soft limit on the number of parallel models the pattern match
2148 checker should check a pattern match clause against
2149
2150 -fshow-warning-groups
2151 show which group an emitted warning belongs to.
2152
2153 -fvia-C
2154 use the C code generator
2155
2156 -W enable normal warnings
2157
2158 -w disable all warnings
2159
2160 -Wall enable almost all warnings (details in Warnings and san‐
2161 ity-checking)
2162
2163 -Wall-missed-specialisations
2164 warn when specialisation of any overloaded function fails.
2165
2166 -Wauto-orphans
2167 (deprecated) Does nothing
2168
2169 -Wcompat
2170 enable future compatibility warnings (details in Warnings and
2171 sanity-checking)
2172
2173 -Wcompat-unqualified-imports
2174 Report unqualified imports of core libraries which are expected
2175 to cause compatibility problems in future releases.
2176
2177 -Wcpp-undef
2178 warn on uses of the #if directive on undefined identifiers
2179
2180 -Wdefault
2181 enable default flags
2182
2183 -Wdeferred-out-of-scope-variables
2184 Report warnings when variable out-of-scope errors are deferred
2185 until runtime. See -fdefer-out-of-scope-variables.
2186
2187 -Wdeferred-type-errors
2188 Report warnings when deferred type errors are enabled. This op‐
2189 tion is enabled by default. See -fdefer-type-errors.
2190
2191 -Wdeprecated-flags
2192 warn about uses of commandline flags that are deprecated
2193
2194 -Wdeprecations
2195 warn about uses of functions & types that have warnings or dep‐
2196 recated pragmas. Alias for -Wwarnings-deprecations
2197
2198 -Wderiving-defaults
2199 warn about default deriving when using both DeriveAnyClass and
2200 GeneralizedNewtypeDeriving
2201
2202 -Wderiving-typeable
2203 warn when Typeable is derived
2204
2205 -Wdodgy-exports
2206 warn about dodgy exports
2207
2208 -Wdodgy-foreign-imports
2209 warn about dodgy foreign imports
2210
2211 -Wdodgy-imports
2212 warn about dodgy imports
2213
2214 -Wduplicate-constraints
2215 warn when a constraint appears duplicated in a type signature
2216
2217 -Wduplicate-exports
2218 warn when an entity is exported multiple times
2219
2220 -Wempty-enumerations
2221 warn about enumerations that are empty
2222
2223 -Werror
2224 make warnings fatal
2225
2226 -Weverything
2227 enable all warnings supported by GHC
2228
2229 -Whi-shadowing
2230 (deprecated) warn when a .hi file in the current directory shad‐
2231 ows a library
2232
2233 -Widentities
2234 warn about uses of Prelude numeric conversions that are probably
2235 the identity (and hence could be omitted)
2236
2237 -Wimplicit-kind-vars
2238 warn when kind variables are implicitly quantified over.
2239
2240 -Wimplicit-prelude
2241 warn when the Prelude is implicitly imported
2242
2243 -Winaccessible-code
2244 warn about inaccessible code
2245
2246 -Wincomplete-patterns
2247 warn when a pattern match could fail
2248
2249 -Wincomplete-record-updates
2250 warn when a record update could fail
2251
2252 -Wincomplete-uni-patterns
2253 warn when a pattern match in a lambda expression or pattern
2254 binding could fail
2255
2256 -Winferred-safe-imports
2257 warn when an explicitly Safe Haskell module imports a Safe-In‐
2258 ferred one
2259
2260 -Winline-rule-shadowing
2261 Warn if a rewrite RULE might fail to fire because the function
2262 might be inlined before the rule has a chance to fire. See How
2263 rules interact with INLINE/NOINLINE pragmas.
2264
2265 -Winvalid-haddock
2266 warn when a Haddock comment occurs in an invalid position
2267
2268 -Wmissed-extra-shared-lib
2269 Warn when GHCi can't load a shared lib.
2270
2271 -Wmissed-specialisations
2272 warn when specialisation of an imported, overloaded function
2273 fails.
2274
2275 -Wmissing-deriving-strategies
2276 warn when a deriving clause is missing a deriving strategy
2277
2278 -Wmissing-export-lists
2279 warn when a module declaration does not explicitly list all ex‐
2280 ports
2281
2282 -Wmissing-exported-signatures
2283 warn about top-level functions without signatures, only if they
2284 are exported. takes precedence over -Wmissing-signatures
2285
2286 -Wmissing-exported-sigs
2287 (deprecated) warn about top-level functions without signatures,
2288 only if they are exported. takes precedence over -Wmissing-sig‐
2289 natures
2290
2291 -Wmissing-fields
2292 warn when fields of a record are uninitialised
2293
2294 -Wmissing-home-modules
2295 warn when encountering a home module imported, but not listed on
2296 the command line. Useful for cabal to ensure GHC won't pick up
2297 modules, not listed neither in exposed-modules, nor in
2298 other-modules.
2299
2300 -Wmissing-import-lists
2301 warn when an import declaration does not explicitly list all the
2302 names brought into scope
2303
2304 -Wmissing-local-signatures
2305 warn about polymorphic local bindings without signatures
2306
2307 -Wmissing-local-sigs
2308 (deprecated) warn about polymorphic local bindings without sig‐
2309 natures
2310
2311 -Wmissing-methods
2312 warn when class methods are undefined
2313
2314 -Wmissing-monadfail-instances
2315 Warn when a failable pattern is used in a do-block that does not
2316 have a MonadFail instance.
2317
2318 -Wmissing-pattern-synonym-signatures
2319 warn when pattern synonyms do not have type signatures
2320
2321 -Wmissing-safe-haskell-mode
2322 warn when the Safe Haskell mode is not explicitly specified.
2323
2324 -Wmissing-signatures
2325 warn about top-level functions without signatures
2326
2327 -Wmissing-space-after-bang
2328 (deprecated) Does nothing
2329
2330 -Wmonomorphism-restriction
2331 warn when the Monomorphism Restriction is applied
2332
2333 -Wname-shadowing
2334 warn when names are shadowed
2335
2336 -Wno-compat
2337 Disables all warnings enabled by -Wcompat.
2338
2339 -Wnoncanonical-monad-instances
2340 warn when Applicative or Monad instances have noncanonical defi‐
2341 nitions of return, pure, (>>), or (*>). See flag description in
2342 Warnings and sanity-checking for more details.
2343
2344 -Wnoncanonical-monadfail-instances
2345 warn when Monad or MonadFail instances have noncanonical defini‐
2346 tions of fail. See flag description in Warnings and san‐
2347 ity-checking for more details.
2348
2349 -Wnoncanonical-monoid-instances
2350 warn when Semigroup or Monoid instances have noncanonical defi‐
2351 nitions of (<>) or mappend. See flag description in Warnings
2352 and sanity-checking for more details.
2353
2354 -Worphans
2355 warn when the module contains orphan instance declarations or
2356 rewrite rules
2357
2358 -Woverflowed-literals
2359 warn about literals that will overflow their type
2360
2361 -Woverlapping-patterns
2362 warn about overlapping patterns
2363
2364 -Wpartial-fields
2365 warn when defining a partial record field.
2366
2367 -Wpartial-type-signatures
2368 warn about holes in partial type signatures when PartialTypeSig‐
2369 natures is enabled. Not applicable when PartialTypeSignatures is
2370 not enabled, in which case errors are generated for such holes.
2371
2372 -Wredundant-constraints
2373 Have the compiler warn about redundant constraints in type sig‐
2374 natures.
2375
2376 -Wredundant-record-wildcards
2377 Warn about record wildcard matches when the wildcard binds no
2378 patterns.
2379
2380 -Wsafe warn if the module being compiled is regarded to be safe.
2381
2382 -Wsemigroup
2383 warn when a Monoid is not Semigroup, and on non- Semigroup defi‐
2384 nitions of (<>)?
2385
2386 -Wsimplifiable-class-constraints
2387 Warn about class constraints in a type signature that can be
2388 simplified using a top-level instance declaration.
2389
2390 -Wstar-binder
2391 warn about binding the (*) type operator despite StarIsType
2392
2393 -Wstar-is-type
2394 warn when * is used to mean Data.Kind.Type
2395
2396 -Wtabs warn if there are tabs in the source file
2397
2398 -Wtrustworthy-safe
2399 warn if the module being compiled is marked as Trustworthy but
2400 it could instead be marked as Safe, a more informative bound.
2401
2402 -Wtype-defaults
2403 warn when defaulting happens
2404
2405 -Wtyped-holes
2406 Report warnings when typed hole errors are deferred until run‐
2407 time. See -fdefer-typed-holes.
2408
2409 -Wunbanged-strict-patterns
2410 warn on pattern bind of unlifted variable that is neither bare
2411 nor banged
2412
2413 -Wunicode-bidirectional-format-characters
2414 warn about the usage of unicode bidirectional layout override
2415 characters
2416
2417 -Wunrecognised-pragmas
2418 warn about uses of pragmas that GHC doesn't recognise
2419
2420 -Wunrecognised-warning-flags
2421 throw a warning when an unrecognised -W... flag is encountered
2422 on the command line.
2423
2424 -Wunsafe
2425 warn if the module being compiled is regarded to be unsafe. See
2426 Safe Haskell
2427
2428 -Wunsupported-calling-conventions
2429 warn about use of an unsupported calling convention
2430
2431 -Wunsupported-llvm-version
2432 Warn when using -fllvm with an unsupported version of LLVM.
2433
2434 -Wunticked-promoted-constructors
2435 warn if promoted constructors are not ticked
2436
2437 -Wunused-binds
2438 warn about bindings that are unused. Alias for
2439 -Wunused-top-binds, -Wunused-local-binds and
2440 -Wunused-pattern-binds
2441
2442 -Wunused-do-bind
2443 warn about do bindings that appear to throw away values of types
2444 other than ()
2445
2446 -Wunused-foralls
2447 warn about type variables in user-written forall\s that are un‐
2448 used
2449
2450 -Wunused-imports
2451 warn about unnecessary imports
2452
2453 -Wunused-local-binds
2454 warn about local bindings that are unused
2455
2456 -Wunused-matches
2457 warn about variables in patterns that aren't used
2458
2459 -Wunused-packages
2460 warn when package is requested on command line, but was never
2461 loaded.
2462
2463 -Wunused-pattern-binds
2464 warn about pattern match bindings that are unused
2465
2466 -Wunused-record-wildcards
2467 Warn about record wildcard matches when none of the bound vari‐
2468 ables are used.
2469
2470 -Wunused-top-binds
2471 warn about top-level bindings that are unused
2472
2473 -Wunused-type-patterns
2474 warn about unused type variables which arise from patterns in in
2475 type family and data family instances
2476
2477 -Wwarn make warnings non-fatal
2478
2479 -Wwarnings-deprecations
2480 warn about uses of functions & types that have warnings or dep‐
2481 recated pragmas
2482
2483 -Wwrong-do-bind
2484 warn about do bindings that appear to throw away monadic values
2485 that you should have bound instead
2486
2488 Copyright 2015. The University Court of the University of Glasgow. All
2489 rights reserved.
2490
2492 https://www.haskell.org/ghc the GHC homepage
2493
2495 The GHC Team
2496
2498 2023, GHC Team
2499
2500
2501
2502
25039.0.2 Jul 19, 2023 GHC(1)