GHC(1)
🦋 GHC(1) — the Glasgow Haskell Compiler 🦋
okay so this is the manual page for GHC(1), the Glasgow Haskell Compiler, and bestie, we are going to get through it together 💅✨
💖 NAME 💖
ghc — the Glasgow Haskell Compiler. that's her. that's the whole name. iconic, no notes 🎀
🌈 SYNOPSIS 🌈
ghc [option|filename]
ghci [option|filename]
🌸 DESCRIPTION 🌸
okay so real talk: this manual page documents briefly the ghc and ghci commands. and yes — heads up — ghci is not yet available on all architectures 🫶 like she's still rolling out, we love a soft launch.
the extensive documentation lives in various other formats, and the URLs are exactly these:
- PDF:
https://downloads.haskell.org/ghc/latest/docs/users_guide.pdf - HTML:
https://downloads.haskell.org/ghc/latest/docs/html/
🧚 static vs dynamic flags (the lore) 🧚
every single one of GHC's command line options is classified as either static or dynamic, and this distinction is lowkey important so pay attention bestie:
- a static flag may only be specified on the command line
- a dynamic flag may also be given in an
OPTIONSpragma in a source file, or be 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 section lists the status of each flag, so if you're ever like "wait is this one static" — check there, iykyk 👑
🍓 common suffixes of file names for Haskell 🍓
.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:
(and yeah, the list of ways for _hi just… stops there in the original. that's not me being lazy, that's the page 💀)
✨ OPTIONS ✨
bestie. buckle in. this is the part where the page becomes a phone book 📖💀
🔥 Code generation
-dynamic-too-fasm-fllvm-fbyte-code-fexpose-internal-symbols-fexternal-dynamic-refs-fllvm-fasm-fno-code-fobject-code-fPIC-fPIE-fwrite-interface-split-objs
and yes, -fllvm and -fasm show up twice in that list. not a typo on my end, that's literally the original being extra 🫠
💀 Debugging the compiler
okay this next list is giving "someone dumped the entire internals" and honestly? we're obsessed. here we go, in order, no skipping, periodt:
-dasm-lint-dcmm-lint-dcore-lint-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-verbose-ddump-cmm-verbose-by-proc-ddump-core-stats-ddump-cpr-signatures-ddump-cpranal-ddump-cs-trace-ddump-cse-ddump-debug-ddump-deriv-ddump-ds-ddump-ds-preopt-ddump-ec-trace-ddump-exitify-ddump-faststrings-ddump-file-prefix=⟨str⟩-ddump-foreign-ddump-hie-ddump-hpc-ddump-if-trace-ddump-inlinings-ddump-json-ddump-late-cc-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-splices-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⟩-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-fdistinct-constructor-tables-finfo-table-map-fllvm-fill-undef-with-garbage-fproc-alignment-g-g⟨n⟩
we ate that. mostly by copy-pasting energy, but we ate 💅
🎀 C pre-processor
-cpp-D⟨symbol⟩[=⟨value⟩]-U⟨symbol⟩-I⟨dir⟩-U⟨symbol⟩
note that -U⟨symbol⟩ is listed twice in the original too — she's just thorough like that 🙈
🦋 Finding imports
-i-i⟨dir⟩[:⟨dir⟩]*
💜 Interactive mode
-fbreak-on-error-fno-break-on-error-fbreak-on-exception-fno-break-on-exception-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⟩
the -fno-it / -fno-no-it pairing is genuinely sending me 😭 like yes queen double negative
⭐ 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 -X list. it's giving "every extension GHC has ever had a thought about". all dynamic by the way, per the rule of thumb up top 💚
-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-XFieldSelectors-XFlexibleContexts-XFlexibleInstances-XForeignFunctionInterface-XFunctionalDependencies-XGADTs-XGADTSyntax-XGeneralisedNewtypeDeriving-XGeneralizedNewtypeDeriving-XGHC2021-XGHCForeignImportPrim-XHaskell2010-XHaskell98-XHexFloatLiterals-XImplicitParams-XImportQualifiedPost-XImpredicativeTypes-XIncoherentInstances-XInstanceSigs-XInterruptibleFFI-XKindSignatures-XLambdaCase-XLexicalNegation-XLiberalTypeSynonyms-XLinearTypes-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-XRoleAnnotations-XSafe-XScopedTypeVariables-XStandaloneDeriving-XStandaloneKindSignatures-XStarIsType-XStaticPointers-XStrict-XStrictData-XTemplateHaskell-XTemplateHaskellQuotes-XTransformListComp-XTrustworthy-XTupleSections-XTypeApplications-XTypeFamilies-XTypeFamilyDependencies-XTypeInType-XTypeOperators-XTypeSynonymInstances-XUnboxedSums-XUnboxedTuples-XUndecidableInstances-XUndecidableSuperClasses-XUnicodeSyntax-XUnliftedDatatypes-XUnliftedFFITypes-XUnliftedNewtypes-XUnsafe-XViewPatterns
she's long, she's thorough, she's mother 🧚💜
🔗 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⟩-fuse-rpaths-fwhole-archive-hs-libs-L ⟨dir⟩-l ⟨lib⟩-main-is ⟨thing⟩-no-hs-main-no-link-no-pie-pie-no-rtsopts-suggestions-package ⟨name⟩-pie-no-pie-rdynamic-rtsopts[=⟨none|some|all|ignore|ignoreAll⟩]-shared-split-sections-static-staticlib-threaded-with-rtsopts=⟨opts⟩
yeah -pie and -no-pie are both in there twice. the original said what it said, we don't edit 👀
🫶 Miscellaneous options
-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⟩]-reexported-module ⟨module name⟩-this-package-name ⟨unit-id⟩-unit @⟨filename⟩-working-dir ⟨dir⟩
miscellaneous is literally the "and friends" of flag categories, we love a grab bag 💅
🎀 Modes of operation
--frontend ⟨module⟩--help-?--info--interactive--make--numeric-version--print-booter-version--print-build-platform--print-c-compiler-flags--print-c-compiler-link-flags--print-debug-on--print-global-package-db--print-have-interpreter--print-have-native-code-generator--print-host-platform--print-ld-flags--print-leading-underscore--print-libdir--print-object-splitting-supported--print-project-git-commit-id--print-project-version--print-rts-ways--print-stage--print-support-smp--print-tables-next-to-code--print-target-platform--print-unregisterised--run ⟨file⟩--show-iface ⟨file⟩--show-options--supported-extensions--supported-languages--version-V-e ⟨expr⟩-M-shared
and that's where this part lands — there's so much more coming, bestie, we're only like one ninth of the way through this thing 💖✨
🔥 Individual optimizations 🔥
okay bestie, buckle up, because this is the mother lode — every single -f toggle in the individual-optimizations family, dumped exactly as the page gives them. Every one of these is a real flag, every = takes an argument where it says ⟨n⟩, and yes, some of them only show up in the -fno- form and some only show up in the positive form. That's just how the list is. No cap. 🫶
-fasm-shortcutting -fno-asm-shortcutting
-fbinary-blob-threshold=⟨n⟩ -fblock-layout-cfg
-fno-block-layout-cfg -fblock-layout-weightless
-fno-block-layout-weightless -fblock-layout-weights -fcall-arity
-fno-call-arity -fcase-folding -fno-case-folding -fcase-merge
-fno-case-merge -fcmm-control-flow -fno-cmm-control-flow
-fcmm-elim-common-blocks -fno-cmm-elim-common-blocks -fcmm-sink
-fno-cmm-sink -fcmm-static-pred -fno-cmm-static-pred
-fcore-constant-folding -fno-core-constant-folding -fcpr-anal
-fno-cpr-anal -fcross-module-specialise
-fno-cross-module-specialise -fcse -fno-cse -fdicts-cheap
-fno-dicts-cheap -fdicts-strict -fno-dicts-strict
-fdmd-tx-dict-sel -fno-dmd-tx-dict-sel -fdmd-unbox-width=⟨n⟩
-fdo-eta-reduction -fno-do-eta-reduction
-fdo-lambda-eta-expansion -fno-do-lambda-eta-expansion
-feager-blackholing -fenable-rewrite-rules
-fno-enable-rewrite-rules -fexcess-precision
-fno-excess-precision -fexitification -fno-exitification
-fexpose-all-unfoldings -fno-expose-all-unfoldings -ffloat-in
-fno-float-in -ffull-laziness -fno-full-laziness -ffun-to-thunk
-fno-fun-to-thunk -fignore-asserts -fno-ignore-asserts
-fignore-interface-pragmas -fno-ignore-interface-pragmas
-finline-generics -fno-inline-generics
-finline-generics-aggressively -fno-inline-generics-aggressively
-flate-dmd-anal -fno-late-dmd-anal -flate-specialise
-fno-late-specialise -fliberate-case -fno-liberate-case
-fliberate-case-threshold=⟨n⟩ -fno-liberate-case-threshold
-fllvm-pass-vectors-in-regs -floopification -fno-loopification
-fmax-inline-alloc-size=⟨n⟩ -fmax-inline-memcpy-insns=⟨n⟩
-fmax-inline-memset-insns=⟨n⟩ -fmax-simplifier-iterations=⟨n⟩
-fmax-uncovered-patterns=⟨n⟩ -fmax-worker-args=⟨n⟩
-fno-opt-coercion -fno-pre-inlining -fno-state-hack
-fomit-interface-pragmas -fno-omit-interface-pragmas
-fomit-yields -fno-omit-yields -foptimal-applicative-do
-fno-optimal-applicative-do -fpedantic-bottoms
-fno-pedantic-bottoms -fregs-graph -fno-regs-graph
-fregs-iterative -fno-regs-iterative -fsimpl-tick-factor=⟨n⟩
-fsimplifier-phases=⟨n⟩ -fsolve-constant-dicts
-fno-solve-constant-dicts -fspec-constr -fno-spec-constr
-fspec-constr-count=⟨n⟩ -fno-spec-constr-count -fspec-constr-keen
-fno-spec-constr-keen -fspec-constr-threshold=⟨n⟩
-fno-spec-constr-threshold -fspecialise -fno-specialise
-fspecialise-aggressively -fno-specialise-aggressively
-fstatic-argument-transformation
-fno-static-argument-transformation -fstg-cse -fno-stg-cse
-fstg-lift-lams -fno-stg-lift-lams -fstg-lift-lams-known
-fno-stg-lift-lams-known -fstg-lift-lams-non-rec-args
-fstg-lift-lams-non-rec-args-any -fstg-lift-lams-rec-args
-fstg-lift-lams-rec-args-any -fstrictness -fno-strictness
-fstrictness-before=⟨n⟩ -funbox-small-strict-fields
-fno-unbox-small-strict-fields -funbox-strict-fields
-fno-unbox-strict-fields -funfolding-case-scaling=⟨n⟩
-funfolding-case-threshold=⟨n⟩ -funfolding-creation-threshold=⟨n⟩
-funfolding-dict-discount=⟨n⟩ -funfolding-fun-discount=⟨n⟩
-funfolding-keeness-factor=⟨n⟩ -funfolding-use-threshold=⟨n⟩
-fworker-wrapper -fworker-wrapper-cbv
some little heads-ups so you don't get got 👀:
- the ones with
⟨n⟩literally take a number, babes —-fbinary-blob-threshold=⟨n⟩,-fdmd-unbox-width=⟨n⟩,-fmax-inline-alloc-size=⟨n⟩,-fmax-inline-memcpy-insns=⟨n⟩,-fmax-inline-memset-insns=⟨n⟩,-fmax-simplifier-iterations=⟨n⟩,-fmax-uncovered-patterns=⟨n⟩,-fmax-worker-args=⟨n⟩,-fsimpl-tick-factor=⟨n⟩,-fsimplifier-phases=⟨n⟩,-fstrictness-before=⟨n⟩, and the whole-funfolding-*squad. don't @ me if you forget the=. -fno-opt-coercion,-fno-pre-inliningand-fno-state-hackonly appear in the negative form on this list — that's the vibe, that's the tea. ☕-fstg-lift-lams-non-rec-args-anyand-fstg-lift-lams-rec-args-anyare single and unbothered, no-fno-twin listed for either. slay.- also
-funfolding-keeness-factor=⟨n⟩is spelled exactly like that. not a typo on my end, it's canon. 💅
✨ Optimization levels ✨
the level-up menu, in the exact order the page lists it:
-O -O1 -O0 -O0 -O2 -O0 -O⟨n⟩ -O0
and before anyone comes for me in the replies — yes, -O0 really does appear that many times, and -O1 is there too. I'm just the messenger, bestie. -O⟨n⟩ takes your number. 🎀
🦋 Package options 🦋
package bookkeeping, aka who's allowed in the group chat:
-clear-package-db -distrust ⟨pkg⟩ -distrust-all-packages
-fpackage-trust -global-package-db -hide-all-packages
-hide-package ⟨pkg⟩ -ignore-package ⟨pkg⟩ -no-auto-link-packages
-no-global-package-db -no-user-package-db -package ⟨pkg⟩
-package-db ⟨file⟩ -package-env ⟨file⟩|⟨name⟩ -package-id
⟨unit-id⟩ -this-unit-id ⟨unit-id⟩ -trust ⟨pkg⟩ -user-package-db
note the -package-env ⟨file⟩|⟨name⟩ one — you pick either a file or a name there, okurrr. and -distrust, -hide-package, -ignore-package, -package, -package-db, -package-id, -this-unit-id and -trust all snatch an argument. 🫶
💜 Phases of compilation 💜
the "where do we stop" section:
--merge-objs -C -c -E -F -S -x ⟨suffix⟩
-x ⟨suffix⟩ is the one taking a suffix, bestie, don't forget it. 😭
🎀 Overriding external programs 🎀
the -pgm family — the "actually, use this program" squad:
-pgma ⟨cmd⟩ -pgmc ⟨cmd⟩ -pgmcxx ⟨cmd⟩ -pgmdll ⟨cmd⟩ -pgmF ⟨cmd⟩
-pgmi ⟨cmd⟩ -pgminstall_name_tool ⟨cmd⟩ -pgmL ⟨cmd⟩ -pgml ⟨cmd⟩
-pgmlc ⟨cmd⟩ -pgmlibtool ⟨cmd⟩ -pgmlm ⟨cmd⟩ -pgmlo ⟨cmd⟩
-pgmotool ⟨cmd⟩ -pgmP ⟨cmd⟩ -pgms ⟨cmd⟩ -pgmwindres ⟨cmd⟩
every single one of these takes a ⟨cmd⟩. very consistent, very demure. ✨ and yes, -pgmL and -pgml are two different flags — capital-L vs lowercase-l are not the same and I need you to respect that. 💅
🌈 Phase-specific options 🌈
the "sneak this straight into one phase" collection:
-opta ⟨option⟩ -optc ⟨option⟩ -optcxx ⟨option⟩ -optdll ⟨option⟩
-optF ⟨option⟩ -opti ⟨option⟩ -optL ⟨option⟩ -optl ⟨option⟩
-optlc ⟨option⟩ -optlm ⟨option⟩ -optlo ⟨option⟩ -optP ⟨option⟩
-optwindres ⟨option⟩ -pgmc-supports-no-pie -pgml-supports-no-pie
all the -opt* ones take an ⟨option⟩. the last two — -pgmc-supports-no-pie and -pgml-supports-no-pie — are the odd ones out with no placeholder, and honestly? main character energy. 👑
🍓 Platform-specific options 🍓
CPU feature flags, the whole lineup:
-mavx -mavx2 -mavx512cd -mavx512er -mavx512f -mavx512pf -mbmi
-mbmi2 -msse -msse2 -msse3 -msse4 -msse4.2
look at -msse4.2 with her little decimal point, she's so real for that. 🔥
🧚 Compiler plugins 🧚
letting other people's code into the house:
-fclear-plugins -fplugin-opt=⟨module⟩:⟨args⟩ -fplugin-trustworthy
-fplugin=⟨module⟩ -hide-all-plugin-packages -plugin-package ⟨pkg⟩
-plugin-package-id ⟨pkg-id⟩
-fplugin-opt=⟨module⟩:⟨args⟩ has that colon right in the middle — module, colon, args — copy it exactly, no improvising. -fplugin=⟨module⟩ takes a module, -plugin-package takes a ⟨pkg⟩, -plugin-package-id takes a ⟨pkg-id⟩. 🦋
💖 Profiling 💖
the "why is my program slow" toolkit, plus the -ticky crew:
-auto -auto-all -caf-all -fno-prof-count-entries
-fprof-count-entries -fprof-auto -fno-prof-auto -fprof-auto-calls
-fno-prof-auto -fprof-auto-exported -fno-prof-auto
-fprof-auto-top -fno-prof-auto -fprof-cafs -fno-prof-cafs
-fprof-callers=⟨name⟩ -fprof-late -fno-prof-late
-fprof-late-inline -fno-prof-late-inline -fprof-manual
-fno-prof-manual -no-auto -no-auto-all -no-caf-all -prof -ticky
-ticky-allocd -ticky-ap-thunk -ticky-dyn-thunk -ticky-LNE
-ticky-tag-checks
okay so before you clock me for the repeated entries: -fno-prof-auto is literally listed three separate times in the original list (once after -fprof-auto, once after -fprof-auto-calls, once after -fprof-auto-exported). I'm keeping all three because I keep every detail. periodt. 💀
also -fprof-callers=⟨name⟩ wants a name, and the -ticky family has no -f prefix — every one of them is just -ticky-something. -ticky-LNE keeps its big capitals too. 🎀
⭐ Program coverage ⭐
-fhpc -hpcdir⟨dir⟩
two flags, and yes, -hpcdir⟨dir⟩ really is written with no space before the ⟨dir⟩ — that's exactly how it's printed, so that's exactly how you're getting it. 🙈
🌸 Recompilation checking 🌸
"do I really have to rebuild everything" energy:
-fforce-recomp -fno-force-recomp -fignore-hpc-changes
-fno-ignore-hpc-changes -fignore-optim-changes
-fno-ignore-optim-changes
three cute little pairs, all matched, all accounted for. 🫶
🎀 Redirecting output 🎀
where do the files go, bestie:
--exclude-module=⟨file⟩ -ddump-mod-cycles -dep-makefile ⟨file⟩
-dep-suffix ⟨suffix⟩ -dumpdir ⟨dir⟩ -dynhisuf ⟨suffix⟩ -dyno
⟨file⟩ -dynohi ⟨file⟩ -dynosuf ⟨suffix⟩ -hcsuf ⟨suffix⟩ -hidir
⟨dir⟩ -hiedir ⟨dir⟩ -hiesuf ⟨suffix⟩ -hisuf ⟨suffix⟩
-include-cpp-deps -include-pkg-deps -o ⟨file⟩ -odir ⟨dir⟩ -ohi
⟨file⟩ -osuf ⟨suffix⟩ -outputdir ⟨dir⟩ -stubdir ⟨dir⟩
note it's --exclude-module=⟨file⟩ with two dashes and an = — she's built different. the rest are single-dash. the *suf ones take a ⟨suffix⟩, the *dir ones take a ⟨dir⟩, the ⟨file⟩ ones take a file. -ddump-mod-cycles, -include-cpp-deps and -include-pkg-deps fly solo. 💅
🦋 Temporary files 🦋
-tmpdir ⟨dir⟩— the one and only entry in this whole section, and she's carrying it on her back. takes a⟨dir⟩. 👑
🔥 Verbosity options 🔥
the "tell me everything" section, and it is long, so here we go, all of it:
-fabstract-refinement-hole-fits
-fno-abstract-refinement-hole-fits -fdefer-diagnostics
-fdiagnostics-color=⟨always|auto|never⟩ -fdiagnostics-show-caret
-fno-diagnostics-show-caret -ferror-spans -fhide-source-paths
-fkeep-going -fmax-refinement-hole-fits=⟨n⟩
-fno-max-refinement-hole-fits -fmax-relevant-binds=⟨n⟩
-fno-max-relevant-binds -fmax-valid-hole-fits=⟨n⟩
-fno-max-valid-hole-fits -fno-show-valid-hole-fits
-fno-sort-valid-hole-fits -fsort-valid-hole-fits
-fprint-axiom-incomps -fno-print-axiom-incomps
-fprint-equality-relations -fno-print-equality-relations
-fprint-expanded-synonyms -fno-print-expanded-synonyms
-fprint-explicit-coercions -fno-print-explicit-coercions
-fprint-explicit-foralls -fno-print-explicit-foralls
-fprint-explicit-kinds -fno-print-explicit-kinds
-fprint-explicit-runtime-reps -fno-print-explicit-runtime-reps
-fprint-potential-instances -fno-print-potential-instances
-fprint-typechecker-elaboration
-fno-print-typechecker-elaboration -fprint-unicode-syntax
-fno-print-unicode-syntax -frefinement-level-hole-fits=⟨n⟩
-fno-refinement-level-hole-fits -freverse-errors
-fno-reverse-errors -fshow-docs-of-hole-fits
-fno-show-docs-of-hole-fits -fshow-hole-constraints
-fshow-hole-matches-of-hole-fits
-fno-show-hole-matches-of-hole-fits
-fshow-provenance-of-hole-fits -fno-show-provenance-of-hole-fits
-fshow-type-app-of-hole-fits -fno-show-type-app-of-hole-fits
-fshow-type-app-vars-of-hole-fits
-fno-show-type-app-vars-of-hole-fits -fshow-type-of-hole-fits
-fno-show-type-of-hole-fits -fsort-by-size-hole-fits
-fno-sort-by-size-hole-fits -fsort-by-subsumption-hole-fits
-fno-sort-by-subsumption-hole-fits -funclutter-valid-hole-fits
-Rghc-timing -v -v⟨n⟩
things to clock 🔍:
-fdiagnostics-color=⟨always|auto|never⟩— you pick exactly one ofalways,auto, ornever. three options, no others, don't get creative.-fkeep-going,-ferror-spans,-fhide-source-paths,-fdefer-diagnostics,-fshow-hole-constraints,-funclutter-valid-hole-fitsand-Rghc-timingall ride solo — no-fno-twin on this list.- the
-fno-show-valid-hole-fitsand-fno-sort-valid-hole-fitsentries appear before their positive-fsort-valid-hole-fitssibling. order is exactly as printed, bestie, I don't make the rules. 💀 -v⟨n⟩wants your number, and plain-vis its own thing.-Rghc-timinghas a capitalR. capital R. respect it. 🫶- and
-fmax-refinement-hole-fits=⟨n⟩,-fmax-relevant-binds=⟨n⟩,-fmax-valid-hole-fits=⟨n⟩,-frefinement-level-hole-fits=⟨n⟩all take a⟨n⟩— the rest of the-fno-versions of those don't. 💅
⚠️ Warnings ⚠️
okay bestie, take a deep breath. this is the big one. this is the entire warning-flag catalogue, and because the point of a manual page is that you can actually look stuff up in it, i'm not gonna paraphrase or trim or merge a single one of these. every flag, every -Wno- twin, every -f variant, all of it goes in the code block exactly as it is. skim it, grep it, whatever — it's all here:
-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 -fenable-th-splice-warnings
-fno-enable-th-splice-warnings -fhelpful-errors
-fno-helpful-errors -fmax-pmcheck-models=⟨n⟩
-fshow-warning-groups -fno-show-warning-groups -fvia-C -W -w -w
-Wall -w -Wall-missed-specialisations
-Wno-all-missed-specialisations -Wall-missed-specializations
-Wno-all-missed-specializations -Wambiguous-fields -Wauto-orphans
-Wcompat -Wno-compat -Wcompat-unqualified-imports
-Wno-compat-unqualified-imports -Wcpp-undef -Wdefault
-Wdeferred-out-of-scope-variables
-Wno-deferred-out-of-scope-variables -Wdeferred-type-errors
-Wno-deferred-type-errors -Wdeprecated-flags
-Wno-deprecated-flags -Wdeprecations -Wno-deprecations
-Wderiving-defaults -Wno-deriving-defaults -Wderiving-typeable
-Wno-deriving-typeable -Wdodgy-exports -Wno-dodgy-exports
-Wdodgy-foreign-imports -Wno-dodgy-foreign-imports
-Wdodgy-imports -Wno-dodgy-imports -Wduplicate-constraints
-Wno-duplicate-constraints -Wduplicate-exports
-Wno-duplicate-exports -Wempty-enumerations
-Wno-empty-enumerations -Werror -Wwarn -Weverything -Wextra -w
-Wforall-identifier -Wno-forall-identifier
-Wgadt-mono-local-binds -Wno-gadt-mono-local-binds -Whi-shadowing
-Wno-hi-shadowing -Widentities -Wno-identities
-Wimplicit-kind-vars -Wno-implicit-kind-vars -Wimplicit-lift
-Wno-implicit-lift -Wimplicit-prelude -Wno-implicit-prelude
-Winaccessible-code -Wno-inaccessible-code -Wincomplete-patterns
-Wno-incomplete-patterns -Wincomplete-record-updates
-Wno-incomplete-record-updates -Wincomplete-uni-patterns
-Wno-incomplete-uni-patterns -Winferred-safe-imports
-Wno-inferred-safe-imports -Winline-rule-shadowing
-Wno-inline-rule-shadowing -Winvalid-haddock -Wno-invalid-haddock
-Wmisplaced-pragmas -Wno-misplaced-pragmas
-Wmissed-extra-shared-lib -Wno-missed-extra-shared-lib
-Wmissed-specialisations -Wno-missed-specialisations
-Wmissed-specializations -Wno-missed-specializations
-Wmissing-deriving-strategies -Wno-missing-deriving-strategies
-Wmissing-export-lists -Wno-missing-export-lists
-Wmissing-exported-pattern-synonym-signatures
-Wno-missing-exported-pattern-synonym-signatures
-Wmissing-exported-signatures -Wno-missing-exported-signatures
-Wmissing-exported-sigs -Wno-missing-exported-sigs
-Wmissing-fields -Wno-missing-fields -Wmissing-home-modules
-Wno-missing-home-modules -Wmissing-import-lists
-Wno-missing-import-lists -Wmissing-kind-signatures
-Wno-missing-kind-signatures -Wmissing-local-signatures
-Wno-missing-local-signatures -Wmissing-local-sigs
-Wno-missing-local-sigs -Wmissing-methods -Wno-missing-methods
-Wmissing-monadfail-instances -Wno-missing-monadfail-instances
-Wmissing-pattern-synonym-signatures
-Wno-missing-pattern-synonym-signatures
-Wmissing-safe-haskell-mode -Wno-missing-safe-haskell-mode
-Wmissing-signatures -Wno-missing-signatures
-Wmissing-space-after-bang -Wmonomorphism-restriction
-Wno-monomorphism-restriction -Wname-shadowing
-Wno-name-shadowing -Wno-compat -Wcompat
-Wnoncanonical-monad-instances -Wno-noncanonical-monad-instances
-Wnoncanonical-monadfail-instances
-Wno-noncanonical-monadfail-instances
-Wnoncanonical-monoid-instances
-Wno-noncanonical-monoid-instances -Wnot -Woperator-whitespace
-Wno-operator-whitespace -Woperator-whitespace-ext-conflict
-Wno-operator-whitespace-ext-conflict -Worphans -Wno-orphans
-Woverflowed-literals -Wno-overflowed-literals
-Woverlapping-patterns -Wno-overlapping-patterns -Wpartial-fields
-Wno-partial-fields -Wpartial-type-signatures
-Wno-partial-type-signatures -Wprepositive-qualified-module
-Wno-prepositive-qualified-module -Wredundant-bang-patterns
-Wno-redundant-bang-patterns -Wredundant-constraints
-Wno-redundant-constraints -Wredundant-record-wildcards
-Wno-redundant-record-wildcards -Wredundant-strictness-flags
-Wno-redundant-strictness-flags -Wsafe -Wno-safe -Wsemigroup
-Wno-semigroup -Wsimplifiable-class-constraints
-Wno-simplifiable-class-constraints -Wstar-binder
-Wno-star-binder -Wstar-is-type -Wno-star-is-type -Wtabs
-Wno-tabs -Wtrustworthy-safe -Wno-safe -Wtype-defaults
-Wno-type-defaults -Wtype-equality-out-of-scope
-Wno-type-equality-out-of-scope
-Wtype-equality-requires-operators
-Wno-type-equality-requires-operators -Wtyped-holes
-Wno-typed-holes -Wunbanged-strict-patterns
-Wno-unbanged-strict-patterns
-Wunicode-bidirectional-format-characters -Wunrecognised-pragmas
-Wno-unrecognised-pragmas -Wunrecognised-warning-flags
-Wno-unrecognised-warning-flags -Wunsafe -Wno-unsafe
-Wunsupported-calling-conventions
-Wno-unsupported-calling-conventions -Wunsupported-llvm-version
-Wno-monomorphism-restriction -Wunticked-promoted-constructors
-Wno-unticked-promoted-constructors -Wunused-binds
-Wno-unused-binds -Wunused-do-bind -Wno-unused-do-bind
-Wunused-foralls -Wno-unused-foralls -Wunused-imports
-Wno-unused-imports -Wunused-local-binds -Wno-unused-local-binds
-Wunused-matches -Wno-unused-matches -Wunused-packages
-Wno-unused-packages -Wunused-pattern-binds
-Wno-unused-pattern-binds -Wunused-record-wildcards
-Wno-unused-record-wildcards -Wunused-top-binds
-Wno-unused-top-binds -Wunused-type-patterns
-Wno-unused-type-patterns -Wwarn -Werror -Wwarnings-deprecations
-Wno-warnings-deprecations -Wwrong-do-bind -Wno-wrong-do-bind
a few things worth pointing your little goblin eyes at, since they're right there in the list:
- basically every
-Wfoohas a matching-Wno-foobestie standing right next to it. iconic paired energy. 💅 - there are group-ish flags in the mix —
-W,-w,-Wall,-Wextra,-Weverything,-Wcompat,-Wdefault— and yeah,-Walland-wliterally show up more than once in there, that's not a typo on my end, i'm just not the one who gets to tidy up the source list. 🙈 -Werrorand-Wwarnare both in there, and-Wno-compat/-Wcompatget a little encore later on too. it's giving "the list has lore."-fmax-pmcheck-models=⟨n⟩is the one that wants a value from you, so swap that ⟨n⟩ for an actual number, bestie, don't paste the angle brackets. 😭-fvia-C,-Wnot,-Wtabs,-Widentities,-Wsemigroup— yes those are real, yes they're in the catalogue, no i'm not making them up. ✨
🔧 Code generation 🔧
this is the "how do we actually turn your beautiful Haskell into a thing the computer runs" corner of the flag drawer. pick your weapon, bestie:
-dynamic-too— you know how you can build static object files? this one builds the dynamic object files as well, during compilation. two for the price of one run 💖-fasm— use the native code generator 🏎️-fbyte-code— generate byte-code instead-fexpose-internal-symbols— produce symbols for all functions, and yes, "all" includes the internal ones. nothing gets to hide 🔍-fexternal-dynamic-refs— generate code for linking against dynamic libraries-fllvm— compile using the LLVM code generator 🔥-fno-code— omit code generation entirely. no object code, just vibes 💀-fobject-code— generate object code (the opposite energy of the previous one, fr)-fPIC— generate position-independent code, where available-fPIE— generate code for a position-independent executable, where available-fwrite-interface— always write interface files. always. no negotiation 🫶-split-objs— split the generated object files into smaller files 🎀
heads up:-fPICand-fPIEboth come with the caveat "where available" — so like, don't come for me if your platform doesn't have it. that's not me being shady, that's the page. 💀
🩺 Debugging the compiler 🩺
okay so this next section is genuinely unhinged in the best way. these are the flags for looking inside GHC itself — the passes, the dump files, the internal sanity checks. if you're not debugging the compiler you probably don't need these, but if you are, this list is your whole personality now. 🧚
-dasm-lint— ASM pass sanity checking-dcmm-lint— C-- pass sanity checking-dcore-lint— turn on internal sanity checking ✨-ddump-asm— dump the 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 the 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 final C-- output-ddump-cmm-caf— dump the results of the C-- CAF analysis pass-ddump-cmm-cbe— dump the results of common block elimination-ddump-cmm-cfg— dump the results of the C-- 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 the C-- info table augmentation pass-ddump-cmm-opt— dump the results of C-- to C-- optimising passes-ddump-cmm-proc— dump the results of proc-point analysis-ddump-cmm-procmap— dump the results of the C-- proc-point map pass-ddump-cmm-raw— dump raw C---ddump-cmm-sink— dump the results of the C-- sinking pass-ddump-cmm-sp— dump the results of the C-- stack layout pass-ddump-cmm-split— dump the results of the C-- proc-point splitting pass-ddump-cmm-switch— dump the results of switch lowering passes-ddump-cmm-verbose— write output from main C-- pipeline passes to files 📁-ddump-cmm-verbose-by-proc— show output from main C-- 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. one line. that's it. slay 💅-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-ddump-deriv— dump deriving output-ddump-ds— dump desugarer output-ddump-ec-trace— trace exhaustiveness checker-ddump-exitify— dump output of the exitification pass-ddump-faststrings— dump the whole FastString table when finished-ddump-file-prefix=⟨str⟩— set the prefix of the filenames used for debugging output. note the ⟨str⟩ — you're passing it a string, bestie ✍️-ddump-foreign— dump foreign export stubs-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-json— dump error messages as JSON documents 🫶 (machine-readable bestie behaviour)-ddump-late-cc— dump core with late cost centres added-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 parse tree-ddump-parsed-ast— dumps the parser output as a syntax tree 🌳 like, the actual tree-tree, not vibes.-ddump-prep— dumps the prepared core, bestie.-ddump-rn— dumps renamer output.-ddump-rn-ast— dumps renamer output as a syntax tree.-ddump-rn-stats— renamer stats, in case you're nosy 💅-ddump-rn-trace— traces the renamer.-ddump-rtti— traces runtime type inference.-ddump-rule-firings— dumps rule firing info 🔥 (rules firing, get it?)-ddump-rule-rewrites— dumps detailed rule firing info, the deluxe edition ✨-ddump-rules— dumps rewrite rules.-ddump-simpl— dumps the final simplifier output.-ddump-simpl-iterations— dumps output from each simplifier iteration, one by one 🫶-ddump-simpl-stats— dumps simplifier stats.-ddump-simpl-trace— dumps trace messages in the simplifier.-ddump-spec— dumps specialiser output.-ddump-splices— dumps TH spliced expressions and what they evaluate to. Two-for-one ✨-ddump-stg— (deprecated) alias for-ddump-stg-from-core. It's giving legacy, don't use it for new stuff 💀-ddump-stg-cg— shows output afterStg2Stg.-ddump-stg-final— shows output of the last STG pass. The finale 🎬-ddump-stg-from-core— showsCoreToStgoutput.-ddump-stg-tags— shows output of the tag inference pass.-ddump-stg-unarised— shows unarised STG.-ddump-str-signatures— dumps top-level demand signatures.-ddump-stranal— dumps demand analysis output.-ddump-tc— dumps typechecker output.-ddump-tc-ast— dumps typechecker output as a syntax tree.-ddump-tc-trace— traces the typechecker. Good luck, it's a lot 😭-ddump-ticked— dumps the code instrumented by HPC (hpc).-ddump-timings— dumps per-pass timing and allocation statistics. Perfect for when you're like "why is this slow" ⏱️-ddump-to-file— dumps to files instead of stdout. Your scrollback will thank you.-ddump-types— dumps type signatures.-ddump-verbose-inlinings— dumps all considered inlinings.-ddump-view-pattern-commoning— dumps commoned view patterns.-ddump-worker-wrapper— dumps worker-wrapper output.-dfaststring-stats— shows statistics for fast string usage when finished.-dhex-word-literals— prints values of typeWord#in hexadecimal.-dinitial-unique=⟨s⟩— startsUniqSupplyallocation from ⟨s⟩.-dinline-check=⟨str⟩— dumps information about inlining decisions.-dkeep-comments— includes comments in the parser. Useful in combination with-ddump-parsed-ast🫶-dlinear-core-lint— turns on internal sanity checking.-dlint— enables several common internal sanity checkers. The full spa package 🧖-dno-debug-output— suppresses unsolicited debugging output. Rude of it to be unsolicited tbh.-dno-typeable-binds— doesn't generate bindings forTypeablemethods.-dppr-case-as-let— prints single alternative case expressions as strict lets.-dppr-cols=⟨n⟩— sets the width of debugging output. For example-dppr-cols200✨-dppr-debug— turns on debug printing (more verbose).-dppr-user-length— sets the depth for printing expressions in error msgs.-drule-check=⟨str⟩— dumps information about potential rule application.-dshow-passes— prints out each pass name as it happens. Like a little parade of passes 🎺-dstg-lint— STG pass sanity checking.-dsuppress-all— in dumps, suppresses everything (except for uniques) that is suppressible.-dsuppress-coercion-types— suppresses the printing of coercion types in Core dumps to make them shorter.-dsuppress-coercions— suppresses the printing of coercions in Core dumps to make them shorter.-dsuppress-core-sizes— suppresses the printing of core size stats per binding (since 9.4).-dsuppress-idinfo— suppresses extended information about identifiers where they are bound.-dsuppress-module-prefixes— suppresses the printing of module qualification prefixes.-dsuppress-stg-free-vars— suppresses the printing of closure free variable lists in STG output.-dsuppress-stg-reps— suppresses rep annotations on STG args.-dsuppress-ticks— suppresses "ticks" in the pretty-printer output.-dsuppress-timestamps— suppresses timestamps in dumps.-dsuppress-type-applications— suppresses type applications.-dsuppress-type-signatures— suppresses type signatures.-dsuppress-unfoldings— suppresses the printing of the stable unfolding of a variable at its binding site.-dsuppress-uniques— suppresses the printing of uniques in debug output (easier to usediff). Ngl this one's a lifesaver 💅-dsuppress-var-kinds— suppresses the printing of variable kinds.-dtag-inference-checks— affirm tag inference results are correct at runtime.-dth-dec-file— dumps evaluated TH declarations into*.th.hsfiles.-dunique-increment=⟨i⟩— sets the increment for the generatedUnique's to ⟨i⟩.-dverbose-core2core— shows output from each core-to-core pass.-dverbose-stg2stg— shows output from each STG-to-STG pass.-falignment-sanitisation— compiles with alignment checks for all info table dereferences.-fcatch-nonexhaustive-cases— adds a default error alternative to case expressions without a default alternative.-fcheck-prim-bounds— instruments array primops with bounds checks.-fdistinct-constructor-tables— generates a fresh info table for each usage of a data constructor.-finfo-table-map— embeds a lookup table in the generated binary which maps the address of an info table to the source position the closure originated from. Detective mode 🔍-fllvm-fill-undef-with-garbage— instruct LLVM to fill dead STG registers with garbage.-fproc-alignment— align functions at given boundary.-g— produce DWARF debug information in compiled object files. ⟨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— empties the import directory list. Poof, gone 🫧-i⟨dir⟩[:⟨dir⟩]*— add ⟨dir⟩, ⟨dir2⟩, etc. to import path.
🎀 Interactive mode 🎀
-fbreak-on-error— break on uncaught exceptions and errors.-fbreak-on-exception— break on any exception thrown.-fghci-hist-size=⟨n⟩— sets the number of entries GHCi keeps for:history. Seeghci-debugger.-fghci-leak-check— (debugging only) check for space leaks when loading new modules in GHCi.-fimplicit-import-qualified— puts 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 sets the special variableit.-fprint-bind-result— turns on printing of binding results in GHCi.-fprint-evld-with-show— instruct:printto useShowinstances where possible.-fshow-loaded-modules— shows the names of modules that GHCi loaded after a:loadcommand.-ghci-script— read additional.ghcifiles.-ignore-dot-ghci— disables reading of.ghcifiles.-interactive-print ⟨name⟩— selects the function to use for printing evaluated expressions in GHCi.
💜 Interface files 💜
--show-iface ⟨file⟩— see modes.-ddump-hi— dumps the new interface to stdout.-ddump-hi-diffs— shows the differences vs. the old interface. Diff girlie representation 🦋-ddump-minimal-imports— dumps a minimal set of imports.
🍓 Keeping intermediate files 🍓
-keep-hc-file— retains intermediate.hcfiles.-keep-hi-files— retains intermediate.hifiles (the default).-keep-hscpp-file— retains intermediate.hscppfiles.-keep-llvm-file— retains intermediate LLVM.llfiles. Implies-fllvm.-keep-o-files— retains intermediate.ofiles (the default).-keep-s-file— retains intermediate.sfiles.-keep-tmp-files— retains all intermediate temporary files.
👑 Language options 👑
Okay bestie this next bit is the big one — every single -X flag. They're all like little switches that turn a language extension on, no cap. Also note: some of these imply others, so read the fine print 💅
-XAllowAmbiguousTypes— allows the user to write ambiguous types, and the type inference engine to infer them.-XApplicativeDo— enables Applicative do-notation desugaring.-XArrows— enables the arrow notation extension.-XBangPatterns— enables bang patterns.-XBinaryLiterals— enables support for binary literals.-XBlockArguments— allows do blocks and other constructs as function arguments.-XCApiFFI— enables theCAPIcalling convention.-XConstrainedClassMethods— enables constrained class methods.-XConstraintKinds— enables a kind of constraints.-XCPP— enables the C preprocessor.-XCUSKs— enables detection of complete user-supplied kind signatures.-XDataKinds— enables datatype promotion.-XDatatypeContexts— allows contexts on data types.-XDeepSubsumption— enables deep subsumption.-XDefaultSignatures— enables default signatures.-XDeriveAnyClass— enables deriving for any class.-XDeriveDataTypeable— enables deriving for theDataclass. Implied by (deprecated)AutoDeriveTypeable.-XDeriveFoldable— enables deriving for theFoldableclass. Implied byDeriveTraversable.-XDeriveFunctor— enables deriving for theFunctorclass. Implied byDeriveTraversable.-XDeriveGeneric— enables deriving for theGenericclass.-XDeriveLift— enables deriving for theLiftclass.-XDeriveTraversable— enables deriving for theTraversableclass. ImpliesDeriveFunctorandDeriveFoldable. Package deal 🎁-XDerivingStrategies— enables deriving strategies.-XDerivingVia— enables deriving instances via types of the same runtime representation. ImpliesDerivingStrategies.-XDisambiguateRecordFields— enables record field disambiguation. Implied byRecordWildCards.-XDuplicateRecordFields— allows definition of record types with identically-named fields.-XEmptyCase— allows empty case alternatives.-XEmptyDataDecls— allows definition of empty data types.-XEmptyDataDeriving— bestie you can now derive instances of the standard type classes even for empty data types. yes, empty. icon behaviour honestly 💅-XExistentialQuantification— Enable liberalised type synonyms. (that's what the page says, don't come for me, i'm just the messenger 🫶)-XExplicitForAll— turns on explicit universal quantification. implied byScopedTypeVariables,LiberalTypeSynonyms,RankNTypesandExistentialQuantification.-XExplicitNamespaces— lets you use the keywordtypeto specify the namespace of entries in imports and exports (explicit-namespaces). implied byTypeOperatorsandTypeFamilies.-XExtendedDefaultRules— use GHCi's extended default rules in a normal module. yes, in a normal module. it's giving GHCi energy but it's out in the wild ✨-XFieldSelectors— Control visibility of field selector functions.-XFlexibleContexts— Remove some restrictions on class contexts-XFlexibleInstances— Enable flexible instances. ImpliesTypeSynonymInstances.-XForeignFunctionInterface— Enable foreign function interface. talking to the outside world, slay 🌈-XFunctionalDependencies— Enable functional dependencies. ImpliesMultiParamTypeClasses.-XGADTs— Enable generalised algebraic data types. ImpliesGADTSyntaxandMonoLocalBinds.-XGADTSyntax— Enable generalised algebraic data type syntax.-XGeneralisedNewtypeDeriving— Enable newtype deriving.-XGeneralizedNewtypeDeriving— Enable newtype deriving. (yes bestie, this is the spelling with az— same thing, both listed, both valid, no cap 💖)-XGHC2021— Use GHC’s set of default language extensions from 2021-XGHCForeignImportPrim— Enableprimcalling convention. Intended for internal use only. ⚠️ like, internal. not for you. i'm serious.-XHaskell2010— Use the Haskell 2010 language variant.-XHaskell98— Use the Haskell 98 language variant.-XHexFloatLiterals— Enable support for hexadecimal floating point literals.-XImplicitParams— Enable Implicit Parameters.-XImportQualifiedPost—ImportQualifiedPostallows the syntaximport M qualified-XImpredicativeTypes— Enable impredicative types. ImpliesRankNTypes.-XIncoherentInstances— Enable incoherent instances. ImpliesOverlappingInstances.-XInstanceSigs— Enable instance signatures.-XInterruptibleFFI— Enable interruptible FFI.-XKindSignatures— Enable kind signatures. Implied byTypeFamiliesandPolyKinds.-XLambdaCase— Enable lambda-case expressions. the\casemoment. obsessed 🎀-XLexicalNegation— Use whitespace to determine whether the minus sign stands for negation or subtraction. whitespace is doing the deciding, lowkey iconic 💅-XLiberalTypeSynonyms— Enable liberalised type synonyms.-XLinearTypes— Enable linear types.-XMagicHash— Allow#as a postfix modifier on identifiers.-XMonadComprehensions— Enable monad comprehensions.-XMonoLocalBinds— Enable do not generalise local bindings. Implied byTypeFamiliesandGADTs.-XMultiParamTypeClasses— Enable multi parameter type classes. Implied byFunctionalDependencies.-XMultiWayIf— Enable multi-way if-expressions.-XNamedFieldPuns— Enable record puns.-XNamedWildCards— Enable named wildcards.-XNegativeLiterals— Enable support for negative literals.-XNoImplicitPrelude— Don't implicitly import Prelude. Implied byRebindableSyntax. going full ✨DIY✨ with your prelude, we respect it-XNoMonomorphismRestriction— Disable the monomorphism restriction.-XNondecreasingIndentation— Allow nested contexts to be at the same indentation level as its enclosing context.-XNoPatternGuards— Disable pattern guards. Implied byHaskell98.-XNoTraditionalRecordSyntax— Disable support for traditional record syntax (as supported by Haskell 98)C {f = x}-XNPlusKPatterns— Enable support for n+k patterns. Implied byHaskell98.-XNullaryTypeClasses— Deprecated, does nothing. nullary (no parameter) type classes are now enabled usingMultiParamTypeClasses. 💀 it literally does nothing bestie, don't waste your time-XNumDecimals— Enable support for 'fractional' integer literals.-XNumericUnderscores— Enable support for numeric underscores.-XOverlappingInstances— Enable overlapping instances.-XOverloadedLabels— Enable overloaded labels.-XOverloadedLists— Enable overloaded lists.-XOverloadedRecordDot— Record'.'syntax-XOverloadedRecordUpdate— Record'.'syntax record updates-XOverloadedStrings— Enable overloaded string literals.-XPackageImports— Enable package-qualified imports.-XParallelListComp— Enable parallel list comprehensions.-XPartialTypeSignatures— Enable partial type signatures.-XPatternSynonyms— Enable pattern synonyms.-XPolyKinds— Enable kind polymorphism. ImpliesKindSignatures.-XPostfixOperators— Enable postfix operators.-XQualifiedDo— Enable qualified do-notation desugaring.-XQuantifiedConstraints— Allowforallquantifiers in constraints.-XQuasiQuotes— Enable quasiquotation.-XRank2Types— Enable rank-2 types. Synonym forRankNTypes.-XRankNTypes— Enable rank-N types. Implied byImpredicativeTypes.-XRebindableSyntax— Employ rebindable syntax. ImpliesNoImplicitPrelude.-XRecordWildCards— Enable record wildcards. ImpliesDisambiguateRecordFields.-XRecursiveDo— Enable recursive do (mdo) notation.-XRoleAnnotations— Enable role annotations.-XSafe— Enable the Safe Haskell Safe mode. 🛡️ the good-girl mode fr fr-XScopedTypeVariables— Enable lexically-scoped type variables.-XStandaloneDeriving— Enable standalone deriving.-XStandaloneKindSignatures— Allow the use of standalone kind signatures.-XStarIsType— Treat*asData.Kind.Type.-XStaticPointers— Enable static pointers.-XStrict— Make bindings in the current module strict by default.-XStrictData— Enable default strict datatype fields.-XTemplateHaskell— Enable Template Haskell. 🧙♀️ big magic energy, use responsibly-XTemplateHaskellQuotes— Enable quotation subset of Template Haskell.-XTransformListComp— Enable generalised list comprehensions.-XTrustworthy— Enable the Safe Haskell Trustworthy mode.-XTupleSections— Enable tuple sections.-XTypeApplications— Enable type application syntax in terms, patterns and types.-XTypeFamilies— Enable type families. ImpliesExplicitNamespaces,KindSignatures, andMonoLocalBinds.-XTypeFamilyDependencies— Enable injective type families. ImpliesTypeFamilies.-XTypeInType— Deprecated. Enable kind polymorphism and datatype promotion. 🙈 deprecated bestie, it's giving 2016-XTypeOperators— Enable type operators. ImpliesExplicitNamespaces.-XTypeSynonymInstances— Enable type synonyms in instance heads. Implied byFlexibleInstances.-XUnboxedSums— Enable unboxed sums.-XUnboxedTuples— Enable the use of unboxed tuple syntax.-XUndecidableInstances— Enable undecidable instances.-XUndecidableSuperClasses— Allow all superclass constraints, including those that may result in non-termination of the typechecker. 😭 yes you read that right, the typechecker can just. not terminate. dramatic but go off-XUnicodeSyntax— Enable unicode syntax. ✨ aesthetic ✨-XUnliftedDatatypes— Enable unlifted data types.-XUnliftedFFITypes— Enable unlifted FFI types-XUnliftedNewtypes— Enable unlifted newtypes.-XUnsafe— Enable Safe Haskell Unsafe mode. 💀 the name is not a vibe, it's a warning-XViewPatterns— Enable view patterns.
🔗 Linking options
okay bestie this is the link-time era of the page — everything here is about gluing your object files into something that actually runs 🫶
-c— Stop after generating object (.o) file-debug— Use the debugging runtime-dylib-install-name ⟨path⟩— Set 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— Instruct 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, link in the framework ⟨name⟩. This option corresponds to the-frameworkoption for Apple's Linker.-framework-path ⟨dir⟩— On Darwin/OS X/iOS only, add ⟨dir⟩ to the list of directories searched for frameworks. This option corresponds to the-Foption for Apple's Linker.-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⟩— Add ⟨dir⟩ to the list of directories searched for libraries-l ⟨lib⟩— Link in library ⟨lib⟩-main-is ⟨thing⟩— Set main module and function-no-hs-main— Don't assume this program containsmain-no-link— Stop after generating object (.o) file-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.<pink>none</pink>= no RTS flags can be given;<pink>some</pink>= only a minimum of safe options can be given (this is the default);<pink>all</pink>(or no argument at all) = all RTS flags are permitted;<pink>ignore</pink>= RTS flags can be given, but they’re treated as regular arguments and passed to the Haskell program as arguments;<pink>ignoreAll</pink>= same as<pink>ignore</pink>, butGHCRTSis also ignored. Heads-up bestie:-rtsoptsdoes not affect-with-rtsoptsbehavior — flags passed via-with-rtsoptsare used regardless of-rtsopts. 💅-shared— generate a shared library (as opposed to an executable). ✨-split-sections— split sections for link-time dead-code stripping. 🎀-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 a single static library that can be linked against. 🦋-threaded— use the threaded runtime.-with-rtsopts=⟨opts⟩— set the default RTS options to<pink>⟨opts⟩</pink>.
🎀 Miscellaneous options 🎀
-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; seeoptions-languagefor 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<pink>⟨size⟩</pink>.-hidden-module ⟨module name⟩— a module which should not be visible outside its unit.-j[⟨n⟩]— when compiling with--make, compile<pink>⟨n⟩</pink>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 🎛️
--frontend ⟨module⟩— run GHC with the given frontend plugin; seefrontend_pluginsfor details. 🌈--help— display help.--info— display information about the compiler.--interactive— interactive mode — normally used by just runningghci; seeghcifor details. 💖--make— build a multi-module Haskell program, automatically figuring out dependencies. Likely to be much easier, and faster, than usingmake; seemake-modefor 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⟩— evaluateexpr; seeeval-modefor details.-M— generate dependency information suitable for use in aMakefile; seemakefile-dependenciesfor details.-shared— create a shared object.
🔥 Individual optimizations 🔥
-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.-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.-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:3. Boxity analysis pretends that returned records with this many fields can be unboxed.-fdo-eta-reduction— enable eta-reduction. Implied by-O.-fdo-lambda-eta-expansion— enable lambda eta-expansion. Always enabled 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). Implied by-O.-fexcess-precision— enable excess intermediate precision.-fexitification— enables exitification optimisation. Implied by-O.-fexpose-all-unfoldings— expose all unfoldings, even for very large or recursive functions.-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.-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:2000. Set the size threshold for the liberate-case transformation to<pink>⟨n⟩</pink>.-fllvm-pass-vectors-in-regs— (deprecated) does nothing.-floopification— turn saturated self-recursive tail-calls into local jumps in the generated assembly. Implied by-O.-fmax-inline-alloc-size=⟨n⟩— default:128. Set the maximum size of inline array allocations to<pink>⟨n⟩</pink>bytes (default:128).-fmax-inline-memcpy-insns=⟨n⟩— default:32. Inlinememcpycalls if they would generate no more than<pink>⟨n⟩</pink>pseudo instructions.-fmax-inline-memset-insns=⟨n⟩— default:32. Inlinememsetcalls if they would generate no more than<pink>⟨n⟩</pink>pseudo instructions.-fmax-simplifier-iterations=⟨n⟩— default:4. Set the max iterations for the simplifier.-fmax-uncovered-patterns=⟨n⟩— default:4. Set the maximum number of patterns to display in warnings about non-exhaustive ones. 😭-fmax-worker-args=⟨n⟩— default:10. 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 — the thing where any lambda with a real-world state token as argument is considered to be single-entry. Hence it’s 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 a case expression.-fregs-graph— use the graph colouring register allocator for register allocation in the native code generator.-fregs-iterative— bestie, this makes the native code generator use the iterative coalescing graph colouring register allocator ✨ (yes that's a whole mouthful, yes it's iconic)-fsimpl-tick-factor=⟨n⟩— default:100. Sets the percentage factor for simplifier ticks 🎀-fsimplifier-phases=⟨n⟩— default:2. Sets how many phases the simplifier gets. Lowkey gets ignored with-O0🙈-fsolve-constant-dicts— when it's solving constraints, it tries to eagerly solve super classes using the dictionaries it already has 💅-fspec-constr— turns on the SpecConstr transformation. Implied by-O2.-fspec-constr-count=⟨n⟩— default:3.*(that's literally what the page says, no I'm not fixing it 😭). Sets ⟨n⟩ as the max number of specialisations SpecConstr will create for any one function.-fspec-constr-keen— specializes a call with an explicit constructor argument even when that argument isn't scrutinised in the body of the function 👑-fspec-constr-threshold=⟨n⟩— default:2000. Sets the size threshold for the SpecConstr transformation to ⟨n⟩.-fspecialise— turns on specialisation of overloaded functions. Implied by-O.-fspecialise-aggressively— specialisation of overloaded functions regardless of size, as long as unfolding is available 🔥-fstatic-argument-transformation— turns on the static argument transformation.-fstg-cse— enables common sub-expression elimination on the STG intermediate language ✨-fstg-lift-lams— enables late lambda lifting on the STG intermediate language. Implied by-O2.-fstg-lift-lams-known— allows turning known calls into unknown calls while doing late lambda lifting 👀-fstg-lift-lams-non-rec-args— creates top-level non-recursive functions with at most <n> parameters while doing late lambda lifting.-fstg-lift-lams-rec-args— creates top-level recursive functions with at most <n> parameters while doing late lambda lifting.-fstrictness— turns on demand analysis. Implied by-O, and it implies-fworker-wrapper🫶-fstrictness-before=⟨n⟩— runs an additional demand analysis before simplifier phase ⟨n⟩-funbox-small-strict-fields— flattens strict constructor fields that have a pointer-sized representation. Implied by-O.-funbox-strict-fields— flattens strict constructor fields 💅-funfolding-case-scaling=⟨n⟩— default:30. Applies a penalty of (inlining_cost * 1/n) for each level of case nesting.-funfolding-case-threshold=⟨n⟩— default:2. Reduces inlining for cases nested deeper than n.-funfolding-creation-threshold=⟨n⟩— default:750. Tweaks unfolding settings 🎀-funfolding-dict-discount=⟨n⟩— default:30. Tweaks unfolding settings.-funfolding-fun-discount=⟨n⟩— default:60. Tweaks unfolding settings.-funfolding-keeness-factor=⟨n⟩— ngl this one's been deprecated in GHC 9.0.1 💀 (and yes, "keeness" is spelled like that on the page, we respect the spelling)-funfolding-use-threshold=⟨n⟩— default:80. Tweaks unfolding settings.-fworker-wrapper— enables the worker/wrapper transformation ⭐-fworker-wrapper-cbv— enables w/w splits for wrappers whose sole purpose is evaluating arguments.
⚡ Optimization levels ⚡
-O— enable level 1 optimisations 🔥-O0— disable optimisations (this is the default, bestie)-O2— enable level 2 optimisations 👑-O⟨n⟩— any-Onwhere n > 2 is the same as-O2. So like… stop trying to be extra with-O7🥲
📦 Package options 📦
-clear-package-db— clears the package db stack.-distrust ⟨pkg⟩— exposes package ⟨pkg⟩ and sets it to be distrusted. See safe-haskell.-distrust-all-packages— distrusts all packages by default. See safe-haskell.-fpackage-trust— enables the Safe Haskell trusted package requirement for trustworthy modules 🛡️-global-package-db— adds the global package db to the stack.-hide-all-packages— hides all packages by default 🙈-hide-package ⟨pkg⟩— hides package ⟨pkg⟩-ignore-package ⟨pkg⟩— ignores package ⟨pkg⟩-no-auto-link-packages— doesn't automatically link in thebaseandrtspackages.-no-global-package-db— removes the global package db from the stack.-no-user-package-db— removes the user's package db from the stack.-package ⟨pkg⟩— exposes package ⟨pkg⟩ ✨-package-db ⟨file⟩— adds ⟨file⟩ to the package db stack.-package-env ⟨file⟩|⟨name⟩— uses the specified package environment.-package-id ⟨unit-id⟩— exposes a package by id ⟨unit-id⟩-this-unit-id ⟨unit-id⟩— compiles to be part of unit (i.e. package) ⟨unit-id⟩-trust ⟨pkg⟩— exposes package ⟨pkg⟩ and sets it to be trusted. See safe-haskell 🫶-user-package-db— adds the user's package db to the stack.
🌸 Phases of compilation 🌸
--merge-objs— merges a set of objects into a GHCi library.-C— stop after generating the C file (.hcfile) 📄-c— stop after generating the object file (.ofile)-E— stop after preprocessing (.hsppfile)-F— enable the use of a pre-processor (set it with-pgmF ⟨cmd⟩)-S— stop after generating assembly (.sfile)-x ⟨suffix⟩— overrides default behaviour for source files
🧚 Overriding external programs 🧚
Ok so the case here MATTERS, bestie —-pgmLand-pgmlare two completely different things and mixing them up is giving chaos 💀
-pgma ⟨cmd⟩— use ⟨cmd⟩ as the assembler-pgmc ⟨cmd⟩— use ⟨cmd⟩ as the C compiler-pgmcxx ⟨cmd⟩— use ⟨cmd⟩ as the C++ compiler-pgmdll ⟨cmd⟩— use ⟨cmd⟩ as the DLL generator-pgmF ⟨cmd⟩— use ⟨cmd⟩ as the pre-processor (only with-F)-pgmi ⟨cmd⟩— use ⟨cmd⟩ as the external interpreter command.-pgminstall_name_tool ⟨cmd⟩— use ⟨cmd⟩ as the program to inject runpath into mach-o dylibs on macOS 🍎-pgmL ⟨cmd⟩— use ⟨cmd⟩ as the literate pre-processor-pgml ⟨cmd⟩— use ⟨cmd⟩ as the linker-pgmlc ⟨cmd⟩— use ⟨cmd⟩ as the LLVM compiler-pgmlibtool ⟨cmd⟩— use ⟨cmd⟩ as the command for libtool (only with-staticlib).-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 to inspect mach-o dylibs on macOS 🍎-pgmP ⟨cmd⟩— use ⟨cmd⟩ as the C pre-processor (only with-cpp)-pgms ⟨cmd⟩— use ⟨cmd⟩ as the splitter-pgmwindres ⟨cmd⟩— use ⟨cmd⟩ as the program for embedding manifests on Windows 🪟
🎀 Phase-specific options 🎀
-opta ⟨option⟩— pass ⟨option⟩ to the assembler-optc ⟨option⟩— pass ⟨option⟩ to the C compiler-optcxx ⟨option⟩— pass ⟨option⟩ to the C++ compiler-optdll ⟨option⟩— pass ⟨option⟩ to the DLL generator-optF ⟨option⟩— pass ⟨option⟩ to the custom pre-processor-opti ⟨option⟩— pass ⟨option⟩ to the interpreter sub-process.-optL ⟨option⟩— pass ⟨option⟩ to the literate pre-processor-optl ⟨option⟩— pass ⟨option⟩ to the linker-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⟩ to cpp (only with-cpp)-optwindres ⟨option⟩— pass ⟨option⟩ to windres.-pgmc-supports-no-pie— (deprecated) indicates that the linker supports-no-pie💀-pgml-supports-no-pie— indicates that the linker supports-no-pie
🌈 Platform-specific options 🌈
-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-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 💜
-fclear-plugins— clears the list of active plugins-fplugin-opt=⟨module⟩:⟨args⟩— gives arguments to a plugin module; the module must be specified with-fplugin=⟨module⟩-fplugin-trustworthy— trusts the plugins being used and stops marking the compiled module as unsafe 🫶-fplugin=⟨module⟩— loads a plugin exported by the given module-hide-all-plugin-packages— hides all packages for plugins by default 🙈-plugin-package ⟨pkg⟩— exposes ⟨pkg⟩ for plugins-plugin-package-id ⟨pkg-id⟩— exposes ⟨pkg-id⟩ for plugins
🍓 Profiling 🍓
-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— doesn't collect entry counts-fprof-auto— auto-adds SCCs to all bindings not markedINLINE-fprof-auto-calls— auto-adds SCCs to all call sites-fprof-auto-exported— auto-adds SCCs to all exported bindings not markedINLINE-fprof-auto-top— auto-adds SCCs to all top-level bindings not markedINLINE-fprof-cafs— auto-adds SCCs to all CAFs-fprof-callers=⟨name⟩— auto-adds SCCs to all call-sites of the named function.-fprof-late— auto-adds SCCs to all top level bindings after the core pipeline has run.-fprof-late-inline— auto-adds SCCs to all top level bindings after the optimizer has run, and retains them when inlining 👑-fprof-manual— processes 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— turns on profiling 🔥-ticky— turns on ticky-ticky profiling ⭐-ticky-allocd— keeps a lil tally of how many times each closure type gets allocated ✨-ticky-ap-thunk— skips the standard AP thunks so your entry counters come out more reliable 🎯-ticky-dyn-thunk— tracks allocations of dynamic thunks, bestie 💅-ticky-LNE— treats join point binders kinda like thunks/functions, iykyk-ticky-tag-checks— emits dummy ticky counters so you can see how many tag-inference checks tag inference actually dodged 👑
🌸 Program coverage 🌸
-fhpc— turns on Haskell program coverage instrumentation 🎀-hpcdir⟨dir⟩— sets the directory where GHC puts its.mixfiles 🗂️
🦋 Recompilation checking 🦋
-fforce-recomp— turns recompilation checking off. Lowkey important: this is implied by any-ddump-Xoption when you're 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 it's enabled by default for GHCi 🫶-fignore-optim-changes— don't recompile modules just to match changes to optimisation flags. Also especially useful for avoiding recompilation when using GHCi, and also enabled by default for GHCi ✨
💜 Redirecting output 💜
--exclude-module=⟨file⟩— regards ⟨file⟩ as "stable"; i.e. excludes it from having dependencies on it 🧚-ddump-mod-cycles— dumps module cycles 🔄-dep-makefile ⟨file⟩— uses ⟨file⟩ as the makefile 📄-dep-suffix ⟨suffix⟩— makes dependencies that declare that files with suffix.⟨suf⟩⟨osuf⟩depend on interface files with suffix.⟨suf⟩hi🔗-dumpdir ⟨dir⟩— redirects dump files 📁-dynhisuf ⟨suffix⟩— sets the suffix to use for dynamic interface files-dyno ⟨file⟩— sets the dynamic output filename-dynohi ⟨file⟩— sets the filename in which to put the dynamic interface-dynosuf ⟨suffix⟩— sets the dynamic output file suffix-hcsuf ⟨suffix⟩— sets the suffix to use for intermediate C files-hidir ⟨dir⟩— sets the directory for interface files-hiedir ⟨dir⟩— sets the directory for extended interface files-hiesuf ⟨suffix⟩— sets the suffix to use for extended interface files-hisuf ⟨suffix⟩— sets the suffix to use for interface files-include-cpp-deps— includes preprocessor dependencies-include-pkg-deps— regards modules imported from packages as unstable 👀-o ⟨file⟩— sets the output filename-odir ⟨dir⟩— sets the directory for object files-ohi ⟨file⟩— sets the filename in which to put the interface-osuf ⟨suffix⟩— sets the output file suffix-outputdir ⟨dir⟩— sets the output directory-stubdir ⟨dir⟩— redirects FFI stub files 🧩
🍓 Temporary files 🍓
-tmpdir ⟨dir⟩— sets the directory for temporary files 🗃️
⭐ Verbosity options ⭐
-fabstract-refinement-hole-fits— default: off. Toggles whether refinements where one or more of the holes are abstract get reported 🔍-fdefer-diagnostics— defers and groups diagnostic messages by severity 📊-fdiagnostics-color=⟨always|auto|never⟩— uses colors in error messages 🌈-fdiagnostics-show-caret— whether to show snippets of the original source code 🎯-ferror-spans— outputs the full span in error messages-fhide-source-paths— hides module source and object paths 🙈-fkeep-going— keeps compiling as far as possible even when there are errors 💪-fmax-refinement-hole-fits=⟨n⟩— default: 6. Sets the maximum number of refinement hole fits for typed holes to display in type error messages.-fmax-relevant-binds=⟨n⟩— default: 6. Sets the maximum number of bindings to display in type error messages.-fmax-valid-hole-fits=⟨n⟩— default: 6. Sets 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— displays equation incompatibilities in closed type families-fprint-equality-relations— distinguishes between equality relations when printing-fprint-expanded-synonyms— in type errors, also prints type-synonym-expanded types 📝-fprint-explicit-coercions— prints coercions in types-fprint-explicit-foralls— prints explicitforallquantification in types. See alsoExplicitForAll👑-fprint-explicit-kinds— prints explicit kind foralls and kind arguments in types. See alsoKindSignatures✨-fprint-explicit-runtime-reps— printsRuntimeRepandLevityvariables in types which are runtime-representation polymorphic 🔬-fprint-potential-instances— displays all available instances in type error messages-fprint-typechecker-elaboration— prints extra information from the typechecker 🕵️-fprint-unicode-syntax— uses unicode syntax when printing expressions, types and kinds. See alsoUnicodeSyntax💖-frefinement-level-hole-fits=⟨n⟩— default: off. Sets the level of refinement of the refinement hole fits, where level n means that hole fits of up to n holes will be considered.-freverse-errors— outputs errors in reverse order 🔃-fshow-docs-of-hole-fits— toggles whether to show the documentation of the valid hole fits in the output 📚-fshow-hole-constraints— shows constraints when reporting typed holes-fshow-hole-matches-of-hole-fits— toggles whether to show the type of the additional holes in refinement hole fits-fshow-provenance-of-hole-fits— toggles whether to show the provenance of the valid hole fits in the output-fshow-type-app-of-hole-fits— toggles whether to show the type application of the valid hole fits in the output-fshow-type-app-vars-of-hole-fits— toggles whether to show what type each quantified variable takes in a valid hole fit-fshow-type-of-hole-fits— toggles whether to show the type of the valid hole fits in the output-fsort-by-size-hole-fits— sorts valid hole fits by size 📏-fsort-by-subsumption-hole-fits— sorts valid hole fits by subsumption-funclutter-valid-hole-fits— unclutters the list of valid hole fits by not showing provenance nor type applications of suggestions 🧹-Rghc-timing— summarises timing stats for GHC (same as+RTS -tstderr) ⏱️-v— verbose mode (equivalent to-v3) 🗣️-v⟨n⟩— sets verbosity level
🎀 Warnings 🎀
-fdefer-out-of-scope-variables— converts variable out of scope variable errors into warnings. Implied by-fdefer-type-errors. See also-Wdeferred-out-of-scope-variables. 🫣-fdefer-type-errors— turns 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— converts typed hole errors into warnings, deferring the error until runtime. Implied by-fdefer-type-errors. See also-Wtyped-holes. 🕳️-fenable-th-splice-warnings— generates warnings for Template Haskell splices-fhelpful-errors— makes suggestions for mis-spelled names 🩹-fmax-pmcheck-models=⟨n⟩— soft limit on the number of 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— uses the C code generator-W— enables normal warnings ✨-w— disables all warnings 🔇-Wall— enables almost all warnings (details in options-sanity) 🌈-Wall-missed-specialisations— warns when specialisation of any overloaded function fails-Wall-missed-specializations— alias for-Wall-missed-specialisations(yes bestie, both spellings, it's giving "we got you") 💅-Wambiguous-fields— warns about ambiguous field selectors or updates-Wauto-orphans— (deprecated) does nothing. Literally nothing. Iconic of it honestly 💀-Wcompat— enables future compatibility warnings (details in options-sanity)-Wcompat-unqualified-imports— reports unqualified imports of core libraries which are expected to cause compatibility problems in future releases 🚧-Wcpp-undef— warns on uses of the#ifdirective on undefined identifiers-Wdefault— enables default flags-Wdeferred-out-of-scope-variables— reports warnings when variable out-of-scope errors are deferred until runtime. See-fdefer-out-of-scope-variables. 👀-Wdeferred-type-errors— reports warnings when deferred type errors are enabled. This option is enabled by default. See-fdefer-type-errors. ⭐-Wdeprecated-flags— warns about uses of commandline flags that are deprecated ⚠️-Wdeprecations— warns about uses of functions & types that have warnings or deprecated pragmas. Alias for-Wwarnings-deprecations.-Wderiving-defaults— warns about default deriving when using bothDeriveAnyClassandGeneralizedNewtypeDeriving-Wderiving-typeable— warns whenTypeableis derived-Wdodgy-exports— warns about dodgy exports 👀-Wdodgy-foreign-imports— warns about dodgy foreign imports-Wdodgy-imports— warns about dodgy imports-Wduplicate-constraints— warns when a constraint appears duplicated in a type signature-Wduplicate-exports— warns when an entity is exported multiple times 🔁-Wempty-enumerations— warns about enumerations that are empty 🫙-Werror— makes warnings fatal ☠️-Weverything— enables all warnings supported by GHC (the whole buffet, no cap) 🔥-Wextra— alias for-W-Wforall-identifier— warns whenforallis used as an identifier (at definition sites)-Wgadt-mono-local-binds— warns when pattern matching on a GADT withoutMonoLocalBinds-Whi-shadowing— (deprecated) warns when a.hifile in the current directory shadows a library 🫥-Widentities— warns about uses ofPreludenumeric conversions that are probably the identity (and hence could be omitted) 🪞-Wimplicit-kind-vars— (deprecated) warns when kind variables are implicitly quantified over.-Wimplicit-lift— warns about implicit lift in Template Haskell quotes.-Wimplicit-prelude— warns when thePreludeis implicitly imported.-Winaccessible-code— warns about inaccessible code.-Wincomplete-patterns— warns when a pattern match could fail. bestie, this is the “yourcaseis not as complete as you think” alarm 🚨-Wincomplete-record-updates— warns when a record update could fail.-Wincomplete-uni-patterns— warns when a pattern match in a lambda expression, pattern binding or a lazy pattern could fail.-Winferred-safe-imports— warns 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 be inlined before the rule has a chance to fire. Seerules-inline.-Winvalid-haddock— warns when a Haddock comment occurs in an invalid position.-Wmisplaced-pragmas— warns about uses of file header pragmas in the module body.-Wmissed-extra-shared-lib— warns whenGHCican’t load a shared lib.-Wmissed-specialisations— warns when specialisation of an imported, overloaded function fails.-Wmissed-specializations— alias for-Wmissed-specialisations.-Wmissing-deriving-strategies— warns when aderivingclause is missing a deriving strategy.-Wmissing-export-lists— warns when a module declaration does not explicitly list all exports.-Wmissing-exported-pattern-synonym-signatures— warns about pattern synonyms without signatures, only if they are exported.-Wmissing-exported-signatures— warns about top-level functions without signatures, only if they are exported.-Wmissing-exported-sigs— (deprecated) warns about top-level functions without signatures, only if they are exported; takes precedence over-Wmissing-signatures.-Wmissing-fields— warns when fields of a record are uninitialised.-Wmissing-home-modules— warns when encountering a home module imported, but not listed on the command line. Useful for cabal to ensure GHC won’t pick up modules not listed in eitherexposed-modulesorother-modules.-Wmissing-import-lists— warns when an import declaration does not explicitly list all the names brought into scope.-Wmissing-kind-signatures— warns when type declarations don’t have kind signatures nor CUSKs.-Wmissing-local-signatures— warns about polymorphic local bindings without signatures.-Wmissing-local-sigs— (deprecated) warns about polymorphic local bindings without signatures.-Wmissing-methods— warns when class methods are undefined.-Wmissing-monadfail-instances— (deprecated) warns when a failable pattern is used in ado-block that does not have aMonadFailinstance.-Wmissing-pattern-synonym-signatures— warns when pattern synonyms do not have type signatures.-Wmissing-safe-haskell-mode— warns when the Safe Haskell mode is not explicitly specified.-Wmissing-signatures— warns about top-level functions without signatures.-Wmissing-space-after-bang— (deprecated) does nothing. literally nothing. iconically useless 💀-Wmonomorphism-restriction— warns when the Monomorphism Restriction is applied.-Wname-shadowing— warns when names are shadowed.-Wno-compat— disables all warnings enabled by-Wcompat.-Wnoncanonical-monad-instances— warns whenApplicativeorMonadinstances have noncanonical definitions ofreturn,pure,(>>), or(*>). See flag description inoptions-sanityfor more details.-Wnoncanonical-monadfail-instances— (deprecated) warns whenMonadorMonadFailinstances have noncanonical definitions offail.-Wnoncanonical-monoid-instances— warns whenSemigrouporMonoidinstances have noncanonical definitions of(<>)ormappend. See flag description inoptions-sanityfor more details.-Wnot— (deprecated) alias for-w.-Woperator-whitespace— warns on prefix, suffix, and tight infix uses of infix operators.-Woperator-whitespace-ext-conflict— warns on uses of infix operators that would be parsed differently were a particular GHC extension enabled.-Worphans— warns when the module contains orphan instance declarations or rewrite rules.-Woverflowed-literals— warns about literals that will overflow their type.-Woverlapping-patterns— warns about overlapping patterns.-Wpartial-fields— warns when defining a partial record field.-Wpartial-type-signatures— warns about holes in partial type signatures whenPartialTypeSignaturesis enabled. Not applicable whenPartialTypeSignaturesis not enabled, in which case errors are generated for such holes.-Wprepositive-qualified-module— reports imports with a leading/prepositive"qualified".-Wredundant-bang-patterns— warns about redundant bang patterns.-Wredundant-constraints— has the compiler warn about redundant constraints in type signatures.-Wredundant-record-wildcards— warns about record wildcard matches when the wildcard binds no patterns.-Wredundant-strictness-flags— warns about redundant strictness flags.-Wsafe— warns if the module being compiled is regarded to be safe.-Wsemigroup— warns when aMonoidis notSemigroup, and on non-Semigroupdefinitions of(<>)?-Wsimplifiable-class-constraints— warns about class constraints in a type signature that can be simplified using a top-level instance declaration.-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.-Wtrustworthy-safe— warns if the module being compiled is marked asTrustworthybut it could instead be marked asSafe, a more informative bound.-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-holes.-Wunbanged-strict-patterns— warns on pattern bind of unlifted variable that is neither bare nor banged.-Wunicode-bidirectional-format-characters— warns about the usage of unicode bidirectional layout override characters.-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.-Wunsafe— warns if the module being compiled is regarded to be unsafe. Seesafe-haskell.-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. 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.-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 not 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.-Wwarnings-deprecations— warns about uses of functions & types that have warnings or deprecated pragmas.-Wwrong-do-bind— warns aboutdobindings that appear to throw away monadic values that you should have bound instead.
💖 COPYRIGHT 💖
Copyright 2015. The University Court of the University of Glasgow. All rights reserved.
🌈 SEE ALSO 🌈
https://www.haskell.org/ghc — the GHC homepage, bestie. go touch grass and read the docs 🦋
👑 AUTHOR 👑
The GHC Team
🎀 COPYRIGHT 🎀
2023, GHC Team
okay that’s the whole page, bestie — source/version 9.4.8, dated Nov 25, 2023. may your builds be green and your warnings be intentional 💅✨🫶
📦 where this page comes from
- epel 9: ghc9.4-compiler 9.4.8-25.el9 · BSD-3-Clause
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms