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