GHC(1)
💅 GHC(1) 💅
okay so this is the manual page for ghc, aka the Glasgow Haskell Compiler — the one and only, the main character of Haskell toolchains 👑. this is part one of a whole series of pages, so buckle up bestie, we're doing this properly ✨
🌸 NAME 🌸
ghc — the Glasgow Haskell Compiler. that's the whole name, no notes, iconic 🎀
✨ SYNOPSIS ✨
ghc [option|filename]
ghci [option|filename]
🦋 DESCRIPTION 🦋
so this manual page documents, briefly, the ghc and ghci commands 💖 — emphasis on briefly, it's giving "trailer not the whole movie", and there's a lot more lore where this came from.
heads up though: ghci is not yet available on all architectures 😭 so if it's not on yours, that's a hardware thing, not a vibe thing.
if you do want the full extensive documentation, it exists in various other formats, including:
- PDF —
https://downloads.haskell.org/ghc/latest/docs/users_guide.pdf - HTML —
https://downloads.haskell.org/ghc/latest/docs/html/
go read those if you want the whole story, no cap 🫶
🧠 static vs dynamic flags (the important bit)
every single one of GHC's command line options is classified as either static or dynamic. here's the tea:
- a static flag may only be specified on the command line. that's it. nowhere else. periodt 💅
- a dynamic flag may also be given in an
OPTIONSpragma inside a source file, or set from the GHCi command line with:set.
as a rule of thumb, all the language options are dynamic, and so are the warning options and the debugging options ✨
the rest are static, with the notable exceptions of -v, -cpp, -fasm, -fvia-C, -fllvm, and -#include 🙈
the OPTIONS sections (yes, plural) list the status of each flag, so scroll down and check before you @ me.
📁 common suffixes of file names for Haskell
these are the file endings you'll see, and what they mean:
.hs— Haskell source code; preprocess, compile 🌸.lhs— literate Haskell source; unlit, preprocess, compile 📖.hi— interface file; contains information about exported symbols.hc— intermediate C files.⟨way⟩_o— object files for "way" ⟨way⟩; common ways are:dyn— dynamically-linkedp— built with profiling
.⟨way⟩_hi— interface files for "way" ⟨way⟩; common ways are:
okay so the original page just… stops after that colon 😭 that's genuinely where it trails off. moving on before we all start crying 💀
💖 OPTIONS 💖
alright, this is the big one. buckle in. every flag gets its moment, and we are not skipping a single one.
💻 Code generation 💻
-dynamic-too,-fasm,-fllvm,-fbyte-code,-fbyte-code-and-object-code-fexpose-internal-symbols,-fexternal-dynamic-refs,-fllvm,-fasm-fno-code,-fobject-code,-fPIC,-fPIE,-fprefer-byte-code-fwrite-if-simplified-core,-fwrite-interface
🩻 Debugging the compiler 🩻
this group is genuinely unhinged and i love her for it 💀 it's the whole -d/-ddump cinematic universe:
-dasm-lint,-dcmm-lint,-dcore-lint,-ddisable-js-c-sources,-ddisable-js-minifier,-ddump-asm,-ddump-asm-conflicts,-ddump-asm-liveness-ddump-asm-native,-ddump-asm-regalloc,-ddump-asm-regalloc-stages,-ddump-asm-stats,-ddump-bcos,-ddump-c-backend,-ddump-call-arity,-ddump-cfg-weights-ddump-cmm,-ddump-cmm-caf,-ddump-cmm-cbe,-ddump-cmm-cfg,-ddump-cmm-cps,-ddump-cmm-from-stg,-ddump-cmm-info,-ddump-cmm-opt-ddump-cmm-proc,-ddump-cmm-procmap,-ddump-cmm-raw,-ddump-cmm-sink,-ddump-cmm-sp,-ddump-cmm-split,-ddump-cmm-switch,-ddump-cmm-thread-sanitizer-ddump-cmm-verbose,-ddump-cmm-verbose-by-proc,-ddump-core-stats,-ddump-cpr-signatures,-ddump-cpranal,-ddump-cs-trace,-ddump-cse,-ddump-debug-ddump-deriv,-ddump-dmd-signatures,-ddump-dmdanal,-ddump-ds,-ddump-ds-preopt,-ddump-ec-trace,-ddump-exitify,-ddump-faststrings-ddump-file-prefix=⟨str⟩,-ddump-float-in,-ddump-foreign,-ddump-full-laziness,-ddump-float-out,-ddump-hie,-ddump-hpc,-ddump-if-trace-ddump-inlinings,-ddump-js,-ddump-json,-ddump-late-cc,-ddump-liberate-case,-ddump-llvm,-ddump-mod-map,-ddump-occur-anal-ddump-opt-cmm,-ddump-parsed,-ddump-parsed-ast,-ddump-prep,-ddump-rn,-ddump-rn-ast,-ddump-rn-stats,-ddump-rn-trace-ddump-rtti,-ddump-rule-firings,-ddump-rule-rewrites,-ddump-rules,-ddump-simpl,-ddump-simpl-iterations,-ddump-simpl-stats,-ddump-simpl-trace-ddump-spec,-ddump-spec-constr,-ddump-splices,-ddump-static-argument-transformation,-ddump-stg,-ddump-stg-cg,-ddump-stg-final,-ddump-stg-from-core-ddump-stg-tags,-ddump-stg-unarised,-ddump-str-signatures,-ddump-stranal,-ddump-tc,-ddump-tc-ast,-ddump-tc-trace,-ddump-ticked-ddump-timings,-ddump-to-file,-ddump-types,-ddump-verbose-inlinings,-ddump-view-pattern-commoning,-ddump-worker-wrapper,-dfaststring-stats,-dhex-word-literals-dinitial-unique=⟨s⟩,-dinline-check=⟨str⟩,-dipe-stats,-dkeep-comments,-dlinear-core-lint,-dlint,-dno-debug-output,-ddebug-output-dno-typeable-binds,-dppr-case-as-let,-dppr-cols=⟨n⟩,-dppr-debug,-dppr-user-length,-drule-check=⟨str⟩,-dshow-passes,-dstg-lint-dsuppress-all,-dsuppress-coercion-types,-dsuppress-coercions,-dsuppress-core-sizes,-dsuppress-idinfo,-dsuppress-module-prefixes,-dsuppress-stg-free-vars,-dsuppress-stg-reps-dsuppress-ticks,-dsuppress-timestamps,-dsuppress-type-applications,-dsuppress-type-signatures,-dsuppress-unfoldings,-dsuppress-uniques,-dsuppress-var-kinds,-dtag-inference-checks-dth-dec-file,-dunique-increment=⟨i⟩,-dverbose-core2core,-dverbose-stg2stg,-falignment-sanitisation,-fcatch-nonexhaustive-cases,-fcheck-prim-bounds,-fcmm-thread-sanitizer-fdistinct-constructor-tables,-fdump-with-ways,-finfo-table-map,-finfo-table-map-with-fallback,-fno-info-table-map-with-fallback,-finfo-table-map-with-stack,-fno-info-table-map-with-stack,-fllvm-fill-undef-with-garbage-fno-info-table-map-with-fallback,-finfo-table-map-with-fallback,-fno-info-table-map-with-stack,-finfo-table-map-with-stack,-forig-thunk-info,-fproc-alignment,-funoptimized-core-for-interpreter,-fno-unoptimized-core-for-interpreter-g,-g⟨n⟩
yes, a bunch of those repeat themselves up there. i don't make the rules, i just report them faithfully 🙈
🧪 C pre-processor 🧪
-cpp-D⟨symbol⟩[=⟨value⟩]-U⟨symbol⟩-I⟨dir⟩-U⟨symbol⟩
(yes -U⟨symbol⟩ is listed twice. iconic of the original, honestly 💅)
🔎 Finding imports 🔎
-i-i⟨dir⟩[:⟨dir⟩]*
🎮 Interactive mode 🎮
-fbreak-on-error,-fno-break-on-error,-fbreak-on-exception,-fno-break-on-exception,-fbreak-points,-fno-break-points-fghci-hist-size=⟨n⟩,-fghci-leak-check,-fno-ghci-leak-check-fimplicit-import-qualified,-fno-implicit-import-qualified-flocal-ghci-history,-fno-local-ghci-history-fno-it,-fno-no-it-fprint-bind-result,-fno-print-bind-result,-fprint-evld-with-show,-fshow-loaded-modules-ghci-script-ignore-dot-ghci,-no-ignore-dot-ghci-interactive-print ⟨name⟩
📦 Interface files 📦
--show-iface ⟨file⟩-ddump-hi-ddump-hi-diffs-ddump-minimal-imports
🗂️ Keeping intermediate files 🗂️
-keep-hc-file,-keep-hc-files-keep-hi-files,-no-keep-hi-files-keep-hscpp-file,-keep-hscpp-files-keep-llvm-file,-keep-llvm-files-keep-o-files,-no-keep-o-files-keep-s-file,-keep-s-files-keep-tmp-files
🌈 Language options 🌈
the motherlode. every single -X flag, in order, no exceptions bestie ✨
-XAllowAmbiguousTypes,-XApplicativeDo,-XArrows,-XBangPatterns,-XBinaryLiterals,-XBlockArguments,-XCApiFFI,-XConstrainedClassMethods-XConstraintKinds,-XCPP,-XCUSKs,-XDataKinds,-XDatatypeContexts,-XDeepSubsumption,-XDefaultSignatures,-XDeriveAnyClass-XDeriveDataTypeable,-XDeriveFoldable,-XDeriveFunctor,-XDeriveGeneric,-XDeriveLift,-XDeriveTraversable,-XDerivingStrategies,-XDerivingVia-XDisambiguateRecordFields,-XDuplicateRecordFields,-XEmptyCase,-XEmptyDataDecls,-XEmptyDataDeriving,-XExistentialQuantification,-XExplicitForAll,-XExplicitNamespaces-XExtendedDefaultRules,-XExtendedLiterals,-XFieldSelectors,-XFlexibleContexts,-XFlexibleInstances,-XForeignFunctionInterface,-XFunctionalDependencies,-XGADTs-XGADTSyntax,-XGeneralisedNewtypeDeriving,-XGeneralizedNewtypeDeriving,-XGHC2021,-XGHC2024,-XGHCForeignImportPrim,-XHaskell2010,-XHaskell98-XHexFloatLiterals,-XImplicitParams,-XImportQualifiedPost,-XImpredicativeTypes,-XIncoherentInstances,-XInstanceSigs,-XInterruptibleFFI,-XKindSignatures-XLambdaCase,-XLexicalNegation,-XLiberalTypeSynonyms,-XLinearTypes,-XListTuplePuns,-XMagicHash,-XMonadComprehensions,-XMonoLocalBinds-XMultiParamTypeClasses,-XMultiWayIf,-XNamedFieldPuns,-XNamedWildCards,-XNegativeLiterals,-XNoImplicitPrelude,-XNoMonomorphismRestriction,-XNondecreasingIndentation-XNoPatternGuards,-XNoTraditionalRecordSyntax,-XNPlusKPatterns,-XNullaryTypeClasses,-XNumDecimals,-XNumericUnderscores,-XOverlappingInstances,-XOverloadedLabels-XOverloadedLists,-XOverloadedRecordDot,-XOverloadedRecordUpdate,-XOverloadedStrings,-XPackageImports,-XParallelListComp,-XPartialTypeSignatures,-XPatternSynonyms-XPolyKinds,-XPostfixOperators,-XQualifiedDo,-XQuantifiedConstraints,-XQuasiQuotes,-XRank2Types,-XRankNTypes,-XRebindableSyntax-XRecordWildCards,-XRecursiveDo,-XRequiredTypeArguments,-XRoleAnnotations,-XSafe,-XScopedTypeVariables,-XStandaloneDeriving,-XStandaloneKindSignatures-XStarIsType,-XStaticPointers,-XStrict,-XStrictData,-XTemplateHaskell,-XTemplateHaskellQuotes,-XTransformListComp,-XTrustworthy-XTupleSections,-XTypeAbstractions,-XTypeApplications,-XTypeData,-XTypeFamilies,-XTypeFamilyDependencies,-XTypeInType,-XTypeOperators-XTypeSynonymInstances,-XUnboxedSums,-XUnboxedTuples,-XUndecidableInstances,-XUndecidableSuperClasses,-XUnicodeSyntax,-XUnliftedDatatypes,-XUnliftedFFITypes-XUnliftedNewtypes,-XUnsafe,-XViewPatterns
🔗 Linking options 🔗
-c,-debug,-dylib-install-name ⟨path⟩,-dynamic,-dynload,-eventlog-fcompact-unwind,-fkeep-cafs,-flink-rts,-fno-embed-manifest,-fno-gen-manifest,-fno-shared-implib-framework ⟨name⟩,-framework-path ⟨dir⟩-fsplit-sections,-split-sections,-fno-split-sections-fuse-rpaths,-fwhole-archive-hs-libs-L ⟨dir⟩,-l ⟨lib⟩-main-is ⟨thing⟩-no-hs-main-no-pie,-pie-no-rtsopts-suggestions-package ⟨name⟩-pie,-no-pie-rdynamic-rtsopts[=⟨none|some|all|ignore|ignoreAll⟩]-shared-single-threaded,-threaded-static,-staticlib-threaded,-single-threaded-with-rtsopts=⟨opts⟩
and yeah, -pie, -no-pie, -threaded and -single-threaded all show up more than once in the original list — that's just how she is 💀
🎀 Miscellaneous options 🎀
-ddump-mod-cycles-fdefer-out-of-scope-variables,-fno-defer-out-of-scope-variables-fdefer-type-errors,-fno-defer-type-errors-fdefer-typed-holes,-fno-defer-typed-holes-fexternal-interpreter-ffamily-application-cache,-fno-family-application-cache-fglasgow-exts,-fno-glasgow-exts-fno-safe-haskell-ghcversion-file ⟨path to ghcversion.h⟩-H ⟨size⟩-hidden-module ⟨module name⟩-j[⟨n⟩]-jsem-reexported-module ⟨module name⟩-this-package-name ⟨unit-id⟩-unit @⟨filename⟩-working-dir ⟨dir⟩
and that's the OPTIONS section for part one bestie 🫶 there's more coming, so don't go anywhere — we're only getting started ✨💖
🎀 Modes of operation 🎀
Okay bestie, this is the "what do you actually want me to do" corner of the flag menu. Whole list, in order, no skipping:
--frontend ⟨module⟩— the frontend flag, and it takes a module.--help— the help. Iconic. Use it.-?— the other help, because of course there's two.--info— the info flag.--interactive— interactive mode. Chatting with GHC, basically.--make— make mode.--numeric-version— the version, but numeric.--print-booter-version— prints the booter version.--print-build-platform— prints the build platform.--print-c-compiler-flags— prints the C compiler flags.--print-c-compiler-link-flags— prints the C compiler link flags (yes, separate thing, keep up 💅).--print-debug-on— prints whether debug is on.--print-global-package-db— prints the global package db.--print-have-interpreter— prints whether there's an interpreter.--print-have-native-code-generator— prints whether there's a native code generator.--print-host-platform— prints the host platform.--print-ld-flags— prints the ld flags.--print-leading-underscore— prints the leading underscore thing.--print-libdir— prints the libdir. That one you'll actually use a lot, fr.--print-object-splitting-supported— prints whether object splitting is supported.--print-project-git-commit-id— prints the project git commit id 👑--print-project-version— prints the project version.--print-rts-ways— prints the RTS ways.--print-stage— prints the stage.--print-support-smp— prints whether SMP is supported.--print-tables-next-to-code— prints the tables-next-to-code situation.--print-target-platform— prints the target platform (different from host, bestie, don't mix them up 🫶).--print-unregisterised— prints the unregisterised situation.--run ⟨file⟩— runs file.--show-iface ⟨file⟩— shows the interface for file.--show-options— shows the options. Meta, I know.--supported-extensions— supported extensions.--supported-languages— supported languages.--version— the version.-V— the version again, short form.-e ⟨expr⟩— expression, in the house, taking expr.-M— it's-M. It's on the list. That's the tweet.-shared— the-sharedflag, present and accounted for.
🔥 Individual optimizations 🔥
This is the section. THE section. It's giving "somebody dumped the entire optimizer's switchboard on the floor and said 'sort it out'." Every one of these has a -fno- twin that turns it back off (except the ones that don't, and I flag those, don't worry 👀). Nobody memorizes this list. You Ctrl-F it. That's the vibe.
-fasm-shortcutting,-fno-asm-shortcutting— asm shortcutting, on and off.-fbinary-blob-threshold=⟨n⟩— binary blob threshold, set to n. No-fno-twin here, it just wants a number 🍓-fblock-layout-cfg,-fno-block-layout-cfg— block layout CFG, on and off.-fblock-layout-weightless,-fno-block-layout-weightless— weightless block layout, on and off.-fblock-layout-weights— block layout weights. Just the one direction, no off switch listed 💅-fcall-arity,-fno-call-arity— call arity, on and off.-fcase-folding,-fno-case-folding— case folding, on and off.-fcase-merge,-fno-case-merge— case merge, on and off.-fcmm-control-flow,-fno-cmm-control-flow— Cmm control flow, on and off.-fcmm-elim-common-blocks,-fno-cmm-elim-common-blocks— Cmm common block elimination, on and off.-fcmm-sink,-fno-cmm-sink— Cmm sink, on and off.-fcmm-static-pred,-fno-cmm-static-pred— Cmm static pred, on and off.-fcore-constant-folding,-fno-core-constant-folding— core constant folding, on and off.-fcpr-anal,-fno-cpr-anal— CPR analysis, on and off.-fcross-module-specialise,-fno-cross-module-specialise— cross-module specialisation, on and off.-fcse,-fno-cse— CSE, on and off.-fdicts-cheap,-fno-dicts-cheap— dicts cheap, on and off.-fdicts-strict,-fno-dicts-strict— dicts strict, on and off.-fdmd-tx-dict-sel,-fno-dmd-tx-dict-sel— demand transformer dictionary selection, on and off.-fdmd-unbox-width=⟨n⟩— demand unbox width, set to n.-fdo-clever-arg-eta-expansion,-fno-do-clever-arg-eta-expansion— the clever arg eta expansion one. Certified clever 💅-fdo-eta-reduction,-fno-do-eta-reduction— eta reduction, on and off.-fdo-lambda-eta-expansion,-fno-do-lambda-eta-expansion— lambda eta expansion, on and off.-feager-blackholing— eager blackholing. One direction only, bestie.-fenable-rewrite-rules,-fno-enable-rewrite-rules— rewrite rules, enabled or not.-fexcess-precision,-fno-excess-precision— excess precision, on and off.-fexitification,-fno-exitification— exitification. Say it five times fast 😭-fexpose-all-unfoldings,-fno-expose-all-unfoldings— expose ALL the unfoldings (or don't).-ffloat-in,-fno-float-in— float in, on and off.-ffull-laziness,-fno-full-laziness— full laziness, on and off.-ffun-to-thunk,-fno-fun-to-thunk— fun to thunk, on and off.-fignore-asserts,-fno-ignore-asserts— ignore asserts, or not.-fignore-interface-pragmas,-fno-ignore-interface-pragmas— ignore interface pragmas, or not.-finline-generics,-fno-inline-generics— inline generics, on and off.-finline-generics-aggressively,-fno-inline-generics-aggressively— inline generics but make it aggressive 🔥-finter-module-far-jumps,-fno-inter-module-far-jumps— inter-module far jumps, on and off.-fkeep-auto-rules,-fno-keep-auto-rules— keep auto rules, or not.-flate-dmd-anal,-fno-late-dmd-anal— late demand analysis, on and off.-flate-specialise,-fno-late-specialise— late specialise, on and off.-fliberate-case,-fno-liberate-case— liberate case 🕊️ on and off.-fliberate-case-threshold=⟨n⟩,-fno-liberate-case-threshold— liberate case threshold at n, or no threshold.-fllvm-pass-vectors-in-regs— LLVM, pass vectors in regs. Single direction only.-flocal-float-out,-fno-local-float-out— local float out, on and off.-flocal-float-out-top-level,-fno-local-float-out-top-level— same but top-level, on and off.-floopification,-fno-loopification— loopification 🌀 on and off.-fmax-forced-spec-args=⟨n⟩— max forced spec args, set to n.-fmax-inline-alloc-size=⟨n⟩— max inline alloc size, set to n.-fmax-inline-memcpy-insns=⟨n⟩— max inline memcpy instructions, set to n.-fmax-inline-memset-insns=⟨n⟩— max inline memset instructions, set to n.-fmax-simplifier-iterations=⟨n⟩— max simplifier iterations, set to n.-fmax-uncovered-patterns=⟨n⟩— max uncovered patterns, set to n.-fmax-worker-args=⟨n⟩— max worker args, set to n.-fno-opt-coercion— no opt coercion. Off-switch-only, that's how it's listed 🙈-fno-pre-inlining— no pre-inlining. Also off-switch-only.-fno-state-hack— no state hack. Same deal.-fomit-interface-pragmas,-fno-omit-interface-pragmas— omit interface pragmas, or not.-fomit-yields,-fno-omit-yields— omit yields, or not.-foptimal-applicative-do,-fno-optimal-applicative-do— optimal applicative do, on and off.-fpedantic-bottoms,-fno-pedantic-bottoms— pedantic bottoms 🍑 on and off.-fpolymorphic-specialisation,-fno-polymorphic-specialisation— polymorphic specialisation, on and off.-fregs-graph,-fno-regs-graph— registers graph, on and off.-fregs-iterative,-fno-regs-iterative— registers iterative, on and off.-fsimpl-tick-factor=⟨n⟩— simplifier tick factor, set to n.-fsimplifier-phases=⟨n⟩— simplifier phases, set to n.-fsolve-constant-dicts,-fno-solve-constant-dicts— solve constant dicts, on and off.-fspec-constr,-fno-spec-constr— spec constr, on and off.-fspec-constr-count=⟨n⟩,-fno-spec-constr-count— spec constr count at n, or off.-fspec-constr-keen,-fno-spec-constr-keen— spec constr but keen ✨ or not.-fspec-constr-threshold=⟨n⟩,-fno-spec-constr-threshold— spec constr threshold at n, or off.-fspec-eval,-fno-spec-eval— spec eval, on and off.-fspec-eval-dictfun,-fno-spec-eval-dictfun— spec eval dictfun, on and off.-fspecialise,-fno-specialise— specialise, on and off.-fspecialise-aggressively,-fno-specialise-aggressively— specialise aggressively 😤 or don't.-fspecialise-incoherents,-fno-specialise-incoherents— specialise incoherents, on and off.-fstatic-argument-transformation,-fno-static-argument-transformation— static argument transformation, on and off.-fstg-cse,-fno-stg-cse— STG CSE, on and off.-fstg-lift-lams,-fno-stg-lift-lams— STG lift lambdas, on and off.-fstg-lift-lams-known,-fno-stg-lift-lams-known— STG lift lams known, on and off.-fstg-lift-lams-non-rec-args— STG lift lams non-rec args. Listed on its own, no twin.-fstg-lift-lams-non-rec-args-any— ...and the-anyversion. Also on its own.-fstg-lift-lams-rec-args— STG lift lams rec args. Solo.-fstg-lift-lams-rec-args-any— the-anyversion of that. Solo too.-fstrictness,-fno-strictness— strictness, on and off.-fstrictness-before=⟨n⟩— strictness before, set to n.-funbox-small-strict-fields,-fno-unbox-small-strict-fields— unbox small strict fields. Note the on-flag says-funboxand the off-flag says-fno-unbox, and yes, that asymmetry is real, do not "fix" it 😭-funbox-strict-fields,-fno-unbox-strict-fields— same energy, unbox strict fields, on and off.-funfolding-case-scaling=⟨n⟩— unfolding case scaling, set to n.-funfolding-case-threshold=⟨n⟩— unfolding case threshold, set to n.-funfolding-creation-threshold=⟨n⟩— unfolding creation threshold, set to n.-funfolding-dict-discount=⟨n⟩— unfolding dict discount, set to n.-funfolding-fun-discount=⟨n⟩— unfolding fun discount, set to n.-funfolding-keeness-factor=⟨n⟩— unfolding keeness factor, set to n. (Yes, "keeness". That's literally how it's spelled in the flag. Keep it. 🫶)-funfolding-use-threshold=⟨n⟩— unfolding use threshold, set to n.-fworker-wrapper— worker wrapper. On. Just on.-fworker-wrapper-cbv— worker wrapper CBV. Also just on.
👑 Optimization levels 👑
The big knobs. Here's the list exactly as it comes, and yes, -O0 really does show up that many times — this is verbatim, not me glitching 💀
-O-O1-O0-O0-O2-O0-O⟨n⟩— takes a number, n.-O0
That's the list. All of it. Including every -O0. Periodt.
🌸 Package options 🌸
Package database politics. Extremely "who's allowed in the group chat" energy.
-clear-package-db— clear the package db.-distrust ⟨pkg⟩— distrust pkg.-distrust-all-packages— distrust ALL the packages. Trust issues, but make it compiler 💀-fpackage-trust— package trust, as a flag.-global-package-db— the global package db.-hide-all-packages— hide all packages.-hide-package ⟨pkg⟩— hide pkg.-ignore-package ⟨pkg⟩— ignore pkg.-no-auto-link-packages— no auto-link packages.-no-global-package-db— no global package db.-no-user-package-db— no user package db.-package ⟨pkg⟩— package pkg.-package-db ⟨file⟩— package db from file.-package-env ⟨file⟩|⟨name⟩— package env, takes a file or a name.-package-id ⟨unit-id⟩— package by unit-id.-this-unit-id ⟨unit-id⟩— this unit id, set to unit-id.-trust ⟨pkg⟩— trust pkg (the opposite of the distrust one, obviously 💅).-user-package-db— the user package db.
🦋 Phases of compilation 🦋
Where do you want to stop, bestie.
--merge-objs— merge objects.-C— the-Cphase.-c— the-cphase. Lowercase. Different thing. Be careful 😭-E— the-Ephase.-F— the-Fphase.-S— the-Sphase.-x ⟨suffix⟩— suffix, set to suffix.
⭐ Overriding external programs ⭐
The -pgm family: "actually, use this command instead." One bullet each, and yeah there are a lot of them.
-pgma ⟨cmd⟩— theaprogram, use cmd.-pgmc ⟨cmd⟩— the C compiler program, use cmd.-pgmCmmP ⟨cmd⟩— the Cmm preprocessor program, use cmd.-pgmcxx ⟨cmd⟩— the C++ program, use cmd.-pgmF ⟨cmd⟩— theFprogram, use cmd.-pgmi ⟨cmd⟩— theiprogram, use cmd.-pgminstall_name_tool ⟨cmd⟩— theinstall_name_toolprogram, use cmd. Underscores and all, keep it exact 🫶-pgmJSP ⟨cmd⟩— the JSP program, use cmd.-pgmL ⟨cmd⟩— the big-L program, use cmd.-pgml ⟨cmd⟩— the little-l program, use cmd. Yes, both exist. Yes, they're different. Yes, I'm serious.-pgmlas ⟨cmd⟩— thelasprogram, use cmd.-pgmlc ⟨cmd⟩— thelcprogram, use cmd.-pgmlm ⟨cmd⟩— thelmprogram, use cmd.-pgmlo ⟨cmd⟩— theloprogram, use cmd.-pgmotool ⟨cmd⟩— theotoolprogram, use cmd.-pgmP ⟨cmd⟩— the preprocessor program, use cmd.-pgms ⟨cmd⟩— thesprogram, use cmd.-pgmwindres ⟨cmd⟩— the windres program, use cmd.
🧚 Phase-specific options 🧚
Same vibe, but now you're slipping raw flags to a specific phase. The -opt family:
-opta ⟨option⟩— pass option to theaphase.-optc ⟨option⟩— pass option to the C phase.-optCmmP ⟨option⟩— pass option to the Cmm preprocessor phase.-optcxx ⟨option⟩— pass option to the C++ phase.-optF ⟨option⟩— pass option to theFphase.-opti ⟨option⟩— pass option to theiphase.-optJSP ⟨option⟩— pass option to the JSP phase.-optL ⟨option⟩— pass option to the big-L phase.-optl ⟨option⟩— pass option to the little-l phase.-optlas ⟨option⟩— pass option to thelasphase.-optlc ⟨option⟩— pass option to thelcphase.-optlm ⟨option⟩— pass option to thelmphase.-optlo ⟨option⟩— pass option to thelophase.-optP ⟨option⟩— pass option to the preprocessor phase.-optwindres ⟨option⟩— pass option to the windres phase.-pgmc-supports-no-pie— says the C compiler program supports no-pie.-pgml-supports-no-pie— same, for the linker program.
💜 Platform-specific options 💜
CPU instruction-set flags. Say them out loud, they're fun.
-mavx— AVX.-mavx2— AVX2.-mavx512cd— AVX-512 CD.-mavx512er— AVX-512 ER.-mavx512f— AVX-512 F.-mavx512pf— AVX-512 PF.-mbmi— BMI.-mbmi2— BMI2.-mfma— FMA.-msse— SSE.-msse2— SSE2.-msse3— SSE3.-msse4— SSE4.-msse4.2— SSE4.2. Dot and all, don't drop it 🍓
🌈 Compiler plugins 🌈
Letting other code into the compiler. Main character behaviour, honestly.
-fclear-plugins— clear the plugins.-fplugin-library=⟨file-path⟩;⟨unit-id⟩;⟨module⟩;⟨args⟩— plugin library, and it wants all four bits separated by semicolons: file path, unit id, module, args. Semicolons stay. Exact.-fplugin-opt=⟨module⟩:⟨args⟩— plugin opts for module, colon, then args.-fplugin-trustworthy— the plugin is trustworthy 🫶-fplugin=⟨module⟩— load plugin module.-hide-all-plugin-packages— hide all plugin packages.-plugin-package ⟨pkg⟩— plugin package pkg.-plugin-package-id ⟨pkg-id⟩— plugin package by pkg-id.
🎀 Profiling 🎀
For when you need to know where the time went. The -fno-prof-auto really does appear four times in this list, and I'm keeping every single one 💀
-auto— auto.-auto-all— auto, but all.-caf-all— CAF all.-fno-prof-count-entries— don't count entries.-fprof-count-entries— do count entries.-fprof-auto— prof auto.-fno-prof-auto— no prof auto.-fprof-auto-calls— prof auto calls.-fno-prof-auto— no prof auto. (Yes, again.)-fprof-auto-exported— prof auto, exported only.-fno-prof-auto— no prof auto. (Third time. Not a typo.)-fprof-auto-top— prof auto, top level.-fno-prof-auto— no prof auto. (Fourth. Slay.)-fprof-cafs— prof CAFs.-fno-prof-cafs— no prof CAFs.-fprof-callers=⟨name⟩— prof callers for name.-fprof-late— prof late.-fno-prof-late— no prof late.-fprof-late-inline— prof late inline.-fno-prof-late-inline— no prof late inline.-fprof-late-overloaded— prof late overloaded.-fno-prof-late-overloaded— no prof late overloaded.-fprof-late-overloaded-calls— prof late overloaded calls.-fno-prof-late-overloaded-calls— no prof late overloaded calls.-fprof-manual— prof manual.-fno-prof-manual— no prof manual.-no-auto— no auto.-no-auto-all— no auto-all.-no-caf-all— no CAF all.-prof— prof.-ticky— ticky 🎫-ticky-allocd— ticky allocated.-ticky-ap-thunk— ticky AP thunk.-ticky-dyn-thunk— ticky dynamic thunk.-ticky-LNE— ticky LNE. Capitals stay, bestie.-ticky-tag-checks— ticky tag checks.
🍓 Program coverage 🍓
-fhpc— HPC, on.-hpcdir⟨dir⟩— HPC dir set to dir. And no, there's no space in it in the original — it's written exactly like that, so that's how I'm giving it to you 🫶
✨ Recompilation checking ✨
"Do I really have to rebuild this?" — the section.
-exclude-module=⟨file⟩— exclude file from the module set.-fforce-recomp— force recompilation. Just do it again.-fno-force-recomp— don't force recompilation.-fignore-hpc-changes— ignore HPC changes.-fno-ignore-hpc-changes— don't ignore HPC changes.-fignore-optim-changes— ignore optimization changes.-fno-ignore-optim-changes— don't ignore optimization changes.-include-cpp-deps— include CPP deps.-include-pkg-deps— include package deps.
💅 Redirecting output 💅
Where does the output actually GO. Naming all the files. Go.
-dep-makefile ⟨file⟩— dep makefile goes to file.-dep-suffix ⟨suffix⟩— dep suffix, suffix.-dumpdir ⟨dir⟩— dump dir, dir.-dynhisuf ⟨suffix⟩— dynamic hi suffix, suffix.-dyno ⟨file⟩— dynamic object file, file.-dynohi ⟨file⟩— dynamic ohi file, file.-dynosuf ⟨suffix⟩— dynamic osuf, suffix.-hcsuf ⟨suffix⟩— hc suffix, suffix.-hidir ⟨dir⟩— hi dir, dir.-hiedir ⟨dir⟩— hie dir, dir.-hiesuf ⟨suffix⟩— hie suffix, suffix.-hisuf ⟨suffix⟩— hi suffix, suffix.-o ⟨file⟩— output to file. The classic.-odir ⟨dir⟩— object dir, dir.-ohi ⟨file⟩— ohi file, file.-osuf ⟨suffix⟩— osuf, suffix.-outputdir ⟨dir⟩— output dir, dir.-stubdir ⟨dir⟩— stub dir, dir.
🦋 Temporary files 🦋
-tmpdir ⟨dir⟩— tmp dir, dir. That's the whole section. One flag. Iconic brevity 👑
🔥 Verbosity options 🔥
The diagnostics-and-error-messages wing. This is the section that decides how much GHC talks to you and in what fonts and colours, and honestly it's my favourite part of the whole page.
-fabstract-refinement-hole-fits— abstract refinement hole fits.-fno-abstract-refinement-hole-fits— no abstract refinement hole fits.-fdefer-diagnostics— defer diagnostics.-fdiagnostics-as-json— diagnostics as JSON.-fdiagnostics-color=⟨always|auto|never⟩— diagnostics colour:always,auto, ornever. Pick one.-fdiagnostics-show-caret— show the caret in diagnostics.-fno-diagnostics-show-caret— no caret. Sad.-ferror-spans— error spans.-fhide-source-paths— hide source paths.-fkeep-going— keep going. Don't stop at the first error, we're built different 💪-fmax-refinement-hole-fits=⟨n⟩— max refinement hole fits, n.-fno-max-refinement-hole-fits— no max on refinement hole fits.-fmax-relevant-binds=⟨n⟩— max relevant binds, n.-fno-max-relevant-binds— no max on relevant binds.-fmax-valid-hole-fits=⟨n⟩— max valid hole fits, n.-fno-max-valid-hole-fits— no max on valid hole fits.-fno-show-valid-hole-fits— don't show valid hole fits.-fno-sort-valid-hole-fits— don't sort valid hole fits.-fsort-valid-hole-fits— do sort valid hole fits.-fprint-axiom-incomps— print axiom incompatibilities.-fno-print-axiom-incomps— don't.-fprint-equality-relations— print equality relations.-fno-print-equality-relations— don't.-fprint-error-index-links=⟨always|auto|never⟩— print error index links:always,auto, ornever.-fprint-expanded-synonyms— print expanded synonyms.-fno-print-expanded-synonyms— don't.-fprint-explicit-coercions— print explicit coercions.-fno-print-explicit-coercions— don't.-fprint-explicit-foralls— print explicit foralls. Theforallgirlies are obsessed with this one 🎀-fno-print-explicit-foralls— don't.-fprint-explicit-kinds— print explicit kinds.-fno-print-explicit-kinds— don't.-fprint-explicit-runtime-reps— print explicit runtime reps.-fno-print-explicit-runtime-reps— don't.-fprint-potential-instances— print potential instances.-fno-print-potential-instances— don't.-fprint-redundant-promotion-ticks— print redundant promotion ticks.-fno-print-redundant-promotion-ticks— don't.-fprint-typechecker-elaboration— print typechecker elaboration.-fno-print-typechecker-elaboration— don't.-fprint-unicode-syntax— print unicode syntax 🦋-fno-print-unicode-syntax— don't.-frefinement-level-hole-fits=⟨n⟩— refinement level for hole fits, n.-fno-refinement-level-hole-fits— no refinement level for hole fits.-freverse-errors— reverse the errors.-fno-reverse-errors— don't.-fshow-docs-of-hole-fits— show docs of hole fits.-fno-show-docs-of-hole-fits— don't.-fshow-error-context— show error context.-fno-show-error-context— don't.-fshow-hole-constraints— show hole constraints. Only the on version is listed, so that's all you get 🫶-fshow-hole-matches-of-hole-fits— show hole matches of hole fits.-fno-show-hole-matches-of-hole-fits— don't.-fshow-provenance-of-hole-fits— show provenance of hole fits.-fno-show-provenance-of-hole-fits— don't.-fshow-type-app-of-hole-fits— show type application of hole fits.-fno-show-type-app-of-hole-fits— don't.-fshow-type-app-vars-of-hole-fits— show type app vars of hole fits. Different flag, don't merge them 😭-fno-show-type-app-vars-of-hole-fits— don't.-fshow-type-of-hole-fits— show the type of hole fits.-fno-show-type-of-hole-fits— don't.-fsort-by-size-hole-fits— sort hole fits by size.-fno-sort-by-size-hole-fits— don't.-fsort-by-subsumption-hole-fits— sort hole fits by subsumption.-fno-sort-by-subsumption-hole-fits— don't.-funclutter-valid-hole-fits— unclutter the valid hole fits ✨-Rghc-timing—-Rghc-timing. Exact spelling, capital R, lowercase everything else. Write it down.-v— verbose.-v⟨n⟩— verbose, but with a number, n.
And that's where this part stops — more coming, don't go anywhere 💖
✨ Warnings ✨
okay bestie, this is the big one — the entire warning-flag zoo 🦋. Some of these turn a warning on, some turn it off, and some are the same thing spelled two ways (-specialisations / -specializations, we see you 👀). I'm listing every single one, no skips, because that's the vibe 💅
-fenable-th-splice-warnings,-fno-enable-th-splice-warnings— the on/off pair for this one 🎀-fhelpful-errors,-fno-helpful-errors— on/off pair ✨-fmax-pmcheck-models=⟨n⟩— takes a value ⟨n⟩, keep the angle brackets exactly as-is 🫶-fshow-warning-groups,-fno-show-warning-groups— on/off pair-fvia-C— yep, this one's just kind of sitting here lol-W— the lone capital W, iconic 👑-Wno-extra— off switch for-Wextra-ish stuff-w— lowercase w, the tiny gremlin (also shows up again later in this list, same flag 💀)-Wall,-Wno-all— the classic on/off pair 🔥-Wall-missed-specialisations,-Wno-all-missed-specialisations— British spelling pair 🇬🇧-Wall-missed-specializations,-Wno-all-missed-specializations— American spelling pair 🇺🇸 (yes, both exist, periodt)-Wambiguous-fields— single, no off-switch listed here 🙈-Wauto-orphans— single 🌸-Wbadly-staged-types,-Wno-badly-staged-types— on/off pair-Wcompat,-Wno-compat— on/off pair ⭐-Wcompat-unqualified-imports,-Wno-compat-unqualified-imports— on/off pair-Wcpp-undef— single 🍓-Wdata-kinds-tc,-Wno-data-kinds-tc— on/off pair-Wdefault,-Wno-default— on/off pair-Wdefaulted-exception-context,-Wnop-defaulted-exception-context— note that off-switch is-Wnop-…, not-Wno-…, copy it exactly bestie 💀-Wdeferred-out-of-scope-variables,-Wno-deferred-out-of-scope-variables— on/off pair-Wdeferred-type-errors,-Wno-deferred-type-errors— on/off pair-Wdeprecated-flags,-Wno-deprecated-flags— on/off pair-Wdeprecated-type-abstractions,-Wno-deprecated-type-abstractions— on/off pair-Wdeprecations,-Wno-deprecations— on/off pair-Wderiving-defaults,-Wno-deriving-defaults— on/off pair-Wderiving-typeable,-Wno-deriving-typeable— on/off pair-Wdodgy-exports,-Wno-dodgy-exports— on/off pair-Wdodgy-foreign-imports,-Wno-dodgy-foreign-imports— on/off pair-Wdodgy-imports,-Wno-dodgy-imports— on/off pair-Wduplicate-constraints,-Wno-duplicate-constraints— on/off pair-Wduplicate-exports,-Wno-duplicate-exports— on/off pair-Wempty-enumerations,-Wno-empty-enumerations— on/off pair-Werror,-Wwarn— pair ✨ (also reappears further down this list, keep both sightings)-Weverything— the maximalist 💅-Wextended-warnings,-Wno-extended-warnings— on/off pair-Wextra,-Wno-extra— on/off pair-Wforall-identifier— single 👑-Wgadt-mono-local-binds,-Wno-gadt-mono-local-binds— on/off pair-Whi-shadowing,-Wno-hi-shadowing— on/off pair-Widentities,-Wno-identities— on/off pair-Wimplicit-kind-vars,-Wno-implicit-kind-vars— on/off pair-Wimplicit-lift,-Wno-implicit-lift— on/off pair-Wimplicit-prelude,-Wno-implicit-prelude— on/off pair-Wimplicit-rhs-quantification,-Wno-implicit-rhs-quantification— on/off pair-Winaccessible-code,-Wno-inaccessible-code— on/off pair-Wincomplete-export-warnings,-Wno-incomplete-export-warnings— on/off pair-Wincomplete-patterns,-Wno-incomplete-patterns— on/off pair-Wincomplete-record-selectors,-Wno-incomplete-record-selectors— on/off pair-Wincomplete-record-updates,-Wno-incomplete-record-updates— on/off pair-Wincomplete-uni-patterns,-Wno-incomplete-uni-patterns— on/off pair-Winconsistent-flags,-Wno-inconsistent-flags— on/off pair-Winferred-safe-imports,-Wno-inferred-safe-imports— on/off pair-Winline-rule-shadowing,-Wno-inline-rule-shadowing— on/off pair-Winvalid-haddock,-Wno-invalid-haddock— on/off pair-Wloopy-superclass-solve,-Wno-loopy-superclass-solve— on/off pair 🌀-Wmisplaced-pragmas,-Wno-misplaced-pragmas— on/off pair-Wmissed-extra-shared-lib,-Wno-missed-extra-shared-lib— on/off pair-Wmissed-specialisations,-Wno-missed-specialisations— on/off pair-Wmissed-specializations,-Wno-missed-specializations— on/off pair-Wmissing-deriving-strategies,-Wno-missing-deriving-strategies— on/off pair-Wmissing-export-lists,-Wno-missing-export-lists— on/off pair-Wmissing-exported-pattern-synonym-signatures,-Wno-missing-exported-pattern-synonym-signatures— the long boi 💀 on/off pair-Wmissing-exported-signatures,-Wno-missing-exported-signatures— on/off pair-Wmissing-exported-sigs,-Wno-missing-exported-sigs— on/off pair (short version)-Wmissing-fields,-Wno-missing-fields— on/off pair-Wmissing-home-modules,-Wno-missing-home-modules— on/off pair-Wmissing-import-lists,-Wno-missing-import-lists— on/off pair-Wmissing-kind-signatures,-Wno-missing-kind-signatures— on/off pair-Wmissing-local-signatures,-Wno-missing-local-signatures— on/off pair-Wmissing-local-sigs,-Wno-missing-local-sigs— on/off pair-Wmissing-methods,-Wno-missing-methods— on/off pair-Wmissing-monadfail-instances,-Wno-missing-monadfail-instances— on/off pair-Wmissing-pattern-synonym-signatures,-Wno-missing-pattern-synonym-signatures— on/off pair-Wmissing-poly-kind-signatures,-Wno-missing-poly-kind-signatures— on/off pair-Wmissing-role-annotations,-Wno-role-annotations-signatures— ⚠️ careful, the off-switch is spelled-Wno-role-annotations-signatures. Do not "fix" it, copy it character for character 🫶-Wmissing-safe-haskell-mode,-Wno-missing-safe-haskell-mode— on/off pair-Wmissing-signatures,-Wno-missing-signatures— on/off pair-Wmissing-space-after-bang— single, no off-switch listed-Wmonomorphism-restriction,-Wno-monomorphism-restriction— on/off pair-Wname-shadowing,-Wno-name-shadowing— on/off pair-Wnoncanonical-monad-instances,-Wno-noncanonical-monad-instances— on/off pair-Wnoncanonical-monadfail-instances,-Wno-noncanonical-monadfail-instances— on/off pair-Wnoncanonical-monoid-instances,-Wno-noncanonical-monoid-instances— on/off pair-Wnot— single, and truly iconic naming 💀-Woperator-whitespace,-Wno-operator-whitespace— on/off pair-Woperator-whitespace-ext-conflict,-Wno-operator-whitespace-ext-conflict— on/off pair-Worphans,-Wno-orphans— on/off pair 🥺-Woverflowed-literals,-Wno-overflowed-literals— on/off pair-Woverlapping-patterns,-Wno-overlapping-patterns— on/off pair-Wpartial-fields,-Wno-partial-fields— on/off pair-Wpartial-type-signatures,-Wno-partial-type-signatures— on/off pair-Wprepositive-qualified-module,-Wno-prepositive-qualified-module— on/off pair-Wredundant-bang-patterns,-Wno-redundant-bang-patterns— on/off pair-Wredundant-constraints,-Wno-redundant-constraints— on/off pair-Wredundant-record-wildcards,-Wno-redundant-record-wildcards— on/off pair-Wredundant-strictness-flags,-Wno-redundant-strictness-flags— on/off pair-Wsafe,-Wno-safe— on/off pair-Wsemigroup,-Wno-semigroup— on/off pair-Wsimplifiable-class-constraints,-Wno-simplifiable-class-constraints— on/off pair-Wstar-binder,-Wno-star-binder— on/off pair ⭐-Wstar-is-type,-Wno-star-is-type— on/off pair-Wtabs,-Wno-tabs— on/off pair-Wterm-variable-capture— single, no off-switch listed-Wtrustworthy-safe,-Wno-safe— yes, the off-switch here really is-Wno-safeagain. Not a typo of mine, copy it exactly 🙈-Wtype-defaults,-Wno-type-defaults— on/off pair-Wtype-equality-out-of-scope,-Wno-type-equality-out-of-scope— on/off pair-Wtype-equality-requires-operators,-Wno-type-equality-requires-operators— on/off pair-Wtyped-holes,-Wno-typed-holes— on/off pair 🕳️-Wunbanged-strict-patterns,-Wno-unbanged-strict-patterns— on/off pair-Wunicode-bidirectional-format-characters— single, no off-switch listed 🌈-Wunrecognised-pragmas,-Wno-unrecognised-pragmas— on/off pair-Wunrecognised-warning-flags,-Wno-unrecognised-warning-flags— on/off pair-Wunsafe,-Wno-unsafe— on/off pair-Wunsupported-calling-conventions,-Wno-unsupported-calling-conventions— on/off pair-Wunsupported-llvm-version,-Wno-unsupported-llvm-version— on/off pair-Wunticked-promoted-constructors,-Wno-unticked-promoted-constructors— on/off pair-Wunused-binds,-Wno-unused-binds— on/off pair-Wunused-do-bind,-Wno-unused-do-bind— on/off pair-Wunused-foralls,-Wno-unused-foralls— on/off pair-Wunused-imports,-Wno-unused-imports— on/off pair-Wunused-local-binds,-Wno-unused-local-binds— on/off pair-Wunused-matches,-Wno-unused-matches— on/off pair-Wunused-packages,-Wno-unused-packages— on/off pair-Wunused-pattern-binds,-Wno-unused-pattern-binds— on/off pair-Wunused-record-wildcards,-Wno-unused-record-wildcards— on/off pair-Wunused-top-binds,-Wno-unused-top-binds— on/off pair-Wunused-type-patterns,-Wno-unused-type-patterns— on/off pair-Wwarn,-Werror— pair, appearing here again 🎀-Wwarnings-deprecations,-Wno-warnings-deprecations— on/off pair-Wwrong-do-bind,-Wno-wrong-do-bind— on/off pair-Wx-⟨category⟩,-Wno-x-⟨category⟩— these take a ⟨category⟩ placeholder, angle brackets and all, don't touch them 🫶
that's the whole warning alphabet soup, you survived, so proud of you 😭💖
🔥 Code generation 🔥
this is the "what should the compiler actually make" section, and honestly? it's giving choose-your-own-adventure 🦋
-dynamic-too— Build dynamic object files as well as static object files during compilation. both at once, greedy and we love it ✨-fasm— Use the native code generator 🏎️-fbyte-code— Generate byte-code-fbyte-code-and-object-code— Generate object code and byte-code (yes, both, icon behaviour 👑)-fexpose-internal-symbols— Produce symbols for all functions, including internal functions.-fexternal-dynamic-refs— Generate code for linking against dynamic libraries-fllvm— Compile using the LLVM code generator 💅-fno-code— Omit code generation-fobject-code— Generate object code-fPIC— Generate position-independent code (where available) ⚠️ note the "where available", that's load-bearing-fPIE— Generate code for a position-independent executable (where available) ⚠️ same caveat bestie-fprefer-byte-code— Use byte-code if it is available to evaluate TH splices-fwrite-if-simplified-core— Write an interface file containing the simplified core of the module.-fwrite-interface— Always write interface files 🎀
🩺 Debugging the compiler 🩺
okay so this is the "let me look inside the compiler's brain" section — every one of these is a -d flag and the whole vibe is x-ray vision 🔬✨
-dasm-lint— ASM pass sanity checking-dcmm-lint—C--pass sanity checking-dcore-lint— Turn on internal sanity checking-ddisable-js-c-sources— Disable the link with C sources compiled to JavaScript-ddisable-js-minifier— Generate pretty-printed JavaScript code instead of minified (compacted) code.-ddump-asm— Dump final assembly-ddump-asm-conflicts— Dump register conflicts from the register allocator.-ddump-asm-liveness— Dump assembly augmented with register liveness-ddump-asm-native— Dump initial assembly-ddump-asm-regalloc— Dump the result of register allocation-ddump-asm-regalloc-stages— Dump the build/spill stages of the-fregs-graphregister allocator.-ddump-asm-stats— Dump statistics from the register allocator.-ddump-bcos— Dump interpreter byte code-ddump-c-backend— Dump C code produced by the C (unregisterised) backend.-ddump-call-arity— Dump output of the call arity analysis pass.-ddump-cfg-weights— Dump the assumed weights of the CFG.-ddump-cmm— Dump the finalC--output-ddump-cmm-caf— Dump the results of theC--CAF analysis pass.-ddump-cmm-cbe— Dump the results of common block elimination-ddump-cmm-cfg— Dump the results of theC--control flow optimisation pass.-ddump-cmm-cps— Dump the results of the CPS pass-ddump-cmm-from-stg— Dump STG-to-C--output-ddump-cmm-info— Dump the results of theC--info table augmentation pass.-ddump-cmm-opt— Dump the results ofC--toC--optimising passes-ddump-cmm-proc— Dump the results of proc-point analysis-ddump-cmm-procmap— Dump the results of theC--proc-point map pass.-ddump-cmm-raw— Dump rawC---ddump-cmm-sink— Dump the results of theC--sinking pass.-ddump-cmm-sp— Dump the results of theC--stack layout pass.-ddump-cmm-split— Dump the results of theC--proc-point splitting pass.-ddump-cmm-switch— Dump the results of switch lowering passes-ddump-cmm-thread-sanitizer— Dump the results of theC--ThreadSanitizer elaboration pass.-ddump-cmm-verbose— Write output from mainC--pipeline passes to files-ddump-cmm-verbose-by-proc— Show output from mainC--pipeline passes (grouped by proc)-ddump-core-stats— Print a one-line summary of the size of the Core program at the end of the optimisation pipeline-ddump-cpr-signatures— Dump CPR signatures-ddump-cpranal— Dump CPR analysis output-ddump-cs-trace— Trace constraint solver-ddump-cse— Dump CSE output-ddump-debug— Dump generated DWARF debug information
and that's where we're pausing, because there is so much more coming bestie, don't you dare close the tab 💖
-ddump-deriv— dump the deriving output ✨-ddump-dmd-signatures— dump top-level demand signatures 💅-ddump-dmdanal— dump demand analysis output 🔥-ddump-ds— dump the desugarer output 🍓-ddump-ec-trace— trace the exhaustiveness checker 👑-ddump-exitify— dump output of the exitification pass 🌈-ddump-faststrings— dump the wholeFastStringtable when finished 🎀-ddump-file-prefix=⟨str⟩— set the prefix of the filenames used for debugging output 📁-ddump-float-in— dump float-in output 🦋-ddump-foreign— dump foreign export stubs 🌍-ddump-full-laziness— dump full laziness pass output 😴-ddump-hie— dump the hie file syntax tree 🌳-ddump-hpc— an alias for-ddump-ticked🎯-ddump-if-trace— trace interface files 🧚-ddump-inlinings— dump inlinings performed by the simplifier 🌀-ddump-js— dump final JavaScript code 📜-ddump-json— deprecated, use-fdiagnostics-as-jsoninstead 🚨-ddump-late-cc— dump core with late cost centres added 💰-ddump-liberate-case— dump liberate case output 🕊️-ddump-llvm— dump LLVM intermediate code 🧱-ddump-mod-map— dump the state of the module mapping database 🗺️-ddump-occur-anal— dump occurrence analysis output 🔍-ddump-opt-cmm— dump the results of C-- to C-- optimising passes ⚙️-ddump-parsed— dump the parse tree 🌲-ddump-parsed-ast— dump parser output as a syntax tree 🌴-ddump-prep— dump prepared core 🧃-ddump-rn— dump renamer output ✏️-ddump-rn-ast— dump renamer output as a syntax tree 🌿-ddump-rn-stats— renamer stats 📊-ddump-rn-trace— trace the renamer 🧵-ddump-rtti— trace runtime type inference 🧠-ddump-rule-firings— dump rule firing info 🎇-ddump-rule-rewrites— dump detailed rule firing info 🎆-ddump-rules— dump rewrite rules 📏-ddump-simpl— dump final simplifier output 🧼-ddump-simpl-iterations— dump output from each simplifier iteration 🔁-ddump-simpl-stats— dump simplifier stats 📈-ddump-simpl-trace— dump trace messages in the simplifier 🐾-ddump-spec— dump specialiser output 🎁-ddump-spec-constr— dump specialiser output from SpecConstr 🏗️-ddump-splices— dump TH spliced expressions, and what they evaluate to ✂️-ddump-static-argument-transformation— dump static argument transformation output 🧊-ddump-stg— deprecated, alias for-ddump-stg-from-core⚠️-ddump-stg-cg— show output after Stg2Stg 🧬-ddump-stg-final— show output of the last STG pass 🏁-ddump-stg-from-core— show CoreToStg output 🔄-ddump-stg-tags— show output of the tag inference pass 🏷️-ddump-stg-unarised— show unarised STG 🧩-ddump-str-signatures— deprecated, alias for-ddump-dmd-signatures🚫-ddump-stranal— deprecated, alias for-ddump-dmdanal🚫-ddump-tc— dump typechecker output 🔬-ddump-tc-ast— dump typechecker output as a syntax tree 🌳-ddump-tc-trace— trace the typechecker 🧪-ddump-ticked— dump the code instrumented by HPC (Observing Code Coverage) 🎟️-ddump-timings— dump per-pass timing and allocation statistics ⏱️-ddump-to-file— dump to files instead of stdout 📄-ddump-types— dump type signatures 🖊️-ddump-verbose-inlinings— dump all considered inlinings 🗣️-ddump-view-pattern-commoning— dump commoned view patterns 👀-ddump-worker-wrapper— dump worker-wrapper output 🛠️-dfaststring-stats— show statistics for fast string usage when finished 📉-dhex-word-literals— print values of typeWord#in hexadecimal 🔢-dinitial-unique=⟨s⟩— startUniqSupplyallocation from ⟨s⟩ 🎲-dinline-check=⟨str⟩— dump information about inlining decisions 🧐-dipe-stats— show statistics about IPE information 📋-dkeep-comments— include comments in the parser. Useful in combination with-ddump-parsed-ast💬-dlinear-core-lint— turn on internal sanity checking 🧹-dlint— enable several common internal sanity checkers 🩺-dno-debug-output— suppress unsolicited debugging output 🤫-dno-typeable-binds— don’t generate bindings forTypeablemethods 🚫-dppr-case-as-let— print single-alternative case expressions as strict lets 📦-dppr-cols=⟨n⟩— set the width of debugging output. For example-dppr-cols200📐-dppr-debug— turn on debug printing (more verbose) 🔍-dppr-user-length— set the depth for printing expressions in error msgs 📏-drule-check=⟨str⟩— dump information about potential rule application 📜-dshow-passes— print out each pass name as it happens 🎬-dstg-lint— STG pass sanity checking 🧼-dsuppress-all— in dumps, suppress everything (except for uniques) that is suppressible 🤐-dsuppress-coercion-types— suppress the printing of coercion types in Core dumps to make them shorter ✂️-dsuppress-coercions— suppress the printing of coercions in Core dumps to make them shorter 🪄-dsuppress-core-sizes— suppress the printing of core size stats per binding (since 9.4) 📉-dsuppress-idinfo— suppress extended information about identifiers where they are bound 🏷️-dsuppress-module-prefixes— suppress the printing of module qualification prefixes 🧽-dsuppress-stg-free-vars— suppress the printing of closure free variable lists in STG output 🆓-dsuppress-stg-reps— suppress rep annotations on STG args 🚫-dsuppress-ticks— suppress “ticks” in the pretty-printer output ✅-dsuppress-timestamps— suppress timestamps in dumps ⏳-dsuppress-type-applications— suppress type applications 🚫-dsuppress-type-signatures— suppress type signatures 🚫-dsuppress-unfoldings— suppress the printing of the stable unfolding of a variable at its binding site 📦-dsuppress-uniques— suppress the printing of uniques in debug output (easier to usediff) 🔢-dsuppress-var-kinds— suppress the printing of variable kinds 🚫-dtag-inference-checks— affirm tag inference results are correct at runtime ✅-dth-dec-file— dump evaluated TH declarations into*.th.hsfiles 📝-dunique-increment=⟨i⟩— set the increment for the generatedUnique’s to ⟨i⟩ 🔢-dverbose-core2core— show output from each core-to-core pass 🔄-dverbose-stg2stg— show output from each STG-to-STG pass 🔁-falignment-sanitisation— compile with alignment checks for all info table dereferences 🎯-fcatch-nonexhaustive-cases— add a default error alternative to case expressions without a default alternative 🚨-fcheck-prim-bounds— instrument array primops with bounds checks 🛑-fcmm-thread-sanitizer— enable ThreadSanitizer instrumentation of memory accesses 🧵-fdistinct-constructor-tables— generate a fresh info table for each usage of a data constructor 🆕-fdump-with-ways— include the tag of the enabled ways in the extension of dump files 🏷️-finfo-table-map— embed a lookup table in the generated binary which maps the address of an info table to the source position the closure originated from 🗺️-finfo-table-map-with-fallback— include info tables with no source location information in the info table map 🧩-finfo-table-map-with-stack— include info tables forSTACKclosures in the info table map 🥞-fllvm-fill-undef-with-garbage— instruct LLVM to fill dead STG registers with garbage 🗑️-fno-info-table-map-with-fallback— omit info tables with no source location information from the info table map 🚫-fno-info-table-map-with-stack— omit info tables forSTACKclosures from the info table map 🚫-forig-thunk-info— generatestg_orig_thunk_infostack frames on thunk entry 📚-fproc-alignment— align functions at the given boundary 📏-funoptimized-core-for-interpreter— disable optimizations with the interpreter 🛑<|place_holder_mm_span_0438|>-g— produce DWARF debug information in compiled object files. The optional ⟨n⟩ can be0,1, or2, with higher numbers producing richer output. If ⟨n⟩ is omitted, level2is assumed 🐛
💖 C pre-processor 💖
-cpp— run the C pre-processor on Haskell source files 🧪-D⟨symbol⟩[=⟨value⟩]— define a symbol in the C pre-processor 🏷️-I⟨dir⟩— add ⟨dir⟩ to the directory search list for#includefiles 📂-U⟨symbol⟩— undefine a symbol in the C pre-processor 🚫
🌸 Finding imports 🌸
-i— empty the import directory list 🧹-i⟨dir⟩[:⟨dir⟩]*— add ⟨dir⟩, ⟨dir2⟩, etc. to the import path 🛤️
🎀 Interactive mode 🎀
-fbreak-on-error— break on uncaught exceptions and errors 💥-fbreak-on-exception— break on any exception thrown 🚨-fbreak-points— insert breakpoints in the GHCi debugger 🛑-fghci-hist-size=⟨n⟩— set the number of entries GHCi keeps for:history. See The GHCi Debugger 📜-fghci-leak-check— (debugging only) check for space leaks when loading new modules in GHCi 🕵️-fimplicit-import-qualified— put in scope qualified identifiers for every loaded module 🏷️-flocal-ghci-history— use the current directory for the GHCi command history file.ghci-history📁-fno-it— no longer set the special variableit🚫-fprint-bind-result— turn on printing of binding results in GHCi 🖨️-fprint-evld-with-show— instruct:printto useShowinstances where possible 🎭-fshow-loaded-modules— show the names of modules that GHCi loaded after a:loadcommand 📦-ghci-script— read additional.ghcifiles 📜-ignore-dot-ghci— disable reading of.ghcifiles 🙅-interactive-print ⟨name⟩— select the function to use for printing evaluated expressions in GHCi 🖨️
🦋 Interface files 🦋
--show-iface ⟨file⟩— see Modes of operation 👀-ddump-hi— dump the new interface to stdout 📤-ddump-hi-diffs— show the differences vs. the old interface 🆚-ddump-minimal-imports— dump a minimal set of imports 📝
🎀 Keeping intermediate files 🎀
So GHC makes a bunch of lil temp files while it's compiling, and by default it yeets most of them into the void when it's done. These flags are your "no wait, keep that" buttons 💅
-keep-hc-file— keeps the intermediate.hcfiles around. Don't let them get deleted, bestie.-keep-hi-files— keeps the intermediate.hifiles. This one is already the default, so ✨ you're already slaying ✨.-keep-hscpp-file— keeps the intermediate.hscppfiles.-keep-llvm-file— keeps the intermediate LLVM.llfiles. Heads up: this one implies-fllvm, so it drags LLVM mode along with it 🫶.-keep-o-files— keeps the intermediate.ofiles. Also the default already, iconic behaviour honestly 👑.-keep-s-file— keeps the intermediate.sfiles.-keep-tmp-files— keeps all the intermediate temporary files. Like, all of them. The whole pile. No crumbs left behind 🍓.
✨ Language options ✨
Okay this is the big one — every single -X extension GHC knows about, and what it turns on. Scroll responsibly, there's like a hundred of them 😭
-XAllowAmbiguousTypes— lets you write ambiguous types, and lets the type inference engine go ahead and infer them too.-XApplicativeDo— turns on Applicative do-notation desugaring.-XArrows— turns on the arrow notation extension.-XBangPatterns— turns on bang patterns.-XBinaryLiterals— enables support for binary literals.-XBlockArguments— lets do blocks and other constructs be used as function arguments.-XCApiFFI— turns on the CAPI calling convention.-XConstrainedClassMethods— turns on constrained class methods. It's implied byMultiParamTypeClasses.-XConstraintKinds— enables a kind of constraints.-XCPP— turns on the C preprocessor.-XCUSKs— enables detection of complete user-supplied kind signatures.-XDataKinds— turns on datatype promotion.-XDatatypeContexts— allows contexts on data types.-XDeepSubsumption— turns on deep subsumption.-XDefaultSignatures— turns on default signatures.-XDeriveAnyClass— turns on deriving for any class.-XDeriveDataTypeable— turns on deriving for theDataclass.-XDeriveFoldable— turns on deriving for theFoldableclass. It's implied byDeriveTraversable.-XDeriveFunctor— turns on deriving for theFunctorclass. Also implied byDeriveTraversable.-XDeriveGeneric— turns on deriving for theGenericclass.-XDeriveLift— turns on deriving for theLiftclass.-XDeriveTraversable— turns on deriving for theTraversableclass. This one impliesDeriveFunctorandDeriveFoldable, so it's a whole package deal 💖.-XDerivingStrategies— enables deriving strategies.-XDerivingVia— lets you derive instances via types that have the same runtime representation. ImpliesDerivingStrategies.-XDisambiguateRecordFields— turns on record field disambiguation. It's implied byRecordWildCards.-XDuplicateRecordFields— lets you define record types that have fields with identical names. Chaos, but sanctioned ✨.-XEmptyCase— allows empty case alternatives.-XEmptyDataDecls— allows you to define empty data types.-XEmptyDataDeriving— allows deriving instances of standard type classes for empty data types.-XExistentialQuantification— enables liberalised type synonyms.-XExplicitForAll— turns on explicit universal quantification. Implied byScopedTypeVariables,LiberalTypeSynonyms,RankNTypesandExistentialQuantification.-XExplicitNamespaces— lets you use the keywordtypeto say which namespace an entry in an import or export belongs to (Explicit namespaces in import/export). Implied byTypeOperatorsandTypeFamilies.-XExtendedDefaultRules— uses GHCi's extended default rules inside a normal module.-XExtendedLiterals— turns on numeric literal postfix syntax for unboxed integers.-XFieldSelectors— controls the visibility of field selector functions.-XFlexibleContexts— removes some of the restrictions on class contexts.-XFlexibleInstances— turns on flexible instances. ImpliesTypeSynonymInstances.-XForeignFunctionInterface— turns on the foreign function interface.-XFunctionalDependencies— turns on functional dependencies. ImpliesMultiParamTypeClasses.-XGADTs— turns on generalised algebraic data types. ImpliesGADTSyntaxandMonoLocalBinds.-XGADTSyntax— turns on generalised algebraic data type syntax.-XGeneralisedNewtypeDeriving— turns on newtype deriving.-XGeneralizedNewtypeDeriving— turns on newtype deriving. (Yes, bestie, same thing, different spelling — both are real 💅)-XGHC2021— uses GHC's set of default language extensions from 2021.-XGHC2024— uses GHC's set of default language extensions from 2024.-XGHCForeignImportPrim— turns on theprimcalling convention. Intended for internal use only, so like... not your business, bestie 🙈.-XHaskell2010— uses the Haskell 2010 language edition.-XHaskell98— uses the Haskell 98 language edition.-XHexFloatLiterals— enables support for hexadecimal floating point literals.-XImplicitParams— turns on Implicit Parameters.-XImportQualifiedPost—ImportQualifiedPostallows the syntaximport M qualified.-XImpredicativeTypes— turns on impredicative types. ImpliesRankNTypes.-XIncoherentInstances— turns on incoherent instances. ImpliesOverlappingInstances.-XInstanceSigs— turns on instance signatures.-XInterruptibleFFI— turns on interruptible FFI.-XKindSignatures— turns on kind signatures. Implied byTypeFamiliesandPolyKinds.-XLambdaCase— turns on lambda-case expressions.-XLexicalNegation— uses whitespace to decide whether the minus sign means negation or subtraction. Whitespace, doing heavy lifting, we love to see it 😭.-XLiberalTypeSynonyms— enables liberalised type synonyms.-XLinearTypes— turns on linear types. ImpliesMonoLocalBinds.-XListTuplePuns— turns on punning for list, tuple and sum types.-XMagicHash— allows#as a postfix modifier on identifiers.-XMonadComprehensions— turns on monad comprehensions.-XMonoLocalBinds— enables "do not generalise local bindings". Implied byTypeFamiliesandGADTs.-XMultiParamTypeClasses— turns on multi parameter type classes. Implied byFunctionalDependencies. ImpliesConstrainedClassMethods.-XMultiWayIf— turns on multi-way if-expressions.-XNamedFieldPuns— turns on record puns.-XNamedWildCards— turns on named wildcards.-XNegativeLiterals— enables support for negative literals.-XNoImplicitPrelude— doesn't implicitly importPrelude. Implied byRebindableSyntax.-XNoMonomorphismRestriction— disables the monomorphism restriction.-XNondecreasingIndentation— allows nested contexts to sit at the same indentation level as their enclosing context.-XNoPatternGuards— disables pattern guards. Implied byHaskell98.-XNoTraditionalRecordSyntax— disables support for traditional record syntax (the kind Haskell 98 supports), likeC {f = x}.-XNPlusKPatterns— enables support for n+k patterns. Implied byHaskell98.-XNullaryTypeClasses— deprecated, and honestly it does nothing. Nullary (no parameter) type classes are now enabled usingMultiParamTypeClassesinstead. RIP to a real one 💀.-XNumDecimals— enables support for 'fractional' integer literals.-XNumericUnderscores— enables support for numeric underscores.-XOverlappingInstances— turns on overlapping instances.-XOverloadedLabels— turns on overloaded labels.-XOverloadedLists— turns on overloaded lists.-XOverloadedRecordDot— record.syntax.-XOverloadedRecordUpdate— record.syntax record updates.-XOverloadedStrings— enables overloaded string literals.-XPackageImports— enables package-qualified imports.-XParallelListComp— enables parallel list comprehensions.-XPartialTypeSignatures— enables partial type signatures.-XPatternSynonyms— enables pattern synonyms.-XPolyKinds— turns on kind polymorphism. ImpliesKindSignatures.-XPostfixOperators— enables postfix operators.-XQualifiedDo— turns on qualified do-notation desugaring.-XQuantifiedConstraints— allowsforallquantifiers inside constraints.-XQuasiQuotes— enables quasiquotation.-XRank2Types— turns on rank-2 types. It's a synonym forRankNTypes.-XRankNTypes— turns on rank-N types. Implied byImpredicativeTypes.-XRebindableSyntax— uses rebindable syntax. ImpliesNoImplicitPrelude.-XRecordWildCards— turns on record wildcards. ImpliesDisambiguateRecordFields.-XRecursiveDo— turns on recursive do (mdo) notation.-XRequiredTypeArguments— enables required type arguments in terms.-XRoleAnnotations— enables role annotations.-XSafe— turns on the Safe Haskell Safe mode.-XScopedTypeVariables— enables lexically-scoped type variables.-XStandaloneDeriving— enables standalone deriving.-XStandaloneKindSignatures— allows the use of standalone kind signatures.-XStarIsType— treats*asData.Kind.Type.-XStaticPointers— enables static pointers.-XStrict— makes bindings in the current module strict by default.-XStrictData— enables default strict datatype fields.-XTemplateHaskell— enables Template Haskell.-XTemplateHaskellQuotes— enables the quotation subset of Template Haskell.-XTransformListComp— enables generalised list comprehensions.-XTrustworthy— turns on the Safe Haskell Trustworthy mode.-XTupleSections— enables tuple sections.-XTypeAbstractions— enables type abstraction syntax in patterns and type variable binders.-XTypeApplications— enables type application syntax in terms and in types.-XTypeData— enables type data declarations.-XTypeFamilies— enables type families. ImpliesExplicitNamespaces,KindSignatures, andMonoLocalBinds— three for the price of one, we love an overachiever 💅.-XTypeFamilyDependencies— enables injective type families. ImpliesTypeFamilies.-XTypeInType— deprecated. Enables kind polymorphism and datatype promotion. (Use the shiny ones instead, bestie 🫶)-XTypeOperators— enables type operators. ImpliesExplicitNamespaces.-XTypeSynonymInstances— enables type synonyms in instance heads. Implied byFlexibleInstances.-XUnboxedSums— enables unboxed sums.-XUnboxedTuples— enables the use of unboxed tuple syntax.-XUndecidableInstances— enables undecidable instances.-XUndecidableSuperClasses— allows all superclass constraints, including the ones that might make the typechecker never terminate 😭.-XUnicodeSyntax— enables unicode syntax. 🌈✨-XUnliftedDatatypes— turns on unlifted data types ✨-XUnliftedFFITypes— turns on unlifted FFI types 💅-XUnliftedNewtypes— turns on unlifted newtypes 🎀-XUnsafe— turns on Safe Haskell Unsafe mode (yes bestie, it's literally called that, be careful) 💀-XViewPatterns— turns on view patterns 🦋
🔗 Linking options 🔗
okay this whole section is about how your thing actually gets linked together, iykyk 🫶
-c— stop after generating the object (.o) file — that's it, that's the whole job ✨-debug— use the debugging runtime 🐛-dylib-install-name⟨path⟩ — sets the install name (via-install_namepassed to Apple's linker), specifying the full install path of the library file. Any libraries or executables that link with it later will pick up that path as their runtime search location for it. (Darwin/OS X only) 🍓-dynamic— build dynamically-linked object files and executables 💫-dynload— selects one of a number of modes for finding shared libraries at runtime 🧚-eventlog— enable runtime event tracing 🔥-fcompact-unwind— instructs the linker to produce a__compact_unwindsection 🎀-fkeep-cafs— do not garbage-collect CAFs (top-level expressions) at runtime 🙈-flink-rts— link the runtime when generating a shared or static library 🔗-fno-embed-manifest— do not embed the manifest in the executable (Windows only) 🪟-fno-gen-manifest— do not generate a manifest file (Windows only) 🪟-fno-shared-implib— don't generate an import library for a DLL (Windows only) 🪟-framework⟨name⟩ — on Darwin/OS X/iOS only, links in the framework ⟨name⟩. This option corresponds to the-frameworkoption for Apple's Linker 🍎-framework-path⟨dir⟩ — on Darwin/OS X/iOS only, adds ⟨dir⟩ to the list of directories searched for frameworks. This option corresponds to the-Foption for Apple's Linker 🍎-fsplit-sections— split sections for link-time dead-code stripping ✂️-fuse-rpaths— set the rpath based on-Lflags 🛤️-fwhole-archive-hs-libs— when linking a binary executable, this inserts the flag-Wl,--whole-archivebefore any-lflags for Haskell libraries, and-Wl,--no-whole-archiveafterwards 👑-L⟨dir⟩ — adds ⟨dir⟩ to the list of directories searched for libraries 📁-l⟨lib⟩ — links in library ⟨lib⟩ 📚-main-is⟨thing⟩ — set main module and function ⭐-no-hs-main— don't assume this program containsmain🙅♀️-no-pie— don't instruct the linker to produce a position-independent executable 🚫-no-rtsopts-suggestions— don't print RTS suggestions about linking with-rtsopts[=⟨none|some|all|ignore|ignoreAll⟩]🤫-package⟨name⟩ — expose package ⟨pkg⟩ 📦-pie— instruct the linker to produce a position-independent executable 🥧-rdynamic— this instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. Currently Linux and Windows/MinGW32 only. This is equivalent to using-optl -rdynamicon Linux, and-optl -export-all-symbolson Windows 🐧-rtsopts[=⟨none|some|all|ignore|ignoreAll⟩]— controls whether the RTS behaviour can be tweaked via command-line flags and theGHCRTSenvironment variable. Usingnonemeans no RTS flags can be given;somemeans only a minimum of safe options can be given (the default);all(or no argument at all) means that all RTS flags are permitted;ignoremeans RTS flags can be given, but are treated as regular arguments and passed to the Haskell program as arguments;ignoreAllis the same asignore, butGHCRTSis also ignored.-rtsoptsdoes not affect-with-rtsoptsbehavior; flags passed via-with-rtsoptsare used regardless of-rtsopts💜-shared— generate a shared library (as opposed to an executable) 🫶-single-threaded— use the single-threaded runtime 1️⃣-static— use static Haskell libraries 🗿-staticlib— generate a standalone static library (as opposed to an executable). This is useful when cross compiling. The library together with all its dependencies ends up in in a single static library that can be linked against 📦-threaded— use the threaded runtime 🧵-with-rtsopts=⟨opts⟩ — set the default RTS options to ⟨opts⟩ ⚙️
🎀 Miscellaneous options 🎀
the grab-bag era 💅 everything that didn't fit anywhere else lives here, and honestly? iconic
-ddump-mod-cycles— dump module cycles 🔄-fdefer-out-of-scope-variables— convert variable out of scope variables errors into warnings. Implied by-fdefer-type-errors. See also-Wdeferred-out-of-scope-variables🌸-fdefer-type-errors— turn type errors into warnings, deferring the error until runtime. Implies-fdefer-typed-holesand-fdefer-out-of-scope-variables. See also-Wdeferred-type-errors😭-fdefer-typed-holes— convert typed hole errors into warnings, deferring the error until runtime. Implied by-fdefer-type-errors. See also-Wtyped-holes🕳️-fexternal-interpreter— run interpreted code in a separate process 🧚-ffamily-application-cache— use a cache when reducing type family applications 🗂️-fglasgow-exts— Deprecated. Enable most language extensions; see Controlling editions and extensions for exactly which ones 💀-fno-safe-haskell— disable Safe Haskell 🚫-ghcversion-file⟨path to ghcversion.h⟩ — (GHC as a C compiler only) use thisghcversion.hfile 🎀-H⟨size⟩ — set the minimum size of the heap to ⟨size⟩ 📈-hidden-module⟨module name⟩ — a module which should not be visible outside its unit 🙈-j[⟨n⟩]— when compiling with--make, compile ⟨n⟩ modules in parallel ⚡-jsem— when compiling with--make, coordinate with other processes through the semaphore ⟨sem⟩ to compile modules in parallel 🚦-reexported-module⟨module name⟩ — a module which should be reexported from this unit 🔁-this-package-name⟨unit-id⟩ — the name of the package which this module would be part of when installed 📦-unit @⟨filename⟩ — specify the options to build a specific unit 🧩-working-dir⟨dir⟩ — specify the directory a unit is expected to be compiled in 📂
🌈 Modes of operation 🌈
bestie this is the vibe check of what GHC is even doing right now — pick your main character mode 👑
--frontend⟨module⟩ — run GHC with the given frontend plugin; see Frontend plugins for details 🔌--help— display help 🆘--info— display information about the compiler ℹ️--interactive— interactive mode - normally used by just runningghci; see Using GHCi for details 💬--make— build a multi-module Haskell program, automatically figuring out dependencies. Likely to be much easier, and faster, than usingmake; see Usingghc --makefor details 🏗️--numeric-version— display GHC version (numeric only) 🔢--print-booter-version— display bootstrap compiler version 👢--print-build-platform— display platform on which GHC was built 🏗️--print-c-compiler-flags— C compiler flags used to build GHC 🅲--print-c-compiler-link-flags— C linker flags used to build GHC 🔗--print-debug-on— print whether GHC was built with-DDEBUG🐛--print-global-package-db— display GHC's global package database directory 🗄️--print-have-interpreter— display whether GHC was built with interactive support 💬--print-have-native-code-generator— display whether target platform has NCG support ⚙️--print-host-platform— display host platform of GHC 🖥️--print-ld-flags— display linker flags used to compile GHC 🚩--print-leading-underscore— display use of leading underscores on symbol names_--print-libdir— display GHC library directory 📁--print-object-splitting-supported— display whether GHC supports object splitting ✂️--print-project-git-commit-id— display Git commit id GHC is built from 🐙--print-project-version— display GHC version 🏷️--print-rts-ways— display which way RTS was built 🛠️--print-stage— display stage number of GHC 🎭--print-support-smp— display whether GHC was compiled with SMP support 🧵--print-tables-next-to-code— display whether GHC was compiled with--enable-tables-next-to-code📊--print-target-platform— display target platform of GHC 🎯--print-unregisterised— display whether this GHC was built in unregisterised mode 📝--run⟨file⟩ — run a Haskell program 🏃♀️--show-iface⟨file⟩ — display the contents of an interface file 📄--show-options— display the supported command line options 📋--supported-extensions— display the supported language extensions 🧩--version— display GHC version 🏷️-e⟨expr⟩ — evaluate expr; see Expression evaluation mode for details 🧮-M— generate dependency information suitable for use in a Makefile; see Dependency generation for details 📝-shared— create a shared object 🫶
✨ Individual optimizations ✨
okay so these are the little optimiser switches you can flip one by one instead of just screaming -O and hoping for the best 💅 most of them say "Implied by -O" which is basically the compiler going "don't worry bestie I got you" 🫶
-fasm-shortcutting— enable shortcutting on assembly. Implied by-O2⚡-fbinary-blob-threshold=⟨n⟩ — default:500K. Tweak assembly generator for binary blobs 🧱-fblock-layout-cfg— use the new cfg based block layout algorithm. Implied by-O🧩-fblock-layout-weightless— ignore cfg weights for code layout ⚖️-fblock-layout-weights— sets edge weights used by the new code layout algorithm 🏋️-fcall-arity— enable call-arity optimisation. Implied by-O📞-fcase-folding— enable constant folding in case expressions. Implied by-O🗂️-fcase-merge— enable case-merging. Implied by-O🔀-fcmm-control-flow— enable control flow optimisation in the Cmm backend. Implied by-O🌊-fcmm-elim-common-blocks— enable Cmm common block elimination. Implied by-O🧹-fcmm-sink— enable Cmm sinking. Implied by-O🚢-fcmm-static-pred— enable static control flow prediction. Implied by-O🔮-fcore-constant-folding— enable constant folding in Core. Implied by-O🧊-fcpr-anal— turn on Constructed Product Result analysis. Implied by-O🎁-fcross-module-specialise— turn on specialisation of overloaded functions imported from other modules. Implied by-O🔗-fcse— enable common sub-expression elimination. Implied by-O♻️-fdicts-cheap— make dictionary-valued expressions seem cheap to the optimiser 💸-fdicts-strict— make dictionaries strict. Implied by-O2📚-fdmd-tx-dict-sel— (deprecated 😬) use a special demand transformer for dictionary selectors.-fdmd-unbox-width=⟨n⟩— default is3. Boxity analysis lowkey pretends that returned records with this many fields can be unboxed ✨-fdo-clever-arg-eta-expansion— turn on sophisticated argument eta-expansion, bestie. Implied by-O💅-fdo-eta-reduction— enable eta-reduction. Always enabled by default, so it's already slaying 🎀-fdo-lambda-eta-expansion— enable lambda eta-expansion. Also always on by default ✨-feager-blackholing— turn on eager blackholing 🔥-fenable-rewrite-rules— switch on all rewrite rules (including rules generated by automatic specialisation of overloaded functions, iykyk). Implied by-O👑-fexcess-precision— enable excess intermediate precision 🎯-fexitification— enables the exitification optimisation. Implied by-O🌸-fexpose-all-unfoldings— expose all unfoldings, even for very large or recursive functions. No hiding, main character energy 🫶-ffloat-in— turn on the float-in transformation. Implied by-O🦋-ffull-laziness— turn on full laziness (floating bindings outwards). Implied by-O😴✨-ffun-to-thunk— (deprecated) superseded by-ffull-laziness💀-fignore-asserts— ignore assertions in the source. Implied by-O🙈-fignore-interface-pragmas— ignore pragmas in interface files. Implied by-O0only 🎀-finline-generics— annotate methods of derivedGenericandGeneric1instances withINLINE[1]pragmas based on heuristics. Implied by-O✨-finline-generics-aggressively— annotate methods of all derivedGenericandGeneric1instances withINLINE[1]pragmas. Go big or go home 🔥-finter-module-far-jumps— assume code sections can be very large 👀-fkeep-auto-rules— keep all "auto" rules, generated by specialisation 💖-flate-dmd-anal— run demand analysis again, at the end of the simplification pipeline 🔁-flate-specialise— run a late specialisation pass ⏰-fliberate-case— turn on the liberate-case transformation. Implied by-O2🕊️-fliberate-case-threshold=⟨n⟩— default is2000. Set the size threshold for the liberate-case transformation to ⟨n⟩ 📏-fllvm-pass-vectors-in-regs— (deprecated) does literally nothing 💀-flocal-float-out— enable local floating definitions out of let-binds 🦋-flocal-float-out-top-level— enable local floating to float top-level bindings ⬆️-floopification— turn saturated self-recursive tail-calls into local jumps in the generated assembly. Implied by-O🔄-fmax-forced-spec-args=⟨n⟩— default is333. Maximum number of value arguments for forcedSpecConstrspecializations 📚-fmax-inline-alloc-size=⟨n⟩— default is128. Set the maximum size of inline array allocations to ⟨n⟩ bytes (default:128) 🧮-fmax-inline-memcpy-insns=⟨n⟩— default is32. Inlinememcpycalls if they would generate no more than ⟨n⟩ pseudo instructions 📋-fmax-inline-memset-insns=⟨n⟩— default is32. Inlinememsetcalls if they would generate no more than ⟨n⟩ pseudo instructions 🧹-fmax-simplifier-iterations=⟨n⟩— default is4. Set the max iterations for the simplifier 🔁-fmax-uncovered-patterns=⟨n⟩— default is4. Set the maximum number of patterns to display in warnings about non-exhaustive ones 👀-fmax-worker-args=⟨n⟩— default is10. Maximum number of value arguments for a worker 💪-fno-opt-coercion— turn off the coercion optimiser 🚫-fno-pre-inlining— turn off pre-inlining 🚫-fno-state-hack— turn off the state hack whereby any lambda with a real-world state token as argument is considered to be single-entry. Hence OK to inline things inside it 🙅♀️-fomit-interface-pragmas— don't generate interface pragmas. Implied by-O0only 🎀-fomit-yields— omit heap checks when no allocation is being performed ✂️-foptimal-applicative-do— use a slower but better algorithm forApplicativeDo🐢✨-fpedantic-bottoms— make GHC be more precise about its treatment of bottom (but see also-fno-state-hack). In particular, GHC will not eta-expand through acaseexpression 🤓-fpolymorphic-specialisation— allow specialisation to abstract over free type variables 🌈-fregs-graph— use the graph colouring register allocator for register allocation in the native code generator 🎨-fregs-iterative— use the iterative coalescing graph colouring register allocator in the native code generator 🎨🔁-fsimpl-tick-factor=⟨n⟩— default is100. Set the percentage factor for simplifier ticks ⏱️-fsimplifier-phases=⟨n⟩— default is2. Set the number of phases for the simplifier. Ignored with-O0🌀-fsolve-constant-dicts— when solving constraints, try to eagerly solve super classes using available dictionaries. Implied by-O📖-fspec-constr— turn on theSpecConstrtransformation. Implied by-O2🔧-fspec-constr-count=⟨n⟩— default is3.*. Set to ⟨n⟩ the maximum number of specialisations that will be created for any one function by theSpecConstrtransformation 🔢-fspec-constr-keen— specialize a call with an explicit constructor argument, even if the argument is not scrutinised in the body of the function 👀🔥-fspec-constr-threshold=⟨n⟩— default is2000. Set the size threshold for theSpecConstrtransformation to ⟨n⟩ 📏-fspec-eval— enables speculative evaluation 🔮-fspec-eval-dictfun— enables speculative evaluation of dictionary functions 📚🔮-fspecialise— turn on specialisation of overloaded functions. Implied by-O✨-fspecialise-aggressively— turn on specialisation of overloaded functions regardless of size, if unfolding is available 😤🔥-fspecialise-incoherents— enable specialisation on incoherent instances 🌀-fstatic-argument-transformation— turn on the static argument transformation 🗿-fstg-cse— enable common sub-expression elimination on the STG intermediate language. Implied by-O✂️-fstg-lift-lams— enable late lambda lifting on the STG intermediate language. Implied by-O2🏋️-fstg-lift-lams-known— allow turning known into unknown calls while performing late lambda lifting 🤫-fstg-lift-lams-non-rec-args— create top-level non-recursive functions with at most<n>parameters while performing late lambda lifting 🧱-fstg-lift-lams-rec-args— create top-level recursive functions with at most<n>parameters while performing late lambda lifting 🔁-fstrictness— turn on demand analysis. Implied by-O. Implies-fworker-wrapper💪-fstrictness-before=⟨n⟩— run an additional demand analysis before simplifier phase ⟨n⟩ ⏰-funbox-small-strict-fields— flatten strict constructor fields with a pointer-sized representation. Implied by-O📦-funbox-strict-fields— flatten strict constructor fields 📦-funfolding-case-scaling=⟨n⟩— default is30. Apply a penalty of(inlining_cost * 1/n)for each level of case nesting 🪆-funfolding-case-threshold=⟨n⟩— default is2. Reduce inlining for cases nested deeper thann🪆-funfolding-creation-threshold=⟨n⟩— default is750. Tweak unfolding settings 🔧-funfolding-dict-discount=⟨n⟩— default is30. Tweak unfolding settings 🔧-funfolding-fun-discount=⟨n⟩— default is60. Tweak unfolding settings 🔧-funfolding-keeness-factor=⟨n⟩— this has been deprecated in GHC 9.0.1 💀-funfolding-use-threshold=⟨n⟩— default is80. Tweak unfolding settings 🔧-fworker-wrapper— enable the worker/wrapper transformation. Implied by-Oand by-fstrictness💪✨-fworker-wrapper-cbv— enable w/w splits for wrappers whos sole purpose is evaluating arguments 👑 (yes, "whos" — that's the manpage's spelling, not mine, bestie 🫶)
✨ Optimization levels ✨
okay so these are the vibe dials, from "chill" to "go absolutely feral" 🔥
-O— enable level 1 optimisations ✨-O0— disable optimisations (this is the default, so yeah, out of the box it's just vibing 😌)-O2— enable level 2 optimisations 🔥-O⟨n⟩— any-Onwheren > 2is the same as-O2. So like,-O99? literally just-O2with extra steps 💀
🎀 Package options 🎀
-clear-package-db— clear the package db stack 🧹-distrust ⟨pkg⟩— expose package ⟨pkg⟩ and set it to be distrusted. See Safe Haskell 🙅♀️-distrust-all-packages— distrust all packages by default. See Safe Haskell 🚨-fpackage-trust— enable Safe Haskell trusted package requirement for trustworthy modules 🛡️-global-package-db— add the global package db to the stack 🌍-hide-all-packages— hide all packages by default 🙈-hide-package ⟨pkg⟩— hide package ⟨pkg⟩ 🫣-ignore-package ⟨pkg⟩— ignore package ⟨pkg⟩ 🚫-no-auto-link-packages— don't automatically link in thebaseandrtspackages 🔗🚫-no-global-package-db— remove the global package db from the stack 🌍❌-no-user-package-db— remove the user's package db from the stack 👤❌-package ⟨pkg⟩— expose package ⟨pkg⟩ 👀✨-package-db ⟨file⟩— add ⟨file⟩ to the package db stack 📂-package-env ⟨file⟩|⟨name⟩— use the specified package environment 🌱-package-id ⟨unit-id⟩— expose package by id ⟨unit-id⟩ 🆔-this-unit-id ⟨unit-id⟩— compile to be part of unit (i.e. package) ⟨unit-id⟩ 📦-trust ⟨pkg⟩— expose package ⟨pkg⟩ and set it to be trusted. See Safe Haskell 🤝-user-package-db— add the user's package db to the stack 👤
🦋 Phases of compilation 🦋
like, where do you wanna stop the pipeline? pick your exit, bestie 🚪✨
--merge-objs— merge a set of objects into a GHCi library 📚-C— stop after generating C (.hcfile) 🛑-c— stop after generating object (.ofile) 🛑-E— stop after preprocessing (.hsppfile) 🛑-F— enable the use of a pre-processor (set with-pgmF ⟨cmd⟩) 🔧-S— stop after generating assembly (.sfile) 🛑-x ⟨suffix⟩— override default behaviour for source files 🏷️
💅 Overriding external programs 💅
you can literally just tell GHC which tool to use, main character energy 👑
-pgma ⟨cmd⟩— use ⟨cmd⟩ as the assembler 🔧-pgmc ⟨cmd⟩— use ⟨cmd⟩ as the C compiler 🔧-pgmCmmP ⟨cmd⟩— use ⟨cmd⟩ as the C-- C pre-processor 🔧-pgmcxx ⟨cmd⟩— use ⟨cmd⟩ as the C++ compiler 🔧-pgmF ⟨cmd⟩— use ⟨cmd⟩ as the pre-processor (with-Fonly) 🔧-pgmi ⟨cmd⟩— use ⟨cmd⟩ as the external interpreter command 🔧-pgminstall_name_tool⟨cmd⟩— bestie, this one says use⟨cmd⟩as the program that injects runpath into mach-o dylibs on macOS 🍎-pgmJSP⟨cmd⟩— use⟨cmd⟩as the JavaScript C pre-processor (this one's only for thejavascript-backend, okurrr)-pgmL⟨cmd⟩— use⟨cmd⟩as the literate pre-processor ✨-pgml⟨cmd⟩— use⟨cmd⟩as the linker. yes, lowercaseland capitalLare two completely different besties, don't mix them up 💀-pgmlas⟨cmd⟩— use⟨cmd⟩as the LLVM assembler-pgmlc⟨cmd⟩— use⟨cmd⟩as the LLVM compiler-pgmlm⟨cmd⟩— use⟨cmd⟩as the linker when merging object files-pgmlo⟨cmd⟩— use⟨cmd⟩as the LLVM optimiser-pgmotool⟨cmd⟩— use⟨cmd⟩as the program that inspects mach-o dylibs on macOS 👀-pgmP⟨cmd⟩— use⟨cmd⟩as the C pre-processor (only with-cpp, iykyk)-pgms⟨cmd⟩— use⟨cmd⟩as the splitter-pgmwindres⟨cmd⟩— use⟨cmd⟩as the program for embedding manifests on Windows 🪟
🎀 Phase-specific options 🎀
okay so these are the ones that feed extra flags to one specific stage of the pipeline. one ⟨option⟩ per bullet, no cap:
-opta⟨option⟩— pass⟨option⟩to the assembler-optc⟨option⟩— pass⟨option⟩to the C compiler-optCmmP⟨option⟩— pass⟨option⟩to the C-- C pre-processor.-optcxx⟨option⟩— pass⟨option⟩to the C++ compiler-optF⟨option⟩— pass⟨option⟩to the custom pre-processor-opti⟨option⟩— pass⟨option⟩to the interpreter sub-process.-optJSP⟨option⟩— pass⟨option⟩to the JavaScript C pre-processor (only forjavascript-backend)-optL⟨option⟩— pass⟨option⟩to the literate pre-processor-optl⟨option⟩— pass⟨option⟩to the linker-optlas⟨option⟩— pass⟨option⟩to the LLVM assembler-optlc⟨option⟩— pass⟨option⟩to the LLVM compiler-optlm⟨option⟩— pass⟨option⟩to the linker when merging object files.-optlo⟨option⟩— pass⟨option⟩to the LLVM optimiser-optP⟨option⟩— pass⟨option⟩tocpp(with-cpponly)-optwindres⟨option⟩— pass⟨option⟩towindres.-pgmc-supports-no-pie— (deprecated) indicate that the linker supports-no-pie-pgml-supports-no-pie— indicate that the linker supports-no-pie
🌈 Platform-specific options 🌈
these are the SIMD/CPU-flavoured ones. watch the platform tags bestie, some of them are x86-only 👑
-mavx— (x86 only) enable support for AVX SIMD extensions-mavx2— (x86 only) enable support for AVX2 SIMD extensions-mavx512cd— (x86 only) enable support for AVX512-CD SIMD extensions-mavx512er— (x86 only) enable support for AVX512-ER SIMD extensions-mavx512f— (x86 only) enable support for AVX512-F SIMD extensions-mavx512pf— (x86 only) enable support for AVX512-PF SIMD extensions-mbmi— (x86 only) use BMI1 for bit manipulation operations-mbmi2— (x86 only) use BMI2 for bit manipulation operations-mfma— use native FMA instructions for fused multiply-add floating-point operations-msse— (x86 only) use SSE for floating-point operations-msse2— (x86 only) use SSE2 for floating-point operations-msse3— (x86 only) use SSE3 for floating-point operations-msse4— (x86 only) use SSE4 for floating-point operations-msse4.2— (x86 only) use SSE4.2 for floating-point operations
🧚 Compiler plugins 🧚
yesss plugins, the main character energy of the build system 💅
-fclear-plugins— clear the list of active plugins-fplugin-library=⟨file-path⟩;⟨unit-id⟩;⟨module⟩;⟨args⟩— load a pre-compiled static plugin from an external library-fplugin-opt=⟨module⟩:⟨args⟩— give arguments to a plugin module; the module must be specified with-fplugin=⟨module⟩` (like, mandatory, not optional bestie)-fplugin-trustworthy— trust the plugins you're using and stop marking the compiled module as unsafe-fplugin=⟨module⟩— load a plugin exported by a given module-hide-all-plugin-packages— hide all packages for plugins by default-plugin-package⟨pkg⟩— expose⟨pkg⟩for plugins-plugin-package-id⟨pkg-id⟩— expose⟨pkg-id⟩for plugins
🔥 Profiling 🔥
time to find out where all your time is going, bestie 😭
-auto— (deprecated) alias for-fprof-auto-exported-auto-all— (deprecated) alias for-fprof-auto-caf-all— (deprecated) alias for-fprof-cafs-fno-prof-count-entries— do not collect entry counts-fprof-auto— auto-add SCCs to all bindings not markedINLINE-fprof-auto-calls— auto-add SCCs to all call sites-fprof-auto-exported— auto-add SCCs to all exported bindings not markedINLINE-fprof-auto-top— auto-add SCCs to all top-level bindings not markedINLINE-fprof-cafs— auto-add SCCs to all CAFs-fprof-callers=⟨name⟩— auto-add SCCs to all call-sites of the named function.-fprof-late— auto-add SCCs to all top level bindings after the core pipeline has run.-fprof-late-inline— auto-add SCCs to all top level bindings after the optimiser has run and retain them when inlining.-fprof-late-overloaded— auto-add SCCs to all top level overloaded bindings after the core pipeline has run.-fprof-late-overloaded-calls— auto-add SCCs to all call sites that include dictionary arguments after the core pipeline has run.-fprof-manual— process manual SCC annotations.-no-auto— (deprecated) alias for-fno-prof-auto-no-auto-all— (deprecated) alias for-fno-prof-auto-no-caf-all— (deprecated) alias for-fno-prof-cafs-prof— turn on profiling-ticky— turn on ticky-ticky profiling-ticky-allocd— track the number of times each closure type is allocated.-ticky-ap-thunk— don't use standard AP thunks, so you get more reliable entry counters.-ticky-dyn-thunk— track allocations of dynamic thunks-ticky-LNE— treat join point binders similar to thunks/functions.-ticky-tag-checks— emit dummy ticky counters to record how many tag-inference checks tag inference avoided.
🦋 Program coverage 🦋
-fhpc— turn on Haskell program coverage instrumentation-hpcdir⟨dir⟩— set the directory where GHC places.mixfiles.
⭐ Recompilation checking ⭐
the "why is it rebuilding AGAIN" section, we've all been there 💀
-exclude-module=⟨file⟩— regard⟨file⟩as "stable"; i.e., exclude it from having dependencies on it.-fforce-recomp— turn off recompilation checking. This is implied by any-ddump-Xoption when compiling a single file (i.e. when using-c).-fignore-hpc-changes— don't recompile modules just to match changes to HPC flags. This is especially useful for avoiding recompilation when using GHCi, and is enabled by default for GHCi.-fignore-optim-changes— don't recompile modules just to match changes to optimisation flags. This is especially useful for avoiding recompilation when using GHCi, and is enabled by default for GHCi.-include-cpp-deps— include preprocessor dependencies-include-pkg-deps— regard modules imported from packages as unstable
🌸 Redirecting output 🌸
where do the files GO, bestie 🎀
-dep-makefile⟨file⟩— use⟨file⟩as the makefile-dep-suffix⟨suffix⟩— make dependencies that declare that files with suffix.⟨suf⟩⟨osuf⟩depend on interface files with suffix.⟨suf⟩hi-dumpdir⟨dir⟩— redirect dump files-dynhisuf⟨suffix⟩— set the suffix to use for dynamic interface files-dyno⟨file⟩— set dynamic output filename-dynohi⟨file⟩— set the filename in which to put the dynamic interface-dynosuf⟨suffix⟩— set the dynamic output file suffix-hcsuf⟨suffix⟩— set the suffix to use for intermediate C files-hidir⟨dir⟩— set directory for interface files-hiedir⟨dir⟩— set directory for extended interface files-hiesuf⟨suffix⟩— set the suffix to use for extended interface files-hisuf⟨suffix⟩— set the suffix to use for interface files-o⟨file⟩— set output filename-odir⟨dir⟩— set directory for object files-ohi⟨file⟩— set the filename in which to put the interface-osuf⟨suffix⟩— set the output file suffix-outputdir⟨dir⟩— set output directory-stubdir⟨dir⟩— redirect FFI stub files
🍓 Temporary files 🍓
-tmpdir⟨dir⟩— set the directory for temporary files
💜 Verbosity options 💜
the talking-to-you options. diagnostics, hole fits, colours, all of it ✨
-fabstract-refinement-hole-fits— default: off. Toggles whether refinements where one or more of the holes are abstract are reported.-fdefer-diagnostics— defer and group diagnostic messages by severity-fdiagnostics-as-json— output diagnostics in Json format specified by JSON schema-fdiagnostics-color=⟨always|auto|never⟩— use colors in error messages-fdiagnostics-show-caret— whether to show snippets of original source code-ferror-spans— output full span in error messages-fhide-source-paths— hide module source and object paths-fkeep-going— continue compilation as far as possible on errors-fmax-refinement-hole-fits=⟨n⟩— default: 6. Set the maximum number of refinement hole fits for typed holes to display in type error messages.-fmax-relevant-binds=⟨n⟩— default: 6. Set the maximum number of bindings to display in type error messages.-fmax-valid-hole-fits=⟨n⟩— default: 6. Set the maximum number of valid hole fits for typed holes to display in type error messages.-fno-show-valid-hole-fits— disables showing a list of valid hole fits for typed holes in type error messages.-fno-sort-valid-hole-fits— disables the sorting of the list of valid hole fits for typed holes in type error messages.-fprint-axiom-incomps— display equation incompatibilities in closed type families-fprint-equality-relations— distinguish between equality relations when printing-fprint-error-index-links=⟨always|auto|never⟩— whether to emit diagnostic codes as ANSI hyperlinks to the Haskell Error Index.-fprint-expanded-synonyms— in type errors, also print type-synonym-expanded types.-fprint-explicit-coercions— print coercions in types-fprint-explicit-foralls— print explicitforallquantification in types. See alsoExplicitForAll-fprint-explicit-kinds— makes GHC print the kind foralls and the kind arguments in types, out loud, no hiding 💅 peep theKindSignaturesextension too while you're at it-fprint-explicit-runtime-reps— prints thoseRuntimeRepandLevityvariables in types that are runtime-representation polymorphic, so you actually see them instead of vibing in silence 🦋-fprint-potential-instances— type error messages get the full guest list: every available instance shows up ✨-fprint-redundant-promotion-ticks— prints theDataKindspromotion ticks that are, honestly, redundant 🙈-fprint-typechecker-elaboration— spills the extra tea from the typechecker, all the bonus info 🍓-fprint-unicode-syntax— prints expressions, types and kinds in unicode syntax, so pretty 🎀 also seeUnicodeSyntax-frefinement-level-hole-fits=⟨n⟩— default: off. Sets how deep the refinement hole fits go, where level n means hole fits of up to n holes get considered 🔍-freverse-errors— outputs your errors in reverse order, back-to-front era 💀-fshow-docs-of-hole-fits— toggles whether the docs of the valid hole fits get shown in the output 📖-fshow-error-context— whether to show that textual info about the error context-fshow-hole-constraints— shows the constraints when it's reporting typed holes 🕳️-fshow-hole-matches-of-hole-fits— toggles showing the type of the extra holes in refinement hole fits-fshow-provenance-of-hole-fits— toggles showing where each valid hole fit came from, its provenance ✨-fshow-type-app-of-hole-fits— toggles showing the type application of the valid hole fits-fshow-type-app-vars-of-hole-fits— toggles showing what type each quantified variable takes in a valid hole fit 👑-fshow-type-of-hole-fits— toggles showing the type of the valid hole fits-fsort-by-size-hole-fits— sorts valid hole fits by size, smallest first energy 🧚-fsort-by-subsumption-hole-fits— sorts valid hole fits by subsumption-funclutter-valid-hole-fits— unclutters the valid hole fits list by not showing provenance and not showing type applications of the suggestions. clean girl aesthetic 🎀-Rghc-timing— summarises timing stats for GHC, same as+RTS -tstderr⏱️-v— verbose mode, literally equivalent to-v3🗣️-v⟨n⟩— sets the verbosity level, you pick the n, main character energy
⚠️ Warnings ⚠️
-fenable-th-splice-warnings— generates warnings for Template Haskell splices 🌀-fhelpful-errors— makes suggestions when you mis-spell a name, bestie GHC catching your typos 🫶-fmax-pmcheck-models=⟨n⟩— soft limit on how many parallel models the pattern match checker should check a pattern match clause against-fshow-warning-groups— shows which group an emitted warning belongs to 🏷️-fvia-C— use the C code generator-W— enable normal warnings ✨-w— disable all warnings, silence is golden 💅-Wall— enable almost all warnings (details live in Warnings and sanity-checking) 🔥-Wall-missed-specialisations— warn when specialisation of any overloaded function fails-Wall-missed-specializations— alias for-Wall-missed-specialisations😌-Wambiguous-fields— warn about ambiguous field selectors or updates-Wauto-orphans— (deprecated) does nothing 🫠-Wbadly-staged-types— warn when a type binding is used at the wrong TH stage-Wcompat— enable future compatibility warnings (details in Warnings and sanity-checking) 🔮-Wcompat-unqualified-imports— reports unqualified imports of core libraries that are expected to cause compatibility problems in future releases-Wcpp-undef— warn on uses of the#ifdirective on undefined identifiers-Wdata-kinds-tc— warn when an illegal use of a type or kind withoutDataKindsgets caught by the typechecker-Wdefault— enable default flags-Wdefaulted-exception-context— warn when aControl.Exception.Context.ExceptionContextimplicit parameter gets defaulted toControl.Exception.Context.emptyExceptionContext🚨-Wdeferred-out-of-scope-variables— reports warnings when variable out-of-scope errors get deferred until runtime. see-fdefer-out-of-scope-variables👀-Wdeferred-type-errors— reports warnings when deferred type errors are enabled. this one is enabled by default, see-fdefer-type-errors-Wdeprecated-flags— warn about uses of commandline flags that are deprecated 🪦-Wdeprecated-type-abstractions— warn when type abstractions in constructor patterns get used without enablingTypeApplications-Wdeprecations— warn about uses of functions & types that haveDEPRECATEDpragmas, orWARNINGpragmas with the deprecated category-Wderiving-defaults— warn about default deriving when using bothDeriveAnyClassandGeneralizedNewtypeDeriving-Wderiving-typeable— warn whenTypeableis derived-Wdodgy-exports— warn about dodgy exports 🕵️-Wdodgy-foreign-imports— warn about dodgy foreign imports-Wdodgy-imports— warn about dodgy imports-Wduplicate-constraints— warn when a constraint appears duplicated in a type signature 👯-Wduplicate-exports— warn when an entity is exported multiple times-Wempty-enumerations— warn about enumerations that are empty 🫙-Werror— make warnings fatal, boom, no mercy 💀-Weverything— enable all warnings supported by GHC, the whole buffet 👑-Wextended-warnings— warn about uses of functions & types that haveWARNINGorDEPRECATEDpragmas, across all categories-Wextra— alias for-W-Wforall-identifier— (deprecated) does nothing 🫠-Wgadt-mono-local-binds— warn when pattern matching on a GADT withoutMonoLocalBinds-Whi-shadowing— (deprecated) warn when a.hifile in the current directory shadows a library-Widentities— warn about uses ofPreludenumeric conversions that are probably the identity (and hence could be omitted) 💅-Wimplicit-kind-vars— (deprecated) warn when kind variables are implicitly quantified over-Wimplicit-lift— warn about implicit lift in Template Haskell quotes 🪄-Wimplicit-prelude— warn when thePreludeis implicitly imported-Wimplicit-rhs-quantification— warn when type variables on the RHS of a type synonym are implicitly quantified-Winaccessible-code— warn about inaccessible code 🚪-Wincomplete-export-warnings— warn when some but not all of exports for a name are warned about-Wincomplete-patterns— warn when a pattern match could fail, the classic 😭-Wincomplete-record-selectors— warn when a record selector application could fail-Wincomplete-record-updates— warn when a record update could fail-Wincomplete-uni-patterns— warn when a pattern match in a lambda expression, pattern binding or a lazy pattern could fail-Winconsistent-flags— warn when command line options are inconsistent in some way-Winferred-safe-imports— warn when an explicitly Safe Haskell module imports a Safe-Inferred one-Winline-rule-shadowing— warns if a rewriteRULEmight fail to fire because the function might get inlined before the rule has a chance to fire. see How rules interact with INLINE/NOINLINE pragmas 🥷-Winvalid-haddock— warn when a Haddock comment occurs in an invalid position-Wloopy-superclass-solve— (deprecated) warn when creating potentially-loopy superclass constraint evidence 🌀-Wmisplaced-pragmas— warn about uses of file header pragmas in the module body-Wmissed-extra-shared-lib— warns when GHCi can't load a shared lib 😬-Wmissed-specialisations— warn when specialisation of an imported, overloaded function fails-Wmissed-specializations— alias for-Wmissed-specialisations-Wmissing-deriving-strategies— warn when aderivingclause is missing a deriving strategy-Wmissing-export-lists— warn when a module declaration doesn't explicitly list all exports-Wmissing-exported-pattern-synonym-signatures— warn about pattern synonyms without signatures, only if they're exported-Wmissing-exported-signatures— warn about top-level functions without signatures, only if they're exported-Wmissing-exported-sigs— (deprecated) warn about top-level functions without signatures, only if they're exported. takes precedence over-Wmissing-signatures👑-Wmissing-fields— warn when fields of a record are uninitialised-Wmissing-home-modules— warn when it encounters a home module imported but not listed on the command line. super useful for cabal, so it can ensure GHC won't pick up modules that are listed neither inexposed-modulesnor inother-modules🏠-Wmissing-import-lists— warn when an import declaration doesn't explicitly list all the names brought into scope-Wmissing-kind-signatures— warn when type declarations don't have kind signatures nor CUSKs-Wmissing-local-signatures— warn about polymorphic local bindings without signatures-Wmissing-local-sigs— (deprecated) warn about polymorphic local bindings without signatures-Wmissing-methods— warn when class methods are undefined-Wmissing-monadfail-instances— (deprecated) warns when a failable pattern is used in a do-block that doesn't have aMonadFailinstance-Wmissing-pattern-synonym-signatures— warn when pattern synonyms don't have type signatures-Wmissing-poly-kind-signatures— warn when inferred polykinded type or class declarations don't have kind signatures nor CUSKs-Wmissing-role-annotations— warn when type declarations don't have role annotations 🎭-Wmissing-safe-haskell-mode— warn when the Safe Haskell mode isn't explicitly specified-Wmissing-signatures— warn about top-level functions without signatures-Wmissing-space-after-bang— (deprecated) does nothing 🫠-Wmonomorphism-restriction— warn when the Monomorphism Restriction gets applied-Wname-shadowing— warn when names get shadowed 👥-Wnoncanonical-monad-instances— warn whenApplicativeorMonadinstances have noncanonical definitions ofreturn,pure,(>>), or(*>). see the flag description in Warnings and sanity-checking for more deets 🌸-Wnoncanonical-monadfail-instances— (deprecated btw 🙈) yells at you when yourMonadorMonadFailinstances definefailin a noncanonical way.-Wnoncanonical-monoid-instances— warns you whenSemigrouporMonoidinstances have noncanonical definitions of(<>)ormappend. Peep the flag description over in "Warnings and sanity-checking" for the whole lore ✨-Wnot— (deprecated, rip 💀) literally just an alias for-w.-Woperator-whitespace— warns on prefix, suffix, and tight infix uses of infix operators 👀-Woperator-whitespace-ext-conflict— warns on infix operator uses that would parse differently if a particular GHC extension were on. Sneaky parse drama, we love to see it.-Worphans— warns when the module has orphan instance declarations or rewrite rules 🫶-Woverflowed-literals— warns about literals that will overflow their type. your number is too big bestie 😭-Woverlapping-patterns— warns about overlapping patterns.-Wpartial-fields— warns when you're defining a partial record field.-Wpartial-type-signatures— warns about holes in partial type signatures whenPartialTypeSignaturesis enabled. Not applicable whenPartialTypeSignaturesis not enabled — in that case those holes just get errors generated for them instead. no warning era, error era 💅-Wprepositive-qualified-module— reports imports with a leading/prepositive"qualified".-Wredundant-bang-patterns— warns about redundant bang patterns.-Wredundant-constraints— makes the compiler warn about redundant constraints in type signatures. yes king you can delete that constraint ✨-Wredundant-record-wildcards— warns about record wildcard matches when the wildcard binds no patterns at all.-Wredundant-strictness-flags— warns about redundant strictness flags.-Wsafe— warns if the module being compiled is regarded to be safe.-Wsemigroup— (deprecated 🥀) warns when aMonoidis not aSemigroup, and on non-Semigroupdefinitions of(<>).
care & accuracy notice, bestie: the flag in the original is written there exactly as (<>) in the wild — keep your eyes peeled and refer to the "Warnings and sanity-checking" flag description for the real tea.
-Wsimplifiable-class-constraints— warns about class constraints in a type signature that could be simplified using a top-level instance declaration. you did too much, it's giving try-hard 😌-Wstar-binder— warns about binding the(*)type operator despiteStarIsType.-Wstar-is-type— warns when*is used to meanData.Kind.Type.-Wtabs— warns if there are tabs in the source file. spaces girlies stay winning 🌸-Wterm-variable-capture— warns when an implicitly quantified type variable captures a term's name 👻-Wtrustworthy-safe— warns if the module being compiled is marked asTrustworthybut it could actually be marked asSafeinstead, which is a more informative bound. glow-up available, take it 👑-Wtype-defaults— warns when defaulting happens.-Wtype-equality-out-of-scope— warns when type equalitya ~ bis used despite being out of scope.-Wtype-equality-requires-operators— warns when type equalitya ~ bis used despite being out of scope.-Wtyped-holes— reports warnings when typed hole errors are deferred until runtime. see-fdefer-typed-holesfor the deets 🕳️-Wunbanged-strict-patterns— warns on a pattern bind of an unlifted variable that is neither bare nor banged.-Wunicode-bidirectional-format-characters— warns about the usage of unicode bidirectional layout override characters. sneaky invisible chaos, not the cute kind 😭-Wunrecognised-pragmas— warns about uses of pragmas that GHC doesn't recognise.-Wunrecognised-warning-flags— throws a warning when an unrecognised-W...flag is encountered on the command line. flag said "who?" 💀-Wunsafe— warns if the module being compiled is regarded to be unsafe. peep "Safe Haskell" for more.-Wunsupported-calling-conventions— warns about use of an unsupported calling convention.-Wunsupported-llvm-version— warns when using-fllvmwith an unsupported version of LLVM.-Wunticked-promoted-constructors— warns if promoted constructors are not ticked.-Wunused-binds— warns about bindings that are unused. literally an alias for-Wunused-top-binds,-Wunused-local-bindsand-Wunused-pattern-binds🫶-Wunused-do-bind— warns aboutdobindings that appear to throw away values of types other than().-Wunused-foralls— warns about type variables in user-writtenforalls that are unused.-Wunused-imports— warns about unnecessary imports. declutter era ✨-Wunused-local-binds— warns about local bindings that are unused.-Wunused-matches— warns about variables in patterns that aren't used.-Wunused-packages— warns when a package is requested on the command line, but it isn't needed.-Wunused-pattern-binds— warns about pattern match bindings that are unused.-Wunused-record-wildcards— warns about record wildcard matches when none of the bound variables are used.-Wunused-top-binds— warns about top-level bindings that are unused.-Wunused-type-patterns— warns about unused type variables which arise from patterns in type family and data family instances.-Wwarn— makes warnings non-fatal. they're just lil guys 🥺-Wwarnings-deprecations— warns about uses of functions & types that haveDEPRECATEDpragmas, orWARNINGpragmas with the deprecated category. alias for-Wdeprecations💜-Wwrong-do-bind— warns aboutdobindings that appear to throw away monadic values that you should have bound instead. bestie. you dropped it. pick it up 😤-Wx-⟨category⟩— warns about uses of functions & types that haveWARNINGpragmas with the given category.
💖 COPYRIGHT 💖
Copyright 2015. The University Court of the University of Glasgow. All rights reserved. 🏛️✨
🌈 SEE ALSO 🌈
https://www.haskell.org/ghc — the GHC homepage, go touch grass with the docs bestie 🌱
👑 AUTHOR 👑
The GHC Team 🫶 (icons, honestly)
🎀 COPYRIGHT 🎀
2025, GHC Team 💅
and that's the whole page, babe!! you read all of it, main character energy fr fr 🔥 this was GHC(1) from GHC 9.10.3, dated Sep 11, 2025 — go compile something iconic ✨💖🦋
📦 where this page comes from
- epel 10: ghc9.10-compiler 9.10.3-11.el10_2 · BSD-3-Clause
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms