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 and HTML; see
16 below.
17
18 Each of GHC's command line options is classified as either static or
19 dynamic. A static flag may only be specified on the command line,
20 whereas a dynamic flag may also be given in an OPTIONS pragma in a
21 source file or set from the GHCi command-line with :set .
22
23 As a rule of thumb, all the language options are dynamic, as are the
24 warning options and the debugging options.
25
26 The rest are static, with the notable exceptions of -v, -cpp, -fasm,
27 -fvia-C, -fllvm, and -#include. The OPTIONS sections lists the status
28 of each flag.
29
30 Common suffixes of file names for Haskell are:
31
32 .hs Haskell source code; preprocess, compile
33
34 .lhs literate Haskell source; unlit, preprocess, compile
35
36 .hi Interface file; contains information about exported symbols
37
38 .hc intermediate C files
39
40 .⟨way⟩_o
41 object files for "way" ⟨way⟩; common ways are:
42
43 dyn dynamically-linked
44
45 p built with profiling
46
47 .⟨way⟩_hi
48 interface files for "way" ⟨way⟩; common ways are:
49
51 Code generation
52 -dynamic-too -fasm -fbyte-code -fllvm -fno-code -fobject-code
53 -fPIC -fPIE -fwrite-interface
54
55 Debugging the compiler
56 -dcmm-lint -dcore-lint -ddump-asm -ddump-asm-expanded
57 -ddump-asm-liveness -ddump-asm-native -ddump-asm-regalloc
58 -ddump-asm-regalloc-stages -ddump-asm-stats -ddump-bcos
59 -ddump-cmm -ddump-cmm-caf -ddump-cmm-cbe -ddump-cmm-cfg
60 -ddump-cmm-cps -ddump-cmm-from-stg -ddump-cmm-info
61 -ddump-cmm-proc -ddump-cmm-procmap -ddump-cmm-raw
62 -ddump-cmm-sink -ddump-cmm-sp -ddump-cmm-split -ddump-cmm-switch
63 -ddump-cmm-verbose -ddump-core-stats -ddump-cse -ddump-deriv
64 -ddump-ds -ddump-ec-trace -ddump-foreign -ddump-if-trace
65 -ddump-inlinings -ddump-json -ddump-llvm -ddump-occur-anal
66 -ddump-opt-cmm -ddump-parsed -ddump-parsed-ast -ddump-prep
67 -ddump-rn -ddump-rn-ast -ddump-rn-stats -ddump-rn-trace
68 -ddump-rule-firings -ddump-rule-rewrites -ddump-rules
69 -ddump-simpl -ddump-simpl-iterations -ddump-simpl-stats
70 -ddump-spec -ddump-splices -ddump-stg -ddump-str-signatures
71 -ddump-stranal -ddump-tc -ddump-tc-ast -ddump-tc-trace
72 -ddump-timings -ddump-to-file -ddump-types -ddump-vect
73 -ddump-vt-trace -ddump-worker-wrapper -dfaststring-stats -dini‐
74 tial-unique=⟨s⟩ -dno-debug-output -dppr-case-as-let
75 -dppr-cols=⟨n⟩ -dppr-debug -dppr-user-length -dshow-passes
76 -dstg-lint -dsuppress-all -dsuppress-coercions -dsuppress-idinfo
77 -dsuppress-module-prefixes -dsuppress-stg-free-vars -dsup‐
78 press-ticks -dsuppress-type-applications -dsuppress-type-signa‐
79 tures -dsuppress-unfoldings -dsuppress-uniques -dsup‐
80 press-var-kinds -dth-dec-file=⟨file⟩ -dunique-increment=⟨i⟩
81 -dverbose-core2core -dverbose-stg2stg -falignment-sanitisation
82 -fcatch-bottoms -fllvm-fill-undef-with-garbage -g -g⟨n⟩
83
84 C pre-processor
85 -cpp -D⟨symbol⟩[=⟨value⟩] -I⟨dir⟩ -U⟨symbol⟩
86
87 Finding imports
88 -i -i⟨dir⟩[:⟨dir⟩]*
89
90 Interactive mode
91 -fbreak-on-error -fbreak-on-exception -fghci-hist-size=⟨n⟩ -flo‐
92 cal-ghci-history -fprint-bind-result -fshow-loaded-modules
93 -ghci-script -ignore-dot-ghci -interactive-print ⟨expr⟩
94
95 Interface files
96 --show-iface ⟨file⟩ -ddump-hi -ddump-hi-diffs -ddump-mini‐
97 mal-imports
98
99 Keeping intermediate files
100 -keep-hc-file -keep-hc-files -keep-hi-files -keep-llvm-file
101 -keep-llvm-files -keep-o-files -keep-s-file -keep-s-files
102 -keep-tmp-files
103
104 Language options
105 -XAllowAmbiguousTypes -XApplicativeDo -XArrows -XBangPatterns
106 -XBinaryLiterals -XCApiFFI -XConstrainedClassMethods -XCon‐
107 straintKinds -XCPP -XDataKinds -XDatatypeContexts -XDefaultSig‐
108 natures -XDeriveAnyClass -XDeriveDataTypeable -XDeriveFoldable
109 -XDeriveFunctor -XDeriveGeneric -XDeriveLift -XDeriveTraversable
110 -XDerivingStrategies -XDisambiguateRecordFields -XDuplicateRe‐
111 cordFields -XEmptyCase -XEmptyDataDecls -XEmptyDataDeriving
112 -XExistentialQuantification -XExplicitForAll -XExplicitNames‐
113 paces -XExtendedDefaultRules -XFlexibleContexts -XFlexibleIn‐
114 stances -XForeignFunctionInterface -XFunctionalDependencies
115 -XGADTs -XGADTSyntax -XGeneralisedNewtypeDeriving -XGeneralized‐
116 NewtypeDeriving -XHexFloatLiterals -XImplicitParams -XImpredica‐
117 tiveTypes -XIncoherentInstances -XInstanceSigs -XInterrupt‐
118 ibleFFI -XKindSignatures -XLambdaCase -XLiberalTypeSynonyms
119 -XMagicHash -XMonadComprehensions -XMonadFailDesugaring
120 -XMonoLocalBinds -XMultiParamTypeClasses -XMultiWayIf -XNamed‐
121 FieldPuns -XNamedWildCards -XNegativeLiterals -XNoImplicitPre‐
122 lude -XNoMonomorphismRestriction -XNoPatternGuards -XNoTradi‐
123 tionalRecordSyntax -XNPlusKPatterns -XNullaryTypeClasses
124 -XNumDecimals -XOverlappingInstances -XOverloadedLabels -XOver‐
125 loadedLists -XOverloadedStrings -XPackageImports -XParallelList‐
126 Comp -XPartialTypeSignatures -XPatternSynonyms -XPolyKinds
127 -XPostfixOperators -XQuasiQuotes -XRank2Types -XRankNTypes -XRe‐
128 bindableSyntax -XRecordWildCards -XRecursiveDo -XRoleAnnotations
129 -XSafe -XScopedTypeVariables -XStandaloneDeriving -XStaticPoint‐
130 ers -XStrict -XStrictData -XTemplateHaskell -XTemplateHaskel‐
131 lQuotes -XTransformListComp -XTrustworthy -XTupleSections -XTy‐
132 peApplications -XTypeFamilies -XTypeFamilyDependencies -XTypeIn‐
133 Type -XTypeOperators -XTypeSynonymInstances -XUnboxedSums -XUn‐
134 boxedTuples -XUndecidableInstances -XUndecidableSuperClasses
135 -XUnicodeSyntax -XUnsafe -XViewPatterns
136
137 Linking options
138 -c -debug -dylib-install-name ⟨path⟩ -dynamic -dynload -eventlog
139 -fno-embed-manifest -fno-gen-manifest -fno-shared-implib -frame‐
140 work ⟨name⟩ -framework-path ⟨dir⟩ -fwhole-archive-hs-libs -L
141 ⟨dir⟩ -l ⟨lib⟩ -main-is ⟨thing⟩ -no-hs-main -no-rtsopts-sugges‐
142 tions -package ⟨name⟩ -pie -rdynamic -rtsopts[=⟨none|some|all⟩]
143 -shared -split-objs -split-sections -static -staticlib -threaded
144 -with-rtsopts=⟨opts⟩
145
146 Miscellaneous options
147 -fexternal-interpreter -fglasgow-exts -ghcversion-file ⟨path to
148 ghcversion.h⟩ -H ⟨size⟩ -j[⟨n⟩]
149
150 Modes of operation
151 --frontend ⟨module⟩ --help -? --info --interactive --make
152 --mk-dll --numeric-version --print-libdir --show-iface ⟨file⟩
153 --show-options --supported-extensions --supported-languages
154 --version -V -e ⟨expr⟩ -M
155
156 Individual optimizations
157 -fcall-arity -fcase-folding -fcase-merge -fcmm-elim-com‐
158 mon-blocks -fcmm-sink -fcpr-anal -fcross-module-specialise -fcse
159 -fdicts-cheap -fdicts-strict -fdmd-tx-dict-sel -fdo-eta-reduc‐
160 tion -fdo-lambda-eta-expansion -feager-blackholing -fenable-re‐
161 write-rules -fexcess-precision -fexitification -fex‐
162 pose-all-unfoldings -ffloat-in -ffull-laziness -ffun-to-thunk
163 -fignore-asserts -fignore-interface-pragmas -flate-dmd-anal
164 -fliberate-case -fliberate-case-threshold=⟨n⟩ -fllvm-pass-vec‐
165 tors-in-regs -floopification -fmax-inline-alloc-size=⟨n⟩
166 -fmax-inline-memcpy-insns=⟨n⟩ -fmax-inline-memset-insns=⟨n⟩
167 -fmax-relevant-binds=⟨n⟩ -fmax-simplifier-iterations=⟨n⟩
168 -fmax-uncovered-patterns=⟨n⟩ -fmax-valid-substitutions=⟨n⟩
169 -fmax-worker-args=⟨n⟩ -fno-opt-coercion -fno-pre-inlining
170 -fno-state-hack -fomit-interface-pragmas -fomit-yields -fopti‐
171 mal-applicative-do -fpedantic-bottoms -fregs-graph -fregs-itera‐
172 tive -fsimpl-tick-factor=⟨n⟩ -fsimplifier-phases=⟨n⟩
173 -fsolve-constant-dicts -fspec-constr -fspec-constr-count=⟨n⟩
174 -fspec-constr-keen -fspec-constr-threshold=⟨n⟩ -fspecialise
175 -fspecialise-aggressively -fstatic-argument-transformation
176 -fstg-cse -fstrictness -fstrictness-before=⟨n⟩ -fun‐
177 box-small-strict-fields -funbox-strict-fields -funfolding-cre‐
178 ation-threshold=⟨n⟩ -funfolding-dict-discount=⟨n⟩ -funfold‐
179 ing-fun-discount=⟨n⟩ -funfolding-keeness-factor=⟨n⟩ -funfold‐
180 ing-use-threshold=⟨n⟩ -fvectorisation-avoidance -fvectorise
181
182 Optimization levels
183 -O -O1 -O0 -O2 -Odph
184
185 Package options
186 -clear-package-db -distrust ⟨pkg⟩ -distrust-all-packages -fpack‐
187 age-trust -global-package-db -hide-all-packages -hide-package
188 ⟨pkg⟩ -ignore-package ⟨pkg⟩ -no-auto-link-packages
189 -no-global-package-db -no-user-package-db -package ⟨pkg⟩ -pack‐
190 age-db ⟨file⟩ -package-env ⟨file⟩|⟨name⟩ -package-id ⟨unit-id⟩
191 -this-unit-id ⟨unit-id⟩ -trust ⟨pkg⟩ -user-package-db
192
193 Phases of compilation
194 -C -c -E -F -S -x ⟨suffix⟩
195
196 Overriding external programs
197 -pgma ⟨cmd⟩ -pgmc ⟨cmd⟩ -pgmdll ⟨cmd⟩ -pgmF ⟨cmd⟩ -pgmi ⟨cmd⟩
198 -pgmL ⟨cmd⟩ -pgml ⟨cmd⟩ -pgmlc ⟨cmd⟩ -pgmlibtool ⟨cmd⟩ -pgmlo
199 ⟨cmd⟩ -pgmP ⟨cmd⟩ -pgms ⟨cmd⟩ -pgmwindres ⟨cmd⟩
200
201 Phase-specific options
202 -opta ⟨option⟩ -optc ⟨option⟩ -optdll ⟨option⟩ -optF ⟨option⟩
203 -opti ⟨option⟩ -optL ⟨option⟩ -optl ⟨option⟩ -optlc ⟨option⟩
204 -optlo ⟨option⟩ -optP ⟨option⟩ -optwindres ⟨option⟩
205
206 Platform-specific options
207 -msse2 -msse4.2
208
209 Compiler plugins
210 -fplugin-opt=⟨module⟩:⟨args⟩ -fplugin=⟨module⟩ -hide-all-plug‐
211 in-packages -plugin-package ⟨pkg⟩ -plugin-package-id ⟨pkg-id⟩
212
213 Profiling
214 -fno-prof-auto -fno-prof-cafs -fno-prof-count-entries
215 -fprof-auto -fprof-auto-calls -fprof-auto-exported
216 -fprof-auto-top -fprof-cafs -prof -ticky
217
218 Program coverage
219 -fhpc
220
221 Recompilation checking
222 -fforce-recomp -fignore-hpc-changes -fignore-optim-changes
223
224 Redirecting output
225 --exclude-module=⟨file⟩ -ddump-mod-cycles -dep-makefile ⟨file⟩
226 -dep-suffix ⟨suffix⟩ -dumpdir ⟨dir⟩ -hcsuf ⟨suffix⟩ -hidir ⟨dir⟩
227 -hisuf ⟨suffix⟩ -include-pkg-deps -o ⟨file⟩ -odir ⟨dir⟩ -ohi
228 ⟨file⟩ -osuf ⟨suffix⟩ -outputdir ⟨dir⟩ -stubdir ⟨dir⟩
229
230 Temporary files
231 -tmpdir ⟨dir⟩
232
233 Verbosity options
234 -fdiagnostics-color=⟨always|auto|never⟩ -fdiagnostics-show-caret
235 -ferror-spans -fhide-source-paths -fprint-equality-relations
236 -fprint-expanded-synonyms -fprint-explicit-coercions
237 -fprint-explicit-foralls -fprint-explicit-kinds
238 -fprint-explicit-runtime-rep -fprint-explicit-runtime-reps
239 -fprint-potential-instances -fprint-typechecker-elaboration
240 -fprint-unicode-syntax -fshow-hole-constraints -Rghc-timing -v
241 -v⟨n⟩
242
243 Warnings
244 -fdefer-out-of-scope-variables -fdefer-type-errors -fde‐
245 fer-typed-holes -fhelpful-errors -fmax-pmcheck-iterations=⟨n⟩
246 -fshow-warning-groups -W -w -Wall -Wall-missed-specialisations
247 -Wamp -Wcompat -Wcpp-undef -Wdeferred-out-of-scope-variables
248 -Wdeferred-type-errors -Wdeprecated-flags -Wdeprecations
249 -Wdodgy-exports -Wdodgy-foreign-imports -Wdodgy-imports -Wdupli‐
250 cate-constraints -Wduplicate-exports -Wempty-enumerations -Wer‐
251 ror -Weverything -Whi-shadowing -Widentities -Wimplicit-prelude
252 -Wincomplete-patterns -Wincomplete-record-updates -Wincom‐
253 plete-uni-patterns -Winline-rule-shadowing -Wmissed-specialisa‐
254 tions -Wmissing-export-lists -Wmissing-exported-signatures
255 -Wmissing-exported-sigs -Wmissing-fields -Wmissing-home-modules
256 -Wmissing-import-lists -Wmissing-local-signatures -Wmiss‐
257 ing-local-sigs -Wmissing-methods -Wmissing-monadfail-instances
258 -Wmissing-pattern-synonym-signatures -Wmissing-signatures
259 -Wmonomorphism-restriction -Wname-shadowing -Wno-compat -Wnon‐
260 canonical-monad-instances -Wnoncanonical-monadfail-instances
261 -Wnoncanonical-monoid-instances -Worphans -Woverflowed-literals
262 -Woverlapping-patterns -Wpartial-fields -Wpartial-type-signa‐
263 tures -Wredundant-constraints -Wsafe -Wsemigroup -Wsimplifi‐
264 able-class-constraints -Wtabs -Wtrustworthy-safe -Wtype-defaults
265 -Wtyped-holes -Wunbanged-strict-patterns -Wunrecognised-pragmas
266 -Wunrecognised-warning-flags -Wunsafe -Wunsupported-calling-con‐
267 ventions -Wunsupported-llvm-version -Wunticked-promoted-con‐
268 structors -Wunused-binds -Wunused-do-bind -Wunused-foralls
269 -Wunused-imports -Wunused-local-binds -Wunused-matches
270 -Wunused-pattern-binds -Wunused-top-binds -Wunused-type-patterns
271 -Wwarn -Wwarnings-deprecations -Wwrong-do-bind
272
273 Code generation
274 -dynamic-too
275 Build dynamic object files as well as static object files during
276 compilation
277
278 -fasm Use the native code generator
279
280 -fbyte-code
281 Generate byte-code
282
283 -fllvm Compile using the LLVM code generator
284
285 -fno-code
286 Omit code generation
287
288 -fobject-code
289 Generate object code
290
291 -fPIC Generate position-independent code (where available)
292
293 -fPIE Generate code for a position-independent executable (where
294 available)
295
296 -fwrite-interface
297 Always write interface files
298
299 Debugging the compiler
300 -dcmm-lint
301 C-- pass sanity checking
302
303 -dcore-lint
304 Turn on internal sanity checking
305
306 -ddump-asm
307 Dump final assembly
308
309 -ddump-asm-expanded
310 Dump the result of the synthetic instruction expansion pass.
311
312 -ddump-asm-liveness
313 Dump assembly augmented with register liveness
314
315 -ddump-asm-native
316 Dump initial assembly
317
318 -ddump-asm-regalloc
319 Dump the result of register allocation
320
321 -ddump-asm-regalloc-stages
322 Dump the build/spill stages of the -fregs-graph register alloca‐
323 tor.
324
325 -ddump-asm-stats
326 Dump statistics from the register allocator.
327
328 -ddump-bcos
329 Dump interpreter byte code
330
331 -ddump-cmm
332 Dump the final C-- output
333
334 -ddump-cmm-caf
335 Dump the results of the C-- CAF analysis pass.
336
337 -ddump-cmm-cbe
338 Dump the results of common block elimination
339
340 -ddump-cmm-cfg
341 Dump the results of the C-- control flow optimisation pass.
342
343 -ddump-cmm-cps
344 Dump the results of the CPS pass
345
346 -ddump-cmm-from-stg
347 Dump STG-to-C-- output
348
349 -ddump-cmm-info
350 Dump the results of the C-- info table augmentation pass.
351
352 -ddump-cmm-proc
353 Dump the results of proc-point analysis
354
355 -ddump-cmm-procmap
356 Dump the results of the C-- proc-point map pass.
357
358 -ddump-cmm-raw
359 Dump raw C--
360
361 -ddump-cmm-sink
362 Dump the results of the C-- sinking pass.
363
364 -ddump-cmm-sp
365 Dump the results of the C-- stack layout pass.
366
367 -ddump-cmm-split
368 Dump the results of the C-- proc-point splitting pass.
369
370 -ddump-cmm-switch
371 Dump the results of switch lowering passes
372
373 -ddump-cmm-verbose
374 Show output from each C-- pipeline pass
375
376 -ddump-core-stats
377 Print a one-line summary of the size of the Core program at the
378 end of the optimisation pipeline
379
380 -ddump-cse
381 Dump CSE output
382
383 -ddump-deriv
384 Dump deriving output
385
386 -ddump-ds
387 Dump desugarer output
388
389 -ddump-ec-trace
390 Trace exhaustiveness checker
391
392 -ddump-foreign
393 Dump foreign export stubs
394
395 -ddump-if-trace
396 Trace interface files
397
398 -ddump-inlinings
399 Dump inlining info
400
401 -ddump-json
402 Dump error messages as JSON documents
403
404 -ddump-llvm
405 Dump LLVM intermediate code.
406
407 -ddump-occur-anal
408 Dump occurrence analysis output
409
410 -ddump-opt-cmm
411 Dump the results of C-- to C-- optimising passes
412
413 -ddump-parsed
414 Dump parse tree
415
416 -ddump-parsed-ast
417 Dump parser output as a syntax tree
418
419 -ddump-prep
420 Dump prepared core
421
422 -ddump-rn
423 Dump renamer output
424
425 -ddump-rn-ast
426 Dump renamer output as a syntax tree
427
428 -ddump-rn-stats
429 Renamer stats
430
431 -ddump-rn-trace
432 Trace renamer
433
434 -ddump-rule-firings
435 Dump rule firing info
436
437 -ddump-rule-rewrites
438 Dump detailed rule firing info
439
440 -ddump-rules
441 Dump rewrite rules
442
443 -ddump-simpl
444 Dump final simplifier output
445
446 -ddump-simpl-iterations
447 Dump output from each simplifier iteration
448
449 -ddump-simpl-stats
450 Dump simplifier stats
451
452 -ddump-spec
453 Dump specialiser output
454
455 -ddump-splices
456 Dump TH spliced expressions, and what they evaluate to
457
458 -ddump-stg
459 Dump final STG
460
461 -ddump-str-signatures
462 Dump strictness signatures
463
464 -ddump-stranal
465 Dump strictness analyser output
466
467 -ddump-tc
468 Dump typechecker output
469
470 -ddump-tc-ast
471 Dump typechecker output as a syntax tree
472
473 -ddump-tc-trace
474 Trace typechecker
475
476 -ddump-timings
477 Dump per-pass timing and allocation statistics
478
479 -ddump-to-file
480 Dump to files instead of stdout
481
482 -ddump-types
483 Dump type signatures
484
485 -ddump-vect
486 Dump vectoriser input and output
487
488 -ddump-vt-trace
489 Trace vectoriser
490
491 -ddump-worker-wrapper
492 Dump worker-wrapper output
493
494 -dfaststring-stats
495 Show statistics for fast string usage when finished
496
497 -dinitial-unique=⟨s⟩
498 Start UniqSupply allocation from ⟨s⟩.
499
500 -dno-debug-output
501 Suppress unsolicited debugging output
502
503 -dppr-case-as-let
504 Print single alternative case expressions as strict lets.
505
506 -dppr-cols=⟨n⟩
507 Set the width of debugging output. For example -dppr-cols200
508
509 -dppr-debug
510 Turn on debug printing (more verbose)
511
512 -dppr-user-length
513 Set the depth for printing expressions in error msgs
514
515 -dshow-passes
516 Print out each pass name as it happens
517
518 -dstg-lint
519 STG pass sanity checking
520
521 -dsuppress-all
522 In core dumps, suppress everything (except for uniques) that is
523 suppressible.
524
525 -dsuppress-coercions
526 Suppress the printing of coercions in Core dumps to make them
527 shorter
528
529 -dsuppress-idinfo
530 Suppress extended information about identifiers where they are
531 bound
532
533 -dsuppress-module-prefixes
534 Suppress the printing of module qualification prefixes
535
536 -dsuppress-stg-free-vars
537 Suppress the printing of closure free variable lists in STG out‐
538 put
539
540 -dsuppress-ticks
541 Suppress "ticks" in the pretty-printer output.
542
543 -dsuppress-type-applications
544 Suppress type applications
545
546 -dsuppress-type-signatures
547 Suppress type signatures
548
549 -dsuppress-unfoldings
550 Suppress the printing of the stable unfolding of a variable at
551 its binding site
552
553 -dsuppress-uniques
554 Suppress the printing of uniques in debug output (easier to use
555 diff)
556
557 -dsuppress-var-kinds
558 Suppress the printing of variable kinds
559
560 -dth-dec-file=⟨file⟩
561 Show evaluated TH declarations in a .th.hs file
562
563 -dunique-increment=⟨i⟩
564 Set the increment for the generated Unique's to ⟨i⟩.
565
566 -dverbose-core2core
567 Show output from each core-to-core pass
568
569 -dverbose-stg2stg
570 Show output from each STG-to-STG pass
571
572 -falignment-sanitisation
573 Compile with alignment checks for all info table dereferences.
574
575 -fcatch-bottoms
576 Insert error expressions after bottoming expressions; useful
577 when debugging the compiler.
578
579 -fllvm-fill-undef-with-garbage
580 Intruct LLVM to fill dead STG registers with garbage
581
582 -g Produce DWARF debug information in compiled object files. ⟨n⟩
583 can be 0, 1, or 2, with higher numbers producing richer output.
584 If ⟨n⟩ is omitted level 2 is assumed.
585
586 C pre-processor
587 -cpp Run the C pre-processor on Haskell source files
588
589 -D⟨symbol⟩[=⟨value⟩]
590 Define a symbol in the C pre-processor
591
592 -I⟨dir⟩
593 Add ⟨dir⟩ to the directory search list for #include files
594
595 -U⟨symbol⟩
596 Undefine a symbol in the C pre-processor
597
598 Finding imports
599 -i Empty the import directory list
600
601 -i⟨dir⟩[:⟨dir⟩]*
602 add ⟨dir⟩, ⟨dir2⟩, etc. to import path
603
604 Interactive mode
605 -fbreak-on-error
606 Break on uncaught exceptions and errors
607
608 -fbreak-on-exception
609 Break on any exception thrown
610
611 -fghci-hist-size=⟨n⟩
612 Set the number of entries GHCi keeps for :history. See
613 ghci-debugger.
614
615 -flocal-ghci-history
616 Use current directory for the GHCi command history file
617 .ghci-history.
618
619 -fprint-bind-result
620 Turn on printing of binding results in GHCi
621
622 -fshow-loaded-modules
623 Show the names of modules that GHCi loaded after a :load com‐
624 mand.
625
626 -ghci-script
627 Read additional .ghci files
628
629 -ignore-dot-ghci
630 Disable reading of .ghci files
631
632 -interactive-print ⟨expr⟩
633 Select the function to use for printing evaluated expressions in
634 GHCi
635
636 Interface files
637 --show-iface ⟨file⟩
638 See modes.
639
640 -ddump-hi
641 Dump the new interface to stdout
642
643 -ddump-hi-diffs
644 Show the differences vs. the old interface
645
646 -ddump-minimal-imports
647 Dump a minimal set of imports
648
649 Keeping intermediate files
650 -keep-hc-file
651 Retain intermediate .hc files.
652
653 -keep-hi-files
654 Retain intermediate .hi files (the default).
655
656 -keep-llvm-file
657 Retain intermediate LLVM .ll files. Implies -fllvm.
658
659 -keep-o-files
660 Retain intermediate .o files (the default).
661
662 -keep-s-file
663 Retain intermediate .s files.
664
665 -keep-tmp-files
666 Retain all intermediate temporary files.
667
668 Language options
669 -XAllowAmbiguousTypes
670 Allow the user to write ambiguous types, and the type inference
671 engine to infer them.
672
673 -XApplicativeDo
674 Enable Applicative do-notation desugaring
675
676 -XArrows
677 Enable arrow notation extension
678
679 -XBangPatterns
680 Enable bang patterns.
681
682 -XBinaryLiterals
683 Enable support for binary literals.
684
685 -XCApiFFI
686 Enable the CAPI calling convention.
687
688 -XConstrainedClassMethods
689 Enable constrained class methods.
690
691 -XConstraintKinds
692 Enable a kind of constraints.
693
694 -XCPP Enable the C preprocessor.
695
696 -XDataKinds
697 Enable datatype promotion.
698
699 -XDatatypeContexts
700 Allow contexts on data types.
701
702 -XDefaultSignatures
703 Enable default signatures.
704
705 -XDeriveAnyClass
706 Enable deriving for any class.
707
708 -XDeriveDataTypeable
709 Enable deriving for the Data class. Implied by AutoDeriveTy‐
710 peable.
711
712 -XDeriveFoldable
713 Enable deriving for the Foldable class. Implied by Derive‐
714 Traversable.
715
716 -XDeriveFunctor
717 Enable deriving for the Functor class. Implied by Derive‐
718 Traversable.
719
720 -XDeriveGeneric
721 Enable deriving for the Generic class.
722
723 -XDeriveLift
724 Enable deriving for the Lift class
725
726 -XDeriveTraversable
727 Enable deriving for the Traversable class. Implies DeriveFunc‐
728 tor and DeriveFoldable.
729
730 -XDerivingStrategies
731 Enables deriving strategies.
732
733 -XDisambiguateRecordFields
734 Enable record field disambiguation. Implied by RecordWildCards.
735
736 -XDuplicateRecordFields
737 Allow definition of record types with identically-named fields.
738
739 -XEmptyCase
740 Allow empty case alternatives.
741
742 -XEmptyDataDecls
743 Allow definition of empty data types.
744
745 -XEmptyDataDeriving
746 Allow deriving instances of standard type classes for empty data
747 types.
748
749 -XExistentialQuantification
750 Enable liberalised type synonyms.
751
752 -XExplicitForAll
753 Enable explicit universal quantification. Implied by Scoped‐
754 TypeVariables, LiberalTypeSynonyms, RankNTypes and Existen‐
755 tialQuantification.
756
757 -XExplicitNamespaces
758 Enable using the keyword type to specify the namespace of
759 entries in imports and exports (explicit-namespaces). Implied
760 by TypeOperators and TypeFamilies.
761
762 -XExtendedDefaultRules
763 Use GHCi's extended default rules in a normal module.
764
765 -XFlexibleContexts
766 Enable flexible contexts. Implied by ImplicitParams.
767
768 -XFlexibleInstances
769 Enable flexible instances. Implies TypeSynonymInstances.
770 Implied by ImplicitParams.
771
772 -XForeignFunctionInterface
773 Enable foreign function interface.
774
775 -XFunctionalDependencies
776 Enable functional dependencies. Implies MultiParamTypeClasses.
777
778 -XGADTs
779 Enable generalised algebraic data types. Implies GADTSyntax and
780 MonoLocalBinds.
781
782 -XGADTSyntax
783 Enable generalised algebraic data type syntax.
784
785 -XGeneralisedNewtypeDeriving
786 Enable newtype deriving.
787
788 -XGeneralizedNewtypeDeriving
789 Enable newtype deriving.
790
791 -XHexFloatLiterals
792 Enable support for hexadecimal floating point literals.
793
794 -XImplicitParams
795 Enable Implicit Parameters. Implies FlexibleContexts and Flexi‐
796 bleInstances.
797
798 -XImpredicativeTypes
799 Enable impredicative types. Implies RankNTypes.
800
801 -XIncoherentInstances
802 Enable incoherent instances. Implies OverlappingInstances.
803
804 -XInstanceSigs
805 Enable instance signatures.
806
807 -XInterruptibleFFI
808 Enable interruptible FFI.
809
810 -XKindSignatures
811 Enable kind signatures. Implied by TypeFamilies and PolyKinds.
812
813 -XLambdaCase
814 Enable lambda-case expressions.
815
816 -XLiberalTypeSynonyms
817 Enable liberalised type synonyms.
818
819 -XMagicHash
820 Allow # as a postfix modifier on identifiers.
821
822 -XMonadComprehensions
823 Enable monad comprehensions.
824
825 -XMonadFailDesugaring
826 Enable monadfail desugaring.
827
828 -XMonoLocalBinds
829 Enable do not generalise local bindings. Implied by TypeFami‐
830 lies and GADTs.
831
832 -XMultiParamTypeClasses
833 Enable multi parameter type classes. Implied by FunctionalDe‐
834 pendencies.
835
836 -XMultiWayIf
837 Enable multi-way if-expressions.
838
839 -XNamedFieldPuns
840 Enable record puns.
841
842 -XNamedWildCards
843 Enable named wildcards.
844
845 -XNegativeLiterals
846 Enable support for negative literals.
847
848 -XNoImplicitPrelude
849 Don't implicitly import Prelude. Implied by RebindableSyntax.
850
851 -XNoMonomorphismRestriction
852 Disable the monomorphism restriction.
853
854 -XNoPatternGuards
855 Disable pattern guards. Implied by Haskell98.
856
857 -XNoTraditionalRecordSyntax
858 Disable support for traditional record syntax (as supported by
859 Haskell 98) C {f = x}
860
861 -XNPlusKPatterns
862 Enable support for n+k patterns. Implied by Haskell98.
863
864 -XNullaryTypeClasses
865 Deprecated, does nothing. nullary (no parameter) type classes
866 are now enabled using MultiParamTypeClasses.
867
868 -XNumDecimals
869 Enable support for 'fractional' integer literals.
870
871 -XOverlappingInstances
872 Enable overlapping instances.
873
874 -XOverloadedLabels
875 Enable overloaded labels.
876
877 -XOverloadedLists
878 Enable overloaded lists.
879
880 -XOverloadedStrings
881 Enable overloaded string literals.
882
883 -XPackageImports
884 Enable package-qualified imports.
885
886 -XParallelListComp
887 Enable parallel list comprehensions. Implied by ParallelArrays.
888
889 -XPartialTypeSignatures
890 Enable partial type signatures.
891
892 -XPatternSynonyms
893 Enable pattern synonyms.
894
895 -XPolyKinds
896 Enable kind polymorphism. Implies KindSignatures.
897
898 -XPostfixOperators
899 Enable postfix operators.
900
901 -XQuasiQuotes
902 Enable quasiquotation.
903
904 -XRank2Types
905 Enable rank-2 types. Synonym for RankNTypes.
906
907 -XRankNTypes
908 Enable rank-N types. Implied by ImpredicativeTypes.
909
910 -XRebindableSyntax
911 Employ rebindable syntax. Implies NoImplicitPrelude.
912
913 -XRecordWildCards
914 Enable record wildcards. Implies DisambiguateRecordFields.
915
916 -XRecursiveDo
917 Enable recursive do (mdo) notation.
918
919 -XRoleAnnotations
920 Enable role annotations.
921
922 -XSafe Enable the Safe Haskell Safe mode.
923
924 -XScopedTypeVariables
925 Enable lexically-scoped type variables.
926
927 -XStandaloneDeriving
928 Enable standalone deriving.
929
930 -XStaticPointers
931 Enable static pointers.
932
933 -XStrict
934 Make bindings in the current module strict by default.
935
936 -XStrictData
937 Enable default strict datatype fields.
938
939 -XTemplateHaskell
940 Enable Template Haskell.
941
942 -XTemplateHaskellQuotes
943 Enable quotation subset of Template Haskell.
944
945 -XTransformListComp
946 Enable generalised list comprehensions.
947
948 -XTrustworthy
949 Enable the Safe Haskell Trustworthy mode.
950
951 -XTupleSections
952 Enable tuple sections.
953
954 -XTypeApplications
955 Enable type application syntax.
956
957 -XTypeFamilies
958 Enable type families. Implies ExplicitNamespaces, KindSigna‐
959 tures, and MonoLocalBinds.
960
961 -XTypeFamilyDependencies
962 Enable injective type families. Implies TypeFamilies.
963
964 -XTypeInType
965 Allow kinds to be used as types, including explicit kind vari‐
966 able quantification, higher-rank kinds, kind synonyms, and kind
967 families. Implies DataKinds, KindSignatures, and PolyKinds.
968
969 -XTypeOperators
970 Enable type operators. Implies ExplicitNamespaces.
971
972 -XTypeSynonymInstances
973 Enable type synonyms in instance heads. Implied by FlexibleIn‐
974 stances.
975
976 -XUnboxedSums
977 Enable unboxed sums.
978
979 -XUnboxedTuples
980 Enable the use of unboxed tuple syntax.
981
982 -XUndecidableInstances
983 Enable undecidable instances.
984
985 -XUndecidableSuperClasses
986 Allow all superclass constraints, including those that may
987 result in non-termination of the typechecker.
988
989 -XUnicodeSyntax
990 Enable unicode syntax.
991
992 -XUnsafe
993 Enable Safe Haskell Unsafe mode.
994
995 -XViewPatterns
996 Enable view patterns.
997
998 Linking options
999 -c Stop after generating object (.o) file
1000
1001 -debug Use the debugging runtime
1002
1003 -dylib-install-name ⟨path⟩
1004 Set the install name (via -install_name passed to Apple's
1005 linker), specifying the full install path of the library file.
1006 Any libraries or executables that link with it later will pick
1007 up that path as their runtime search location for it. (Dar‐
1008 win/OS X only)
1009
1010 -dynamic
1011 Build dynamically-linked object files and executables
1012
1013 -dynload
1014 Selects one of a number of modes for finding shared libraries at
1015 runtime.
1016
1017 -eventlog
1018 Enable runtime event tracing
1019
1020 -fno-embed-manifest
1021 Do not embed the manifest in the executable (Windows only)
1022
1023 -fno-gen-manifest
1024 Do not generate a manifest file (Windows only)
1025
1026 -fno-shared-implib
1027 Don't generate an import library for a DLL (Windows only)
1028
1029 -framework ⟨name⟩
1030 On Darwin/OS X/iOS only, link in the framework ⟨name⟩. This
1031 option corresponds to the -framework option for Apple's Linker.
1032
1033 -framework-path ⟨dir⟩
1034 On Darwin/OS X/iOS only, add ⟨dir⟩ to the list of directories
1035 searched for frameworks. This option corresponds to the -F
1036 option for Apple's Linker.
1037
1038 -fwhole-archive-hs-libs
1039 When linking a binary executable, this inserts the flag
1040 -Wl,--whole-archive before any -l flags for Haskell libraries,
1041 and -Wl,--no-whole-archive afterwards
1042
1043 -L ⟨dir⟩
1044 Add ⟨dir⟩ to the list of directories searched for libraries
1045
1046 -l ⟨lib⟩
1047 Link in library ⟨lib⟩
1048
1049 -main-is ⟨thing⟩
1050 Set main module and function
1051
1052 -no-hs-main
1053 Don't assume this program contains main
1054
1055 -no-rtsopts-suggestions
1056 Don't print RTS suggestions about linking with
1057 -rtsopts[=⟨none|some|all⟩].
1058
1059 -package ⟨name⟩
1060 Expose package ⟨pkg⟩
1061
1062 -pie Instruct the linker to produce a position-independent exe‐
1063 cutable.
1064
1065 -rdynamic
1066 This instructs the linker to add all symbols, not only used
1067 ones, to the dynamic symbol table. Currently Linux and Win‐
1068 dows/MinGW32 only. This is equivalent to using -optl -rdynamic
1069 on Linux, and -optl -export-all-symbols on Windows.
1070
1071 -rtsopts[=⟨none|some|all⟩]
1072 Control whether the RTS behaviour can be tweaked via com‐
1073 mand-line flags and the GHCRTS environment variable. Using none
1074 means no RTS flags can be given; some means only a minimum of
1075 safe options can be given (the default), and all (or no argument
1076 at all) means that all RTS flags are permitted.
1077
1078 -shared
1079 Generate a shared library (as opposed to an executable)
1080
1081 -split-objs
1082 Split objects (for libraries)
1083
1084 -split-sections
1085 Split sections for link-time dead-code stripping
1086
1087 -static
1088 Use static Haskell libraries
1089
1090 -staticlib
1091 Generate a standalone static library (as opposed to an exe‐
1092 cutable). This is useful when cross compiling. The library
1093 together with all its dependencies ends up in in a single static
1094 library that can be linked against.
1095
1096 -threaded
1097 Use the threaded runtime
1098
1099 -with-rtsopts=⟨opts⟩
1100 Set the default RTS options to ⟨opts⟩.
1101
1102 Miscellaneous options
1103 -fexternal-interpreter
1104 Run interpreted code in a separate process
1105
1106 -fglasgow-exts
1107 Deprecated. Enable most language extensions; see options-lan‐
1108 guage for exactly which ones.
1109
1110 -ghcversion-file ⟨path to ghcversion.h⟩
1111 (GHC as a C compiler only) Use this ghcversion.h file
1112
1113 -H ⟨size⟩
1114 Set the minimum size of the heap to ⟨size⟩
1115
1116 -j[⟨n⟩]
1117 When compiling with --make, compile ⟨n⟩ modules in parallel.
1118
1119 Modes of operation
1120 --frontend ⟨module⟩
1121 run GHC with the given frontend plugin; see frontend_plugins for
1122 details.
1123
1124 --help Display help
1125
1126 --info display information about the compiler
1127
1128 --interactive
1129 Interactive mode - normally used by just running ghci; see ghci
1130 for details.
1131
1132 --make Build a multi-module Haskell program, automatically figuring out
1133 dependencies. Likely to be much easier, and faster, than using
1134 make; see make-mode for details.
1135
1136 --mk-dll
1137 DLL-creation mode (Windows only)
1138
1139 --numeric-version
1140 display GHC version (numeric only)
1141
1142 --print-libdir
1143 display GHC library directory
1144
1145 --show-iface ⟨file⟩
1146 display the contents of an interface file.
1147
1148 --show-options
1149 display the supported command line options
1150
1151 --supported-extensions
1152 display the supported language extensions
1153
1154 --version
1155 display GHC version
1156
1157 -e ⟨expr⟩
1158 Evaluate expr; see eval-mode for details.
1159
1160 -M generate dependency information suitable for use in a Makefile;
1161 see makefile-dependencies for details.
1162
1163 Individual optimizations
1164 -fcall-arity
1165 Enable call-arity optimisation. Implied by -O.
1166
1167 -fcase-folding
1168 Enable constant folding in case expressions. Implied by -O.
1169
1170 -fcase-merge
1171 Enable case-merging. Implied by -O.
1172
1173 -fcmm-elim-common-blocks
1174 Enable Cmm common block elimination. Implied by -O.
1175
1176 -fcmm-sink
1177 Enable Cmm sinking. Implied by -O.
1178
1179 -fcpr-anal
1180 Turn on CPR analysis in the demand analyser. Implied by -O.
1181
1182 -fcross-module-specialise
1183 Turn on specialisation of overloaded functions imported from
1184 other modules.
1185
1186 -fcse Enable common sub-expression elimination. Implied by -O.
1187
1188 -fdicts-cheap
1189 Make dictionary-valued expressions seem cheap to the optimiser.
1190
1191 -fdicts-strict
1192 Make dictionaries strict
1193
1194 -fdmd-tx-dict-sel
1195 Use a special demand transformer for dictionary selectors.
1196 Always enabled by default.
1197
1198 -fdo-eta-reduction
1199 Enable eta-reduction. Implied by -O.
1200
1201 -fdo-lambda-eta-expansion
1202 Enable lambda eta-expansion. Always enabled by default.
1203
1204 -feager-blackholing
1205 Turn on eager blackholing
1206
1207 -fenable-rewrite-rules
1208 Switch on all rewrite rules (including rules generated by auto‐
1209 matic specialisation of overloaded functions). Implied by -O.
1210
1211 -fexcess-precision
1212 Enable excess intermediate precision
1213
1214 -fexitification
1215 Enables exitification optimisation. Implied by -O.
1216
1217 -fexpose-all-unfoldings
1218 Expose all unfoldings, even for very large or recursive func‐
1219 tions.
1220
1221 -ffloat-in
1222 Turn on the float-in transformation. Implied by -O.
1223
1224 -ffull-laziness
1225 Turn on full laziness (floating bindings outwards). Implied by
1226 -O.
1227
1228 -ffun-to-thunk
1229 Allow worker-wrapper to convert a function closure into a thunk
1230 if the function does not use any of its arguments. Off by
1231 default.
1232
1233 -fignore-asserts
1234 Ignore assertions in the source. Implied by -O.
1235
1236 -fignore-interface-pragmas
1237 Ignore pragmas in interface files. Implied by -O0 only.
1238
1239 -flate-dmd-anal
1240 Run demand analysis again, at the end of the simplification
1241 pipeline
1242
1243 -fliberate-case
1244 Turn on the liberate-case transformation. Implied by -O2.
1245
1246 -fliberate-case-threshold=⟨n⟩
1247 default: 2000. Set the size threshold for the liberate-case
1248 transformation to ⟨n⟩
1249
1250 -fllvm-pass-vectors-in-regs
1251 Pass vector value in vector registers for function calls
1252
1253 -floopification
1254 Turn saturated self-recursive tail-calls into local jumps in the
1255 generated assembly. Implied by -O.
1256
1257 -fmax-inline-alloc-size=⟨n⟩
1258 default: 128. Set the maximum size of inline array allocations
1259 to ⟨n⟩ bytes (default: 128).
1260
1261 -fmax-inline-memcpy-insns=⟨n⟩
1262 default: 32. Inline memcpy calls if they would generate no more
1263 than ⟨n⟩ pseudo instructions.
1264
1265 -fmax-inline-memset-insns=⟨n⟩
1266 default: 32. Inline memset calls if they would generate no more
1267 than ⟨n⟩ pseudo instructions
1268
1269 -fmax-relevant-binds=⟨n⟩
1270 default: 6. Set the maximum number of bindings to display in
1271 type error messages.
1272
1273 -fmax-simplifier-iterations=⟨n⟩
1274 default: 4. Set the max iterations for the simplifier.
1275
1276 -fmax-uncovered-patterns=⟨n⟩
1277 default: 4. Set the maximum number of patterns to display in
1278 warnings about non-exhaustive ones.
1279
1280 -fmax-valid-substitutions=⟨n⟩
1281 default: 6. Set the maximum number of valid substitutions for
1282 typed holes to display in type error messages.
1283
1284 -fmax-worker-args=⟨n⟩
1285 default: 10. If a worker has that many arguments, none will be
1286 unpacked anymore.
1287
1288 -fno-opt-coercion
1289 Turn off the coercion optimiser
1290
1291 -fno-pre-inlining
1292 Turn off pre-inlining
1293
1294 -fno-state-hack
1295 Turn off the state hackwhereby any lambda with a real-world
1296 state token as argument is considered to be single-entry. Hence
1297 OK to inline things inside it.
1298
1299 -fomit-interface-pragmas
1300 Don't generate interface pragmas. Implied by -O0 only.
1301
1302 -fomit-yields
1303 Omit heap checks when no allocation is being performed.
1304
1305 -foptimal-applicative-do
1306 Use a slower but better algorithm for ApplicativeDo
1307
1308 -fpedantic-bottoms
1309 Make GHC be more precise about its treatment of bottom (but see
1310 also -fno-state-hack). In particular, GHC will not eta-expand
1311 through a case expression.
1312
1313 -fregs-graph
1314 Use the graph colouring register allocator for register alloca‐
1315 tion in the native code generator. Implied by -O2.
1316
1317 -fregs-iterative
1318 Use the iterative coalescing graph colouring register allocator
1319 in the native code generator.
1320
1321 -fsimpl-tick-factor=⟨n⟩
1322 default: 100. Set the percentage factor for simplifier ticks.
1323
1324 -fsimplifier-phases=⟨n⟩
1325 default: 2. Set the number of phases for the simplifier.
1326 Ignored with -O0.
1327
1328 -fsolve-constant-dicts
1329 When solving constraints, try to eagerly solve super classes
1330 using available dictionaries.
1331
1332 -fspec-constr
1333 Turn on the SpecConstr transformation. Implied by -O2.
1334
1335 -fspec-constr-count=⟨n⟩
1336 default: 3.* Set to ⟨n⟩ the maximum number of specialisations
1337 that will be created for any one function by the SpecConstr
1338 transformation.
1339
1340 -fspec-constr-keen
1341 Specialize a call with an explicit constructor argument, even if
1342 the argument is not scrutinised in the body of the function
1343
1344 -fspec-constr-threshold=⟨n⟩
1345 default: 2000. Set the size threshold for the SpecConstr trans‐
1346 formation to ⟨n⟩.
1347
1348 -fspecialise
1349 Turn on specialisation of overloaded functions. Implied by -O.
1350
1351 -fspecialise-aggressively
1352 Turn on specialisation of overloaded functions regardless of
1353 size, if unfolding is available
1354
1355 -fstatic-argument-transformation
1356 Turn on the static argument transformation.
1357
1358 -fstg-cse
1359 Enable common sub-expression elimination on the STG intermediate
1360 language
1361
1362 -fstrictness
1363 Turn on strictness analysis. Implied by -O. Implies
1364 -fworker-wrapper
1365
1366 -fstrictness-before=⟨n⟩
1367 Run an additional strictness analysis before simplifier phase
1368 ⟨n⟩
1369
1370 -funbox-small-strict-fields
1371 Flatten strict constructor fields with a pointer-sized represen‐
1372 tation. Implied by -O.
1373
1374 -funbox-strict-fields
1375 Flatten strict constructor fields
1376
1377 -funfolding-creation-threshold=⟨n⟩
1378 default: 750. Tweak unfolding settings.
1379
1380 -funfolding-dict-discount=⟨n⟩
1381 default: 30. Tweak unfolding settings.
1382
1383 -funfolding-fun-discount=⟨n⟩
1384 default: 60. Tweak unfolding settings.
1385
1386 -funfolding-keeness-factor=⟨n⟩
1387 default: 1.5. Tweak unfolding settings.
1388
1389 -funfolding-use-threshold=⟨n⟩
1390 default: 60. Tweak unfolding settings.
1391
1392 -fvectorisation-avoidance
1393 Enable vectorisation avoidance. Always enabled by default.
1394
1395 -fvectorise
1396 Enable vectorisation of nested data parallelism
1397
1398 Optimization levels
1399 -O Enable level 1 optimisations
1400
1401 -O0 Disable optimisations (default)
1402
1403 -O2 Enable level 2 optimisations
1404
1405 -Odph Enable level 2 optimisations, set -fmax-simplifier-iterations=20
1406 and -fsimplifier-phases=3.
1407
1408 Package options
1409 -clear-package-db
1410 Clear the package db stack.
1411
1412 -distrust ⟨pkg⟩
1413 Expose package ⟨pkg⟩ and set it to be distrusted. See
1414 safe-haskell.
1415
1416 -distrust-all-packages
1417 Distrust all packages by default. See safe-haskell.
1418
1419 -fpackage-trust
1420 Enable Safe Haskell trusted package requirement for trustworthy
1421 modules.
1422
1423 -global-package-db
1424 Add the global package db to the stack.
1425
1426 -hide-all-packages
1427 Hide all packages by default
1428
1429 -hide-package ⟨pkg⟩
1430 Hide package ⟨pkg⟩
1431
1432 -ignore-package ⟨pkg⟩
1433 Ignore package ⟨pkg⟩
1434
1435 -no-auto-link-packages
1436 Don't automatically link in the base and rts packages.
1437
1438 -no-global-package-db
1439 Remove the global package db from the stack.
1440
1441 -no-user-package-db
1442 Remove the user's package db from the stack.
1443
1444 -package ⟨pkg⟩
1445 Expose package ⟨pkg⟩
1446
1447 -package-db ⟨file⟩
1448 Add ⟨file⟩ to the package db stack.
1449
1450 -package-env ⟨file⟩|⟨name⟩
1451 Use the specified package environment.
1452
1453 -package-id ⟨unit-id⟩
1454 Expose package by id ⟨unit-id⟩
1455
1456 -this-unit-id ⟨unit-id⟩
1457 Compile to be part of unit (i.e. package) ⟨unit-id⟩
1458
1459 -trust ⟨pkg⟩
1460 Expose package ⟨pkg⟩ and set it to be trusted. See safe-haskell.
1461
1462 -user-package-db
1463 Add the user's package db to the stack.
1464
1465 Phases of compilation
1466 -C Stop after generating C (.hc file)
1467
1468 -c Stop after generating object (.o) file
1469
1470 -E Stop after preprocessing (.hspp file)
1471
1472 -F Enable the use of a pre-processor (set with -pgmF ⟨cmd⟩)
1473
1474 -S Stop after generating assembly (.s file)
1475
1476 -x ⟨suffix⟩
1477 Override default behaviour for source files
1478
1479 Overriding external programs
1480 -pgma ⟨cmd⟩
1481 Use ⟨cmd⟩ as the assembler
1482
1483 -pgmc ⟨cmd⟩
1484 Use ⟨cmd⟩ as the C compiler
1485
1486 -pgmdll ⟨cmd⟩
1487 Use ⟨cmd⟩ as the DLL generator
1488
1489 -pgmF ⟨cmd⟩
1490 Use ⟨cmd⟩ as the pre-processor (with -F only)
1491
1492 -pgmi ⟨cmd⟩
1493 Use ⟨cmd⟩ as the external interpreter command.
1494
1495 -pgmL ⟨cmd⟩
1496 Use ⟨cmd⟩ as the literate pre-processor
1497
1498 -pgml ⟨cmd⟩
1499 Use ⟨cmd⟩ as the linker
1500
1501 -pgmlc ⟨cmd⟩
1502 Use ⟨cmd⟩ as the LLVM compiler
1503
1504 -pgmlibtool ⟨cmd⟩
1505 Use ⟨cmd⟩ as the command for libtool (with -staticlib only).
1506
1507 -pgmlo ⟨cmd⟩
1508 Use ⟨cmd⟩ as the LLVM optimiser
1509
1510 -pgmP ⟨cmd⟩
1511 Use ⟨cmd⟩ as the C pre-processor (with -cpp only)
1512
1513 -pgms ⟨cmd⟩
1514 Use ⟨cmd⟩ as the splitter
1515
1516 -pgmwindres ⟨cmd⟩
1517 Use ⟨cmd⟩ as the program for embedding manifests on Windows.
1518
1519 Phase-specific options
1520 -opta ⟨option⟩
1521 pass ⟨option⟩ to the assembler
1522
1523 -optc ⟨option⟩
1524 pass ⟨option⟩ to the C compiler
1525
1526 -optdll ⟨option⟩
1527 pass ⟨option⟩ to the DLL generator
1528
1529 -optF ⟨option⟩
1530 pass ⟨option⟩ to the custom pre-processor
1531
1532 -opti ⟨option⟩
1533 pass ⟨option⟩ to the interpreter sub-process.
1534
1535 -optL ⟨option⟩
1536 pass ⟨option⟩ to the literate pre-processor
1537
1538 -optl ⟨option⟩
1539 pass ⟨option⟩ to the linker
1540
1541 -optlc ⟨option⟩
1542 pass ⟨option⟩ to the LLVM compiler
1543
1544 -optlo ⟨option⟩
1545 pass ⟨option⟩ to the LLVM optimiser
1546
1547 -optP ⟨option⟩
1548 pass ⟨option⟩ to cpp (with -cpp only)
1549
1550 -optwindres ⟨option⟩
1551 pass ⟨option⟩ to windres.
1552
1553 Platform-specific options
1554 -msse2 (x86 only) Use SSE2 for floating-point operations
1555
1556 -msse4.2
1557 (x86 only) Use SSE4.2 for floating-point operations
1558
1559 Compiler plugins
1560 -fplugin-opt=⟨module⟩:⟨args⟩
1561 Give arguments to a plugin module; module must be specified with
1562 -fplugin=⟨module⟩
1563
1564 -fplugin=⟨module⟩
1565 Load a plugin exported by a given module
1566
1567 -hide-all-plugin-packages
1568 Hide all packages for plugins by default
1569
1570 -plugin-package ⟨pkg⟩
1571 Expose ⟨pkg⟩ for plugins
1572
1573 -plugin-package-id ⟨pkg-id⟩
1574 Expose ⟨pkg-id⟩ for plugins
1575
1576 Profiling
1577 -fno-prof-auto
1578 Disables any previous -fprof-auto, -fprof-auto-top, or
1579 -fprof-auto-exported options.
1580
1581 -fno-prof-cafs
1582 Disables any previous -fprof-cafs option.
1583
1584 -fno-prof-count-entries
1585 Do not collect entry counts
1586
1587 -fprof-auto
1588 Auto-add SCC\ s to all bindings not marked INLINE
1589
1590 -fprof-auto-calls
1591 Auto-add SCC\ s to all call sites
1592
1593 -fprof-auto-exported
1594 Auto-add SCC\ s to all exported bindings not marked INLINE
1595
1596 -fprof-auto-top
1597 Auto-add SCC\ s to all top-level bindings not marked INLINE
1598
1599 -fprof-cafs
1600 Auto-add SCC\ s to all CAFs
1601
1602 -prof Turn on profiling
1603
1604 -ticky Turn on ticky-ticky profiling
1605
1606 Program coverage
1607 -fhpc Turn on Haskell program coverage instrumentation
1608
1609 Recompilation checking
1610 -fforce-recomp
1611 Turn off recompilation checking. This is implied by any -ddump-X
1612 option when compiling a single file (i.e. when using -c).
1613
1614 -fignore-hpc-changes
1615 Do not recompile modules just to match changes to HPC flags.
1616 This is especially useful for avoiding recompilation when using
1617 GHCi, and is enabled by default for GHCi.
1618
1619 -fignore-optim-changes
1620 Do not recompile modules just to match changes to optimisation
1621 flags. This is especially useful for avoiding recompilation when
1622 using GHCi, and is enabled by default for GHCi.
1623
1624 Redirecting output
1625 --exclude-module=⟨file⟩
1626 Regard ⟨file⟩ as "stable"; i.e., exclude it from having depen‐
1627 dencies on it.
1628
1629 -ddump-mod-cycles
1630 Dump module cycles
1631
1632 -dep-makefile ⟨file⟩
1633 Use ⟨file⟩ as the makefile
1634
1635 -dep-suffix ⟨suffix⟩
1636 Make dependencies that declare that files with suffix
1637 .⟨suf⟩⟨osuf⟩ depend on interface files with suffix .⟨suf⟩hi
1638
1639 -dumpdir ⟨dir⟩
1640 redirect dump files
1641
1642 -hcsuf ⟨suffix⟩
1643 set the suffix to use for intermediate C files
1644
1645 -hidir ⟨dir⟩
1646 set directory for interface files
1647
1648 -hisuf ⟨suffix⟩
1649 set the suffix to use for interface files
1650
1651 -include-pkg-deps
1652 Regard modules imported from packages as unstable
1653
1654 -o ⟨file⟩
1655 set output filename
1656
1657 -odir ⟨dir⟩
1658 set directory for object files
1659
1660 -ohi ⟨file⟩
1661 set the filename in which to put the interface
1662
1663 -osuf ⟨suffix⟩
1664 set the output file suffix
1665
1666 -outputdir ⟨dir⟩
1667 set output directory
1668
1669 -stubdir ⟨dir⟩
1670 redirect FFI stub files
1671
1672 Temporary files
1673 -tmpdir ⟨dir⟩
1674 set the directory for temporary files
1675
1676 Verbosity options
1677 -fdiagnostics-color=⟨always|auto|never⟩
1678 Use colors in error messages
1679
1680 -fdiagnostics-show-caret
1681 Whether to show snippets of original source code
1682
1683 -ferror-spans
1684 Output full span in error messages
1685
1686 -fhide-source-paths
1687 hide module source and object paths
1688
1689 -fprint-equality-relations
1690 Distinguish between equality relations when printing
1691
1692 -fprint-expanded-synonyms
1693 In type errors, also print type-synonym-expanded types.
1694
1695 -fprint-explicit-coercions
1696 Print coercions in types
1697
1698 -fprint-explicit-foralls
1699 Print explicit forall quantification in types. See also -XEx‐
1700 plicitForAll
1701
1702 -fprint-explicit-kinds
1703 Print explicit kind foralls and kind arguments in types. See
1704 also -XKindSignatures
1705
1706 -fprint-explicit-runtime-rep
1707 Print RuntimeRep variables in types which are runtime-represen‐
1708 tation polymorphic.
1709
1710 -fprint-explicit-runtime-reps
1711 Print RuntimeRep variables in types which are runtime-represen‐
1712 tation polymorphic.
1713
1714 -fprint-potential-instances
1715 display all available instances in type error messages
1716
1717 -fprint-typechecker-elaboration
1718 Print extra information from typechecker.
1719
1720 -fprint-unicode-syntax
1721 Use unicode syntax when printing expressions, types and kinds.
1722 See also -XUnicodeSyntax
1723
1724 -fshow-hole-constraints
1725 Show constraints when reporting typed holes
1726
1727 -Rghc-timing
1728 Summarise timing stats for GHC (same as +RTS -tstderr).
1729
1730 -v verbose mode (equivalent to -v3)
1731
1732 -v⟨n⟩ set verbosity level
1733
1734 Warnings
1735 -fdefer-out-of-scope-variables
1736 Convert variable out of scope variables errors into warnings.
1737 Implied by -fdefer-type-errors. See also -Wde‐
1738 ferred-out-of-scope-variables.
1739
1740 -fdefer-type-errors
1741 Turn type errors into warnings, deferring the error until run‐
1742 time. Implies -fdefer-typed-holes and -fdefer-out-of-scope-vari‐
1743 ables. See also -Wdeferred-type-errors
1744
1745 -fdefer-typed-holes
1746 Convert typed hole errors into warnings, deferring the error
1747 until runtime. Implied by -fdefer-type-errors. See also
1748 -Wtyped-holes.
1749
1750 -fhelpful-errors
1751 Make suggestions for mis-spelled names.
1752
1753 -fmax-pmcheck-iterations=⟨n⟩
1754 the iteration limit for the pattern match checker
1755
1756 -fshow-warning-groups
1757 show which group an emitted warning belongs to.
1758
1759 -W enable normal warnings
1760
1761 -w disable all warnings
1762
1763 -Wall enable almost all warnings (details in options-sanity)
1764
1765 -Wall-missed-specialisations
1766 warn when specialisation of any overloaded function fails.
1767
1768 -Wamp (deprecated) warn on definitions conflicting with the Applica‐
1769 tive-Monad Proposal (AMP)
1770
1771 -Wcompat
1772 enable future compatibility warnings (details in options-sanity)
1773
1774 -Wcpp-undef
1775 warn on uses of the #if directive on undefined identifiers
1776
1777 -Wdeferred-out-of-scope-variables
1778 Report warnings when variable out-of-scope errors are deferred
1779 until runtime. See -fdefer-out-of-scope-variables.
1780
1781 -Wdeferred-type-errors
1782 Report warnings when deferred type errors are enabled. This
1783 option is enabled by default. See -fdefer-type-errors.
1784
1785 -Wdeprecated-flags
1786 warn about uses of commandline flags that are deprecated
1787
1788 -Wdeprecations
1789 warn about uses of functions & types that have warnings or dep‐
1790 recated pragmas. Alias for -Wwarnings-deprecations
1791
1792 -Wdodgy-exports
1793 warn about dodgy exports
1794
1795 -Wdodgy-foreign-imports
1796 warn about dodgy foreign imports
1797
1798 -Wdodgy-imports
1799 warn about dodgy imports
1800
1801 -Wduplicate-constraints
1802 warn when a constraint appears duplicated in a type signature
1803
1804 -Wduplicate-exports
1805 warn when an entity is exported multiple times
1806
1807 -Wempty-enumerations
1808 warn about enumerations that are empty
1809
1810 -Werror
1811 make warnings fatal
1812
1813 -Weverything
1814 enable all warnings supported by GHC
1815
1816 -Whi-shadowing
1817 warn when a .hi file in the current directory shadows a library
1818
1819 -Widentities
1820 warn about uses of Prelude numeric conversions that are probably
1821 the identity (and hence could be omitted)
1822
1823 -Wimplicit-prelude
1824 warn when the Prelude is implicitly imported
1825
1826 -Wincomplete-patterns
1827 warn when a pattern match could fail
1828
1829 -Wincomplete-record-updates
1830 warn when a record update could fail
1831
1832 -Wincomplete-uni-patterns
1833 warn when a pattern match in a lambda expression or pattern
1834 binding could fail
1835
1836 -Winline-rule-shadowing
1837 Warn if a rewrite RULE might fail to fire because the function
1838 might be inlined before the rule has a chance to fire. See
1839 rules-inline.
1840
1841 -Wmissed-specialisations
1842 warn when specialisation of an imported, overloaded function
1843 fails.
1844
1845 -Wmissing-export-lists
1846 warn when a module declaration does not explicitly list all
1847 exports
1848
1849 -Wmissing-exported-signatures
1850 warn about top-level functions without signatures, only if they
1851 are exported. takes precedence over -Wmissing-signatures
1852
1853 -Wmissing-exported-sigs
1854 (deprecated) warn about top-level functions without signatures,
1855 only if they are exported. takes precedence over -Wmissing-sig‐
1856 natures
1857
1858 -Wmissing-fields
1859 warn when fields of a record are uninitialised
1860
1861 -Wmissing-home-modules
1862 warn when encountering a home module imported, but not listed on
1863 the command line. Useful for cabal to ensure GHC won't pick up
1864 modules, not listed neither in exposed-modules, nor in
1865 other-modules.
1866
1867 -Wmissing-import-lists
1868 warn when an import declaration does not explicitly list all the
1869 names brought into scope
1870
1871 -Wmissing-local-signatures
1872 warn about polymorphic local bindings without signatures
1873
1874 -Wmissing-local-sigs
1875 (deprecated) warn about polymorphic local bindings without sig‐
1876 natures
1877
1878 -Wmissing-methods
1879 warn when class methods are undefined
1880
1881 -Wmissing-monadfail-instances
1882 Warn when a failable pattern is used in a do-block that does not
1883 have a MonadFail instance.
1884
1885 -Wmissing-pattern-synonym-signatures
1886 warn when pattern synonyms do not have type signatures
1887
1888 -Wmissing-signatures
1889 warn about top-level functions without signatures
1890
1891 -Wmonomorphism-restriction
1892 warn when the Monomorphism Restriction is applied
1893
1894 -Wname-shadowing
1895 warn when names are shadowed
1896
1897 -Wno-compat
1898 Disables all warnings enabled by -Wcompat.
1899
1900 -Wnoncanonical-monad-instances
1901 warn when Applicative or Monad instances have noncanonical defi‐
1902 nitions of return, pure, (>>), or (*>). See flag description in
1903 options-sanity for more details.
1904
1905 -Wnoncanonical-monadfail-instances
1906 warn when Monad or MonadFail instances have noncanonical defini‐
1907 tions of fail. See flag description in options-sanity for more
1908 details.
1909
1910 -Wnoncanonical-monoid-instances
1911 warn when Semigroup or Monoid instances have noncanonical defi‐
1912 nitions of (<>) or mappend. See flag description in
1913 options-sanity for more details.
1914
1915 -Worphans
1916 warn when the module contains orphan instance declarations or
1917 rewrite rules
1918
1919 -Woverflowed-literals
1920 warn about literals that will overflow their type
1921
1922 -Woverlapping-patterns
1923 warn about overlapping patterns
1924
1925 -Wpartial-fields
1926 warn when defining a partial record field.
1927
1928 -Wpartial-type-signatures
1929 warn about holes in partial type signatures when -XPartialTypeS‐
1930 ignatures is enabled. Not applicable when -XPartialTypesigna‐
1931 tures is not enabled, in which case errors are generated for
1932 such holes. See partial-type-signatures.
1933
1934 -Wredundant-constraints
1935 Have the compiler warn about redundant constraints in type sig‐
1936 natures.
1937
1938 -Wsafe warn if the module being compiled is regarded to be safe.
1939
1940 -Wsemigroup
1941 warn when a Monoid is not Semigroup, and on non- Semigroup defi‐
1942 nitions of (<>)?
1943
1944 -Wsimplifiable-class-constraints
1945 2arn about class constraints in a type signature that can be
1946 simplified using a top-level instance declaration.
1947
1948 -Wtabs warn if there are tabs in the source file
1949
1950 -Wtrustworthy-safe
1951 warn if the module being compiled is marked as Trustworthy but
1952 it could instead be marked as Safe, a more informative bound.
1953
1954 -Wtype-defaults
1955 warn when defaulting happens
1956
1957 -Wtyped-holes
1958 Report warnings when typed hole errors are deferred until run‐
1959 time. See -fdefer-typed-holes.
1960
1961 -Wunbanged-strict-patterns
1962 warn on pattern bind of unlifted variable that is neither bare
1963 nor banged
1964
1965 -Wunrecognised-pragmas
1966 warn about uses of pragmas that GHC doesn't recognise
1967
1968 -Wunrecognised-warning-flags
1969 throw a warning when an unreconised -W... flag is encountered on
1970 the command line.
1971
1972 -Wunsafe
1973 warn if the module being compiled is regarded to be unsafe. See
1974 safe-haskell
1975
1976 -Wunsupported-calling-conventions
1977 warn about use of an unsupported calling convention
1978
1979 -Wunsupported-llvm-version
1980 Warn when using -fllvm with an unsupported version of LLVM.
1981
1982 -Wunticked-promoted-constructors
1983 warn if promoted constructors are not ticked
1984
1985 -Wunused-binds
1986 warn about bindings that are unused. Alias for
1987 -Wunused-top-binds, -Wunused-local-binds and -Wunused-pat‐
1988 tern-binds
1989
1990 -Wunused-do-bind
1991 warn about do bindings that appear to throw away values of types
1992 other than ()
1993
1994 -Wunused-foralls
1995 warn about type variables in user-written forall\s that are
1996 unused
1997
1998 -Wunused-imports
1999 warn about unnecessary imports
2000
2001 -Wunused-local-binds
2002 warn about local bindings that are unused
2003
2004 -Wunused-matches
2005 warn about variables in patterns that aren't used
2006
2007 -Wunused-pattern-binds
2008 warn about pattern match bindings that are unused
2009
2010 -Wunused-top-binds
2011 warn about top-level bindings that are unused
2012
2013 -Wunused-type-patterns
2014 warn about unused type variables which arise from patterns in
2015 type family and data family instances
2016
2017 -Wwarn make warnings non-fatal
2018
2019 -Wwarnings-deprecations
2020 warn about uses of functions & types that have warnings or dep‐
2021 recated pragmas
2022
2023 -Wwrong-do-bind
2024 warn about do bindings that appear to throw away monadic values
2025 that you should have bound instead
2026
2028 Copyright 2015. The University Court of the University of Glasgow. All
2029 rights reserved.
2030
2032 The GHC Team
2033
2035 2015, GHC Team
2036
2037
2038
2039
20408.4.4 Mar 04, 2019 GHC(1)