GHC(1)
okay bestie 🫶 you just opened ghc(1) — the manual page for the Glasgow Haskell Compiler — and honestly? iconic. this one is long so grab a snack 🍓, we're going through all of it together, no cap.
✨ NAME ✨
ghc — the Glasgow Haskell Compiler. that's it, that's the whole name 💅
🎀 SYNOPSIS 🎀
ghc [option|filename]
ghci [option|filename]
💖 DESCRIPTION 💖
okay so this manual page gives you the brief rundown of the ghc and ghci commands. important heads up: ghci is not yet available on all architectures 😭 so if it's not there for you, that's why, it's not you it's the arch.
the extensive docs live in a bunch of other formats too, including PDF and HTML:
- PDF —
https://downloads.haskell.org/ghc/latest/docs/users_guide.pdf - HTML —
https://downloads.haskell.org/ghc/latest/docs/html/
every single one of GHC's command line options gets sorted into exactly one of two categories, and this is genuinely the main character of this whole section:
- static — a static flag may only be given on the command line, periodt
- dynamic — a dynamic flag can also be dropped into 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 lists the status of each flag. (yes it says "sections", we are quoting, do not come for me 🙈)
the common suffixes of file names for Haskell are, and yes you need to know all of them:
.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:
👑 OPTIONS 👑
here's the whole menu, bestie. every single flag, nothing skipped, we are NOT doing the "etc." thing in this house 💅
🔥 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
not me listing-fllvmand-fasmtwice. that's literally how the page has it, i'm just the messenger 🫠
🐛 Debugging the compiler
the debug flags, aka where the real ones live. all of them. yes all of them.
-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⟩
🌈 C pre-processor
-cpp-D⟨symbol⟩[=⟨value⟩]-U⟨symbol⟩-I⟨dir⟩-U⟨symbol⟩
🔍 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 -X list. the big one. every single extension, in order, don't blink 👑
-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⟩
🎲 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⟩
that's the whole OPTIONS menu for this part 🫶 keep going bestie, there's more where that came from ✨
✨ Modes of operation ✨
Okay bestie, first up: the modes. These are like the different outfits GHC can wear depending on what you need. Pick your vibe:
--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
💅 Individual optimizations 💅
These are the little tweaks, the micro-adjustments, the chef's kiss to your compilation. There are SO many, but you got this. Slay.
-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-clever-arg-eta-expansion-fno-do-clever-arg-eta-expansion-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-finter-module-far-jumps-fno-inter-module-far-jumps-fkeep-auto-rules-fno-keep-auto-rules-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-flocal-float-out-fno-local-float-out-flocal-float-out-top-level-fno-local-float-out-top-level-floopification-fno-loopification-fmax-forced-spec-args=⟨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⟩-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-fpolymorphic-specialisation-fno-polymorphic-specialisation-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-fspec-eval-fno-spec-eval-fspec-eval-dictfun-fno-spec-eval-dictfun-fspecialise-fno-specialise-fspecialise-aggressively-fno-specialise-aggressively-fspecialise-incoherents-fno-specialise-incoherents-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
Whew, that's a lot of optimizations, but you got this bestie 💅
🔥 Optimization levels 🔥
The classics, the OGs. Pick your level of spicy:
-O-O1-O0-O0-O2-O0-O⟨n⟩-O0
Yes, -O0 is listed multiple times, iconic behavior, don't question it.
📦 Package options 📦
For when you need to manage your packages, bestie:
-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
🎭 Phases of compilation 🎭
The stages of the game:
--merge-objs-C-c-E-F-S-x ⟨suffix⟩
🔧 Overriding external programs 🔧
When you wanna use your own tools:
-pgma ⟨cmd⟩-pgmc ⟨cmd⟩-pgmCmmP ⟨cmd⟩-pgmcxx ⟨cmd⟩-pgmF ⟨cmd⟩-pgmi ⟨cmd⟩-pgminstall_name_tool ⟨cmd⟩-pgmJSP ⟨cmd⟩-pgmL ⟨cmd⟩-pgml ⟨cmd⟩-pgmlas ⟨cmd⟩-pgmlc ⟨cmd⟩-pgmlm ⟨cmd⟩-pgmlo ⟨cmd⟩-pgmotool ⟨cmd⟩-pgmP ⟨cmd⟩-pgms ⟨cmd⟩-pgmwindres ⟨cmd⟩
⚙️ Phase-specific options ⚙️
Passing options to specific phases:
-opta ⟨option⟩-optc ⟨option⟩-optCmmP ⟨option⟩-optcxx ⟨option⟩-optF ⟨option⟩-opti ⟨option⟩-optJSP ⟨option⟩-optL ⟨option⟩-optl ⟨option⟩-optlas ⟨option⟩-optlc ⟨option⟩-optlm ⟨option⟩-optlo ⟨option⟩-optP ⟨option⟩-optwindres ⟨option⟩-pgmc-supports-no-pie-pgml-supports-no-pie
🖥️ Platform-specific options 🖥️
For when you want to target specific CPU features:
-mavx-mavx2-mavx512cd-mavx512er-mavx512f-mavx512pf-mbmi-mbmi2-mfma-msse-msse2-msse3-msse4-msse4.2
🔌 Compiler plugins 🔌
Extend GHC with your own plugins:
-fclear-plugins-fplugin-library=⟨file-path⟩;⟨unit-id⟩;⟨module⟩;⟨args⟩-fplugin-opt=⟨module⟩:⟨args⟩-fplugin-trustworthy-fplugin=⟨module⟩-hide-all-plugin-packages-plugin-package ⟨pkg⟩-plugin-package-id ⟨pkg-id⟩
📊 Profiling 📊
For when you want to know where your program spends time:
-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-late-overloaded-fno-prof-late-overloaded-fprof-late-overloaded-calls-fno-prof-late-overloaded-calls-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
🧪 Program coverage 🧪
For when you want to see what code is covered:
-fhpc-hpcdir⟨dir⟩
🔄 Recompilation checking 🔄
For when you want to control when things get recompiled:
-exclude-module=⟨file⟩-fforce-recomp-fno-force-recomp-fignore-hpc-changes-fno-ignore-hpc-changes-fignore-optim-changes-fno-ignore-optim-changes-include-cpp-deps-include-pkg-deps
📂 Redirecting output 📂
For when you want to put your files somewhere else:
-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⟩-o ⟨file⟩-odir ⟨dir⟩-ohi ⟨file⟩-osuf ⟨suffix⟩-outputdir ⟨dir⟩-stubdir ⟨dir⟩
🗑️ Temporary files 🗑️
For when you need a temp dir:
-tmpdir ⟨dir⟩
🌈 Verbosity options 🌈
For when you want ALL the details, bestie:
-fabstract-refinement-hole-fits-fno-abstract-refinement-hole-fits-fdefer-diagnostics-fdiagnostics-as-json-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-error-index-links=⟨always|auto|never⟩-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-redundant-promotion-ticks-fno-print-redundant-promotion-ticks-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-error-context-fno-show-error-context-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⟩
Warnings 💖
okay bestie, strap in, because this is the part where GHC yells at you — but like, lovingly. Every one of these is a toggle: the plain flag turns a warning on, and the -Wno- version turns it right back off. Some of them also have a -f-flavoured cousin living in the same list, because GHC contains multitudes. ✨
-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-Wno-extra-w-Wall,-Wno-all-Wall-missed-specialisations,-Wno-all-missed-specialisations-Wall-missed-specializations,-Wno-all-missed-specializations-Wambiguous-fields-Wauto-orphans-Wbadly-staged-types,-Wno-badly-staged-types-Wcompat,-Wno-compat-Wcompat-unqualified-imports,-Wno-compat-unqualified-imports-Wcpp-undef-Wdata-kinds-tc,-Wno-data-kinds-tc-Wdefault,-Wno-default-Wdefaulted-exception-context,-Wnop-defaulted-exception-context-Wdeferred-out-of-scope-variables,-Wno-deferred-out-of-scope-variables-Wdeferred-type-errors,-Wno-deferred-type-errors-Wdeprecated-flags,-Wno-deprecated-flags-Wdeprecated-type-abstractions,-Wno-deprecated-type-abstractions-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-w-Wextended-warnings,-Wno-extended-warnings-Wextra,-Wno-extra-Wforall-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-Wimplicit-rhs-quantification,-Wno-implicit-rhs-quantification-Winaccessible-code,-Wno-inaccessible-code-Wincomplete-export-warnings,-Wno-incomplete-export-warnings-Wincomplete-patterns,-Wno-incomplete-patterns-Wincomplete-record-selectors,-Wno-incomplete-record-selectors-Wincomplete-record-updates,-Wno-incomplete-record-updates-Wincomplete-uni-patterns,-Wno-incomplete-uni-patterns-Winconsistent-flags,-Wno-inconsistent-flags-Winferred-safe-imports,-Wno-inferred-safe-imports-Winline-rule-shadowing,-Wno-inline-rule-shadowing-Winvalid-haddock,-Wno-invalid-haddock-Wloopy-superclass-solve,-Wno-loopy-superclass-solve-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-poly-kind-signatures,-Wno-missing-poly-kind-signatures-Wmissing-role-annotations,-Wno-role-annotations-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-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-Wterm-variable-capture-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-unsupported-llvm-version-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-Wx-⟨category⟩,-Wno-x-⟨category⟩
yes, some of these show up more than once in this list. no, i did not gaslight you. that's just how it's written. 🙈
Code generation ✨
the part where GHC actually makes the machine code, bestie. pick your fighter:
-dynamic-too— Build dynamic object files as well as static object files during compilation-fasm— Use the native code generator-fbyte-code— Generate byte-code-fbyte-code-and-object-code— Generate object code and byte-code-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)-fPIE— Generate code for a position-independent executable (where available)-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 🦋
this is the behind the scenes tour, the vlog footage, the backstage pass. GHC can dump its own guts at basically every stage of the pipeline and you get to read them. it's giving "scientist in a lab" and honestly? iconic. 🔬
-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 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— dumps the raw C--, absolutely unfiltered, right out of the oven 💅-ddump-cmm-sink— shows you what came out the other side of the C-- sinking pass.-ddump-cmm-sp— the results of the C-- stack layout pass.-ddump-cmm-split— the results of the C-- proc-point splitting pass.-ddump-cmm-switch— the results of switch lowering passes ✨-ddump-cmm-thread-sanitizer— the results of the C-- ThreadSanitizer elaboration pass.-ddump-cmm-verbose— writes output from main C-- pipeline passes to files.-ddump-cmm-verbose-by-proc— shows output from main C-- pipeline passes, grouped by proc, bestie 🫶-ddump-core-stats— prints a one-line summary of the size of the Core program at the end of the optimisation pipeline.-ddump-cpr-signatures— dumps CPR signatures.-ddump-cpranal— dumps CPR analysis output.-ddump-cs-trace— traces the constraint solver. watching it think fr fr 🧠-ddump-cse— dumps CSE output.-ddump-debug— dumps generated DWARF debug information.-ddump-deriv— dumps deriving output.-ddump-dmd-signatures— dumps top-level demand signatures.-ddump-dmdanal— dumps demand analysis output.-ddump-ds— dumps desugarer output.-ddump-ec-trace— traces the exhaustiveness checker.-ddump-exitify— dumps the output of the exitification pass.-ddump-faststrings— dumps the whole FastString table when finished.-ddump-file-prefix=⟨str⟩— sets the prefix of the filenames used for debugging output. so your dumps get cute little names 🎀-ddump-float-in— dumps float in output.-ddump-foreign— dumps foreign export stubs.-ddump-full-laziness— dumps full laziness pass output.-ddump-hie— dumps the hie file syntax tree.-ddump-hpc— an alias for-ddump-ticked.-ddump-if-trace— traces interface files.-ddump-inlinings— dumps the inlinings performed by the simplifier.-ddump-js— dumps the final JavaScript code.-ddump-json— (deprecated) use-fdiagnostics-as-jsoninstead. she's retired, respectfully 💀-ddump-late-cc— dumps core with late cost centres added.-ddump-liberate-case— dumps liberate case output.-ddump-llvm— dumps LLVM intermediate code.-ddump-mod-map— dumps the state of the module mapping database.-ddump-occur-anal— dumps occurrence analysis output.-ddump-opt-cmm— dumps the results of C-- to C-- optimising passes.-ddump-parsed— dumps the parse tree.-ddump-parsed-ast— dumps parser output as a syntax tree.-ddump-prep— dumps prepared core.-ddump-rn— dumps renamer output.-ddump-rn-ast— dumps renamer output as a syntax tree.-ddump-rn-stats— renamer stats, numbers girlie 📊-ddump-rn-trace— traces the renamer.-ddump-rtti— traces runtime type inference.-ddump-rule-firings— dumps rule firing info.-ddump-rule-rewrites— dumps the detailed rule firing info, receipts and all 🧾-ddump-rules— dumps rewrite rules.-ddump-simpl— dumps the final simplifier output.-ddump-simpl-iterations— dumps output from each simplifier iteration.-ddump-simpl-stats— dumps simplifier stats.-ddump-simpl-trace— dumps trace messages in the simplifier.-ddump-spec— dumps specialiser output.-ddump-spec-constr— dumps specialiser output from SpecConstr.-ddump-splices— dumps TH spliced expressions, and what they evaluate to.-ddump-static-argument-transformation— dumps static argument transformation output.-ddump-stg— (deprecated) alias for-ddump-stg-from-core.-ddump-stg-cg— shows output after Stg2Stg.-ddump-stg-final— shows output of the last STG pass.-ddump-stg-from-core— shows CoreToStg output.-ddump-stg-tags— shows output of the tag inference pass.-ddump-stg-unarised— shows unarised STG.-ddump-str-signatures— (deprecated) alias for-ddump-dmd-signatures.-ddump-stranal— (deprecated) alias for-ddump-dmdanal.-ddump-tc— dumps typechecker output.-ddump-tc-ast— dumps typechecker output as a syntax tree.-ddump-tc-trace— traces the typechecker. her inner monologue, live 🌸-ddump-ticked— dumps the code instrumented by HPC (Observing Code Coverage).-ddump-timings— dumps per-pass timing and allocation statistics.-ddump-to-file— dumps to files instead of stdout.-ddump-types— dumps type signatures.-ddump-verbose-inlinings— dumps all considered inlinings, not just the chosen ones 👀-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⟩— starts UniqSupply allocation from ⟨s⟩.-dinline-check=⟨str⟩— dumps information about inlining decisions.-dipe-stats— shows statistics about IPE information.-dkeep-comments— includes comments in the parser. super useful in combination with-ddump-parsed-ast.-dlinear-core-lint— turns on internal sanity checking.-dlint— enables several common internal sanity checkers. the lint goblins are awake 🧚-dno-debug-output— suppresses unsolicited debugging output.-dno-typeable-binds— doesn't generate bindings for Typeable methods.-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.-dstg-lint— STG pass sanity checking.-dsuppress-all— in dumps, suppresses everything (except for uniques) that is suppressible. the minimalist era 💅-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 use diff).-dsuppress-var-kinds— suppresses the printing of variable kinds.-dtag-inference-checks— affirms 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⟩. iykyk, it's a numbering thing.-dverbose-core2core— Shows output from each core-to-core pass. ✨-dverbose-stg2stg— Shows output from each STG-to-STG pass. ✨-falignment-sanitisation— Compile with alignment checks for all info table dereferences.-fcatch-nonexhaustive-cases— Adds a default error alternative tocaseexpressions that don't have a default alternative. Non-exhaustive patterns are getting caught, bestie 💅-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— Intruct LLVM to fill dead STG registers with garbage. (Yes, "Intruct". We keep it. Verbatim. No cap. 💀)-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 given boundary.-funoptimized-core-for-interpreter— Disable optimizations with the interpreter.-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— Empty 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 (see the GHCi debugger section on exceptions).-fbreak-on-exception— Break on any exception thrown (see the GHCi debugger section on exceptions).-fbreak-points— Insert breakpoints in the GHCi debugger (see the GHCi debugger section).-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 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 (see the GHCi statements section).-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 (see the GHCi interactive print section).
🌸 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 🎀
-keep-hc-file— Retain intermediate.hcfiles.-keep-hi-files— Retain intermediate.hifiles (the default).-keep-hscpp-file— Retain intermediate.hscppfiles.-keep-llvm-file— Retain intermediate LLVM.llfiles. Implies-fllvm.-keep-o-files— Retain intermediate.ofiles (the default).-keep-s-file— Retain intermediate.sfiles.-keep-tmp-files— Retain all intermediate temporary files.
👑 Language options 👑
Okay bestie, this is the big one. Every single one of these is a -X language extension, and they all stack. Buckle up 💖
-XAllowAmbiguousTypes— Allow the user to write ambiguous types, and the type inference engine to infer them.-XApplicativeDo— EnableApplicativedo-notation desugaring.-XArrows— Enable arrow notation extension.-XBangPatterns— Enable bang patterns.-XBinaryLiterals— Enable support for binary literals.-XBlockArguments— Allowdoblocks and other constructs as function arguments.-XCApiFFI— Enable theCAPIcalling convention.-XConstrainedClassMethods— Enable constrained class methods. Implied byMultiParamTypeClasses.-XConstraintKinds— Enable a kind of constraints.-XCPP— Enable the C preprocessor.-XCUSKs— Enable detection of complete user-supplied kind signatures.-XDataKinds— Enable datatype promotion.-XDatatypeContexts— Allow contexts on data types.-XDeepSubsumption— Enable deep subsumption.-XDefaultSignatures— Enable default signatures.-XDeriveAnyClass— Enable deriving for any class.-XDeriveDataTypeable— Enable deriving for theDataclass.-XDeriveFoldable— Enable deriving for theFoldableclass. Implied byDeriveTraversable.-XDeriveFunctor— Enable deriving for theFunctorclass. Implied byDeriveTraversable.-XDeriveGeneric— Enable deriving for theGenericclass.-XDeriveLift— Enable deriving for theLiftclass.-XDeriveTraversable— Enable deriving for theTraversableclass. ImpliesDeriveFunctorandDeriveFoldable.-XDerivingStrategies— Enables deriving strategies.-XDerivingVia— Enable deriving instances via types of the same runtime representation. ImpliesDerivingStrategies.-XDisambiguateRecordFields— Enable record field disambiguation. Implied byRecordWildCards.-XDuplicateRecordFields— Allow definition of record types with identically-named fields.-XEmptyCase— Allow empty case alternatives.-XEmptyDataDecls— Allow definition of empty data types.-XEmptyDataDeriving— Allow deriving instances of standard type classes for empty data types.-XExistentialQuantification— Enable liberalised type synonyms.-XExplicitForAll— Enable explicit universal quantification. Implied byScopedTypeVariables,LiberalTypeSynonyms,RankNTypesandExistentialQuantification.-XExplicitNamespaces— Enable using the keywordtypeto specify the namespace of entries in imports and exports (Explicit namespaces in import/export). Implied byTypeOperatorsandTypeFamilies.-XExtendedDefaultRules— Use GHCi's extended default rules in a normal module.-XExtendedLiterals— Enable numeric literal postfix syntax for unboxed integers.-XFieldSelectors— Control visibility of field selector functions.-XFlexibleContexts— Remove some restrictions on class contexts.
Not me ending a part mid-list 🙈 there's so much more coming, don't you dare close the tab 🫶
-XFlexibleInstances— bestie this one unlocks flexible instances, so your instance heads can breathe 💅 heads up tho, it quietly turns onTypeSynonymInstancestoo (package deal, no takebacks).-XForeignFunctionInterface— turns on the foreign function interface so Haskell can go talk to C like the multilingual icon it is 🌈-XFunctionalDependencies— enables functional dependencies, aka telling the type checker "this param determines that one, trust me." It also switches onMultiParamTypeClasseson the way in ✨-XGADTs— enables generalised algebraic data types, the fancy ones. ImpliesGADTSyntaxandMonoLocalBinds— two for the price of one, we love an overachiever 👑-XGADTSyntax— just the syntax for generalised algebraic data types. The grammar, not the whole personality 🎀-XGeneralisedNewtypeDeriving— enables newtype deriving. Yes the British spelling, we respect it 💜-XGeneralizedNewtypeDeriving— same thing, z instead of s. Enables newtype deriving. Pick whichever spelling your heart wants, fr fr 🦋-XGHC2021— rolls out GHC's set of default language extensions from 2021 ⭐-XGHC2024— the same deal but GHC's default extension set from 2024. Fresh off the press 🔥-XGHCForeignImportPrim— enables the prim calling convention. 🚨 Intended for internal use only — this is not your bestie, this is GHC's own private business, stay out of it 💀-XHaskell2010— use the Haskell 2010 language edition. A classic, lowkey timeless 🫶-XHaskell98— use the Haskell 98 language edition. The vintage one, respect the elders ✨-XHexFloatLiterals— enables support for hexadecimal floating point literals. Yeah. Floats. In hex. Iconic behaviour ngl 🔥-XImplicitParams— enables Implicit Parameters. Capital I, capital P, very official 💅-XImportQualifiedPost— lets you write imports the cool way:import M qualified🎀-XImpredicativeTypes— enables impredicative types. ImpliesRankNTypesbecause of course it does 🌸-XIncoherentInstances— enables incoherent instances (yes that's the real name, it's giving chaos and we're here for it). ImpliesOverlappingInstances💫-XInstanceSigs— enables instance signatures, so your instances can have type sigs too. Equality 💜-XInterruptibleFFI— enables interruptible FFI. Now your foreign calls can be interrupted, main character energy 🌈-XKindSignatures— enables kind signatures. You get this for free whenTypeFamiliesorPolyKindsis on 🎀-XLambdaCase— enables lambda-case expressions, aka\case. Life-changing, no cap ✨-XLexicalNegation— uses whitespace to figure out whether a minus sign means negation or subtraction. Yes, spaces doing heavy lifting. Weird but slay 💅-XLiberalTypeSynonyms— enables liberalised type synonyms. Free the synonyms 🦋-XLinearTypes— enables linear types. ImpliesMonoLocalBinds. Very fancy, very rigorous, we stan a resource-tracking queen 👑-XListTuplePuns— enables punning for list, tuple and sum types. Puns! In my type system! 🍓-XMagicHash— allows#as a postfix modifier on identifiers. It's giving magic, hence the name, iykyk ✨-XMonadComprehensions— enables monad comprehensions. List comprehensions but make them monadic 💖-XMonoLocalBinds— enables "do not generalise local bindings." You get this automatically fromTypeFamiliesandGADTs🎀-XMultiParamTypeClasses— enables multi parameter type classes. You get it automatically fromFunctionalDependencies, and it impliesConstrainedClassMethodsin turn. Chain reaction 💫-XMultiWayIf— enables multi-way if-expressions. So many branches, so much drama 🌸-XNamedFieldPuns— enables record puns. Same word twice? Not anymore bestie 🦋-XNamedWildCards— enables named wildcards. Wildcards but they have names now, they're people ⭐-XNegativeLiterals— enables support for negative literals. Minus signs, but make them literal 💅-XNoImplicitPrelude— don't implicitly importPrelude. You get this automatically fromRebindableSyntax😌-XNoMonomorphismRestriction— disables the monomorphism restriction. Yes, the name is terrifying, no, you don't need to panic, it just turns the thing off 🙈-XNondecreasingIndentation— allows nested contexts to sit at the same indentation level as their enclosing context. Indentation freedom, finally 🎀-XNoPatternGuards— disables pattern guards. You get this automatically fromHaskell98💀-XNoTraditionalRecordSyntax— disables support for traditional record syntax (the Haskell 98 kind), the one that looks likeC {f = x}🫶-XNPlusKPatterns— enables support for n+k patterns. You get this automatically fromHaskell98⭐-XNullaryTypeClasses— 🚨 Deprecated, does nothing. Nullary (no parameter) type classes are now enabled viaMultiParamTypeClassesinstead. Rip to a real one, it's retired 💀-XNumDecimals— enables support for 'fractional' integer literals. Yes, the quotes are doing a lot of work there, I'm just the messenger 🍓-XNumericUnderscores— enables support for numeric underscores, so your big numbers can be readable. 1_000_000 vibes ✨-XOverlappingInstances— enables overlapping instances. They can share space now, very generous 💖-XOverloadedLabels— enables overloaded labels 🎀-XOverloadedLists— enables overloaded lists 🦋-XOverloadedRecordDot— gives you record.syntax 💅-XOverloadedRecordUpdate— gives you record.syntax for record updates ✨-XOverloadedStrings— enables overloaded string literals. Strings, but flexible ⭐-XPackageImports— enables package-qualified imports. Tell the compiler exactly which package you meant 🌈-XParallelListComp— enables parallel list comprehensions. Multiple comprehensions, side by side, iconic 💖-XPartialTypeSignatures— enables partial type signatures. You can leave blanks and let GHC fill them in 🎀-XPatternSynonyms— enables pattern synonyms. Patterns with nicknames, obsessed 🦋-XPolyKinds— enables kind polymorphism. ImpliesKindSignaturesbecause it needs them to do its thing 👑-XPostfixOperators— enables postfix operators ✨-XQualifiedDo— enables qualified do-notation desugaring 💫-XQuantifiedConstraints— allowsforallquantifiers in constraints. Big brain behaviour 🧚-XQuasiQuotes— enables quasiquotation. Yes it's spelled like that, yes it's as fun as it sounds 🌸-XRank2Types— enables rank-2 types. It's a straight-up synonym forRankNTypes💜-XRankNTypes— enables rank-N types. You get this automatically fromImpredicativeTypes⭐-XRebindableSyntax— employs rebindable syntax. ImpliesNoImplicitPrelude— it has to, bestie, otherwise the whole thing falls apart 💅-XRecordWildCards— enables record wildcards. ImpliesDisambiguateRecordFieldson the way in 🦋-XRecursiveDo— enables recursive do notation, akamdo🎀-XRequiredTypeArguments— enables required type arguments in terms ✨-XRoleAnnotations— enables role annotations 🌈-XSafe— enables the Safe Haskell Safe mode 🛡️-XScopedTypeVariables— enables lexically-scoped type variables. They stay in their lane, in the best way 💜-XStandaloneDeriving— enables standalone deriving. Derive anywhere, whenever you want 🦋-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. No lazy surprises, it's giving discipline 💅-XStrictData— enables default strict datatype fields 🎀-XTemplateHaskell— enables Template Haskell. The big one. Metaprogramming o'clock 👑-XTemplateHaskellQuotes— enables just the quotation subset of Template Haskell 🌸-XTransformListComp— enables generalised list comprehensions</generalised> 🦋-XTrustworthy— enables 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 types ✨-XTypeData— enables type data declarations 💖-XTypeFamilies— enables type families. ImpliesExplicitNamespaces,KindSignatures, andMonoLocalBinds. A whole bundle, she's generous 👑-XTypeFamilyDependencies— enables injective type families. ImpliesTypeFamilies🎀-XTypeInType— 🚨 Deprecated. It enables kind polymorphism and datatype promotion. She's old news bestie, move on 💀-XTypeOperators— enables type operators. ImpliesExplicitNamespaces🦋-XTypeSynonymInstances— enables type synonyms in instance heads. You get this automatically fromFlexibleInstances🌸-XUnboxedSums— enables unboxed sums ✨-XUnboxedTuples— enables the use of unboxed tuple syntax 💫-XUndecidableInstances— enables undecidable instances. Sounds scary, the name is literally warning you, proceed with vibes 💅-XUndecidableSuperClasses— allows all superclass constraints, including the ones that may result in non-termination of the typechecker. So like… yes it can loop forever. Dramatic but true 🚨-XUnicodeSyntax— enables unicode syntax. Your code can be pretty now ✨-XUnliftedDatatypes— enables unlifted data types 🎀-XUnliftedFFITypes— enables unlifted FFI types 🦋
-XUnliftedNewtypes— unlocks unlifted newtypes ✨-XUnsafe— turns on Safe Haskell's Unsafe mode 🫣 (yes, that's the vibe, dangerous by design)-XViewPatterns— enables view patterns 👀
🔗 Linking options 🔗
okay this whole cluster is about how your code actually gets glued together at the end, bestie, pay attention 💅
-c— stop right 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 (it gets passed as-install_nameto Apple's linker), which spells out 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— picks one of a bunch of modes for finding shared libraries at runtime-eventlog— enable runtime event tracing 📊-fcompact-unwind— tells 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— don't embed the manifest in the executable (Windows only)-fno-gen-manifest— don't generate a manifest file (Windows only)-fno-shared-implib— don't generate an import library for a DLL (Windows only)-framework⟨name⟩ — Darwin/OS X/iOS only: link in the framework ⟨name⟩. This option corresponds to the-frameworkoption for Apple's Linker 🍎-framework-path⟨dir⟩ — Darwin/OS X/iOS only: add ⟨dir⟩ to the list of directories searched for frameworks. This one corresponds to the-Foption for Apple's Linker 🍎-fsplit-sections— split sections so the linker can strip dead code ✂️-fuse-rpaths— set the rpath based on-Lflags-fwhole-archive-hs-libs— when you're 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 the 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— tells the linker to add all symbols, not only the used ones, to the dynamic symbol table. Currently Linux and Windows/MinGW32 only. 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. Let's break it down, bestie:nonemeans no RTS flags can be given at allsomemeans only a minimum of safe options can be given (this is the default)all(or no argument at all) means all RTS flags are permittedignoremeans RTS flags can be given, but they're treated as regular arguments and passed to the Haskell program as argumentsignoreAllis the same asignore, butGHCRTSis also ignored
and heads up: -rtsopts does not affect -with-rtsopts behavior; flags passed via -with-rtsopts are used regardless of -rtsopts 🫶
-shared— generate a shared library (as opposed to an executable)-single-threaded— use the single-threaded runtime-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 ⟨opts⟩
🛠️ Miscellaneous options 🛠️
the grab-bag section, we love her 💜
-ddump-mod-cycles— dump module cycles 🔄-fdefer-out-of-scope-variables— converts variable-out-of-scope 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.-fexternal-interpreter— run interpreted code in a separate process-ffamily-application-cache— use a cache when reducing type family applications-fglasgow-exts— Deprecated. Enables 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 🎭
pick your fighter ✨
--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. fr fr this one's the MVP 👑--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— tells you whether GHC was compiled with SMP support. yes/no, iconically simple 💅--print-support-smp... okay no, next one:--print-tables-next-to-code— shows whether GHC was compiled with--enable-tables-next-to-code.--print-target-platform— spits out the target platform of GHC. very "who am I, where am I going" of it ✨--print-unregisterised— reveals whether this GHC was built in unregisterised mode.--run⟨file⟩ — run a Haskell program. literally just run it bestie 🏃♀️--show-iface⟨file⟩ — displays the contents of an interface file. like opening someone's diary but it's.hifiles 📖--show-options— displays all the supported command line options. a whole menu, chef's kiss 👑--supported-extensions— displays the supported language extensions. the whole roster fr fr--version— displays the GHC version. the classic.-e⟨expr⟩ — evaluate expr; the full tea is in Expression evaluation mode 🍵-M— generate dependency information suitable for use in aMakefile; details live in Dependency generation.-shared— create a shared object. sharing is caring 🫶
✨ Individual optimizations ✨
okay bestie this is the optimization buffet. every flag here is a little dial you can turn, and a bunch of them come free when you turn on -O or -O2. no cap.
-fasm-shortcutting— enable shortcutting on assembly. implied by-O2. ✂️-fbinary-blob-threshold=⟨n⟩ — default:500K. tweaks the 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 the edge weights used by the new code layout algorithm.-fcall-arity— enable call-arity optimisation. implied by-O.-fcase-folding— enable constant folding incaseexpressions. 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. (perception is reality 💅)-fdicts-strict— make dictionaries strict. implied by-O2.-fdmd-tx-dict-sel— (deprecated) use a special demand transformer for dictionary selectors. old news, bestie 💀-fdmd-unbox-width=⟨n⟩ — default:3. boxity analysis pretends that returned records with this many fields can be unboxed.-fdo-clever-arg-eta-expansion— enable sophisticated argument eta-expansion. implied by-O. smart girl energy 🧠-fdo-eta-reduction— enable eta-reduction. always enabled by default.-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 the exitification optimisation. implied by-O.-fexpose-all-unfoldings— expose all unfoldings, even for very large or recursive functions. no hiding, we're all main characters here ✨-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. round two, bestie 🔁-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 ⟨n⟩.-fllvm-pass-vectors-in-regs— (deprecated) does nothing. truly the "no thoughts, head empty" flag 🫠-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. we love a good loop 🔄-fmax-forced-spec-args=⟨n⟩ — default:333. maximum number of value arguments for forcedSpecConstrspecializations.-fmax-inline-alloc-size=⟨n⟩ — default:128. set the maximum size of inline array allocations to ⟨n⟩ bytes (default:128).-fmax-inline-memcpy-insns=⟨n⟩ — default:32. inlinememcpycalls if they would generate no more than ⟨n⟩ pseudo instructions.-fmax-inline-memset-insns=⟨n⟩ — default:32. inlinememsetcalls if they would generate no more than ⟨n⟩ 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, 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. slow and steady wins the race 🐢-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:100. set the percentage factor for simplifier ticks.-fsimplifier-phases=⟨n⟩ — default:2. 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:3.*. set to ⟨n⟩ the maximum number of specialisations that will be created for any one function by theSpecConstrtransformation.-fspec-constr-keen— okay so this one is the SpecConstr girlie who does NOT need to be asked twice. It specialises a call that has an explicit constructor argument, even when that argument is literally not scrutinised anywhere in the body of the function. Keen! ✨-fspec-constr-threshold=⟨n⟩— default: 2000. Sets the size threshold for the SpecConstr transformation to ⟨n⟩.-fspec-eval— Enables speculative evaluation.-fspec-eval-dictfun— Enables speculative evaluation of dictionary functions.-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. no size gate, no chill.-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. it's giving chain reaction 🔥-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: 30. Apply a penalty of (inlining_cost * 1/n) for each level of case nesting.-funfolding-case-threshold=⟨n⟩— default: 2. Reduce inlining for cases nested deeper than n.-funfolding-creation-threshold=⟨n⟩— default: 750. Tweak unfolding settings.-funfolding-dict-discount=⟨n⟩— default: 30. Tweak unfolding settings.-funfolding-fun-discount=⟨n⟩— default: 60. Tweak unfolding settings.-funfolding-keeness-factor=⟨n⟩— This has been deprecated in GHC 9.0.1. 💀 bestie it's gone, do not use it.-funfolding-use-threshold=⟨n⟩— default: 80. 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.
✨ Optimization levels ✨
-O— Enable level 1 optimisations. the classic. the moment. 🫶-O0— Disable optimisations (default).-O2— Enable level 2 optimisations. turn it up 💅-O⟨n⟩— Any-Onwhere n > 2 is the same as-O2.
🎀 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 🦋
--merge-objs— Merge a set of objects into a GHCi library.-C— Stop after generating C (.hcfile).-c— Stop after generating object (.o) file.-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 🌈
-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⟩— Use ⟨cmd⟩ as the program to inject runpath into mach-o dylibs on macOS.-pgmJSP ⟨cmd⟩— Use ⟨cmd⟩ as the JavaScript C pre-processor (only for javascript-backend).-pgmL ⟨cmd⟩— Use ⟨cmd⟩ as the literate pre-processor.-pgml ⟨cmd⟩— Use ⟨cmd⟩ as the linker.-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 to inspect mach-o dylibs on macOS.-pgmP ⟨cmd⟩— Use ⟨cmd⟩ as the C pre-processor (with-cpponly).-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.-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 JavaScript C pre-processor (only for javascript-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⟩ to cpp (with-cpponly).-optwindres ⟨option⟩— pass ⟨option⟩ to windres.-pgmc-supports-no-pie— (deprecated) Indicate that the linker supports-no-pie. 🙈 deprecated bestie, tread lightly.-pgml-supports-no-pie— Indicate 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) turns on support for AVX512-F SIMD extensions ✨(#ghc-flag-mavx512f)-mavx512pf— (x86 only) turns on support for AVX512-PF SIMD extensions ✨(#ghc-flag-mavx512pf)-mbmi— (x86 only) uses BMI1 for bit manipulation operations 🧮(#ghc-flag-mbmi)-mbmi2— (x86 only) uses BMI2 for bit manipulation operations 🧮(#ghc-flag-mbmi2)-mfma— uses native FMA instructions for fused multiply-add floating-point operations 🧮(#ghc-flag-mfma)-msse— (x86 only) uses SSE for floating-point operations(#ghc-flag-msse)-msse2— (x86 only) uses SSE2 for floating-point operations(#ghc-flag-msse2)-msse3— (x86 only) uses SSE3 for floating-point operations(#ghc-flag-msse3)-msse4— (x86 only) uses SSE4 for floating-point operations(#ghc-flag-msse4)-msse4.2— (x86 only) uses SSE4.2 for floating-point operations(#ghc-flag-msse4.2)
🔌 Compiler plugins 🔌
okay bestie, this is where GHC lets other code come in and do little side quests inside your compile. iconic behaviour, honestly 🫶
-fclear-plugins— wipes the whole list of active plugins, like clearing your notifications but for plugins 🧹(#ghc-flag-fclear-plugins)-fplugin-library=⟨file-path⟩;⟨unit-id⟩;⟨module⟩;⟨args⟩— loads a pre-compiled static plugin from an external library, and yes all four pieces are separated by semicolons, no cap(#ghc-flag-fplugin-library-file-path-unit-id-module-args)-fplugin-opt=⟨module⟩:⟨args⟩— hands arguments to a plugin module; that module has to be named with-fplugin=⟨module⟩first, so don't skip that step 💅(#ghc-flag-fplugin-opt-module-args)-fplugin-trustworthy— trusts the plugins you're using, so GHC stops marking the compiled module as unsafe 😌(#ghc-flag-fplugin-trustworthy)-fplugin=⟨module⟩— loads a plugin that's exported by the module you name(#ghc-flag-fplugin-module)-hide-all-plugin-packages— hides all packages for plugins by default, like hiding a whole category of your feed 🙈(#ghc-flag-hide-all-plugin-packages)-plugin-package ⟨pkg⟩— exposes⟨pkg⟩for plugins(#ghc-flag-plugin-package-pkg)-plugin-package-id ⟨pkg-id⟩— exposes⟨pkg-id⟩for plugins(#ghc-flag-plugin-package-id-pkg-id)
📊 Profiling 📊
-auto— (deprecated) just an alias for-fprof-auto-exported(#ghc-flag-auto)-auto-all— (deprecated) just an alias for-fprof-auto(#ghc-flag-auto-all)-caf-all— (deprecated) just an alias for-fprof-cafs(#ghc-flag-caf-all)-fno-prof-count-entries— does not collect entry counts 🔢(#ghc-flag-fno-prof-count-entries)-fprof-auto— auto-adds SCCs to all bindings that aren't markedINLINE(#ghc-flag-fprof-auto)-fprof-auto-calls— auto-adds SCCs to every single call site 📞(#ghc-flag-fprof-auto-calls)-fprof-auto-exported— auto-adds SCCs to all exported bindings that aren't markedINLINE(#pragma-INLINE)(#ghc-flag-fprof-auto-exported)-fprof-auto-top— auto-adds SCCs to all top-level bindings that aren't markedINLINE(#ghc-flag-fprof-auto-top)-fprof-cafs— auto-adds SCCs to all CAFs(#ghc-flag-fprof-cafs)-fprof-callers=⟨name⟩— auto-adds SCCs to all the call-sites of the function you name 🎯(#ghc-flag-fprof-callers-name)-fprof-late— auto-adds SCCs to all top-level bindings after the core pipeline has run(#ghc-flag-fprof-late)-fprof-late-inline— auto-adds SCCs to all top-level bindings after the optimizer has run, and keeps them when inlining(#ghc-flag-fprof-late-inline)-fprof-late-overloaded— auto-adds SCCs to all top-level overloaded bindings after the core pipeline has run(#ghc-flag-fprof-late-overloaded)-fprof-late-overloaded-calls— auto-adds SCCs to all call sites that include dictionary arguments, after the core pipeline has run(#ghc-flag-fprof-late-overloaded-calls)-fprof-manual— processes manual SCC annotations ✍️(#ghc-flag-fprof-manual)-no-auto— (deprecated) alias for-fno-prof-auto(#ghc-flag--fprof-auto-calls)-no-auto-all— (deprecated) alias for-fno-prof-auto(#ghc-flag--fprof-auto-calls)-no-caf-all— (deprecated) alias for-fno-prof-cafs(#ghc-flag--fprof-cafs)-prof— turns on profiling 🔥(#ghc-flag-prof)-ticky— turns on ticky-ticky profiling(#ticky-ticky)(#ghc-flag-ticky)-ticky-allocd— tracks how many times each closure type gets allocated 📈(#ghc-flag-ticky-allocd)-ticky-ap-thunk— doesn't use standard AP thunks, so the entry counters come out more reliable(#ghc-flag-ticky-ap-thunk)-ticky-dyn-thunk— tracks allocations of dynamic thunks(#ghc-flag-ticky-dyn-thunk)-ticky-LNE— treats join point binders kinda like thunks/functions(#ghc-flag-ticky-LNE)-ticky-tag-checks— emits dummy ticky counters so you can see how many tag-inference checks tag inference actually avoided 🏷️(#ghc-flag-ticky-tag-checks)
🎯 Program coverage 🎯
-fhpc— turns on Haskell program coverage instrumentation, so you can see which lines got their moment and which ones were left on read 😭(#ghc-flag-fhpc)-hpcdir⟨dir⟩— sets the directory where GHC puts its.mixfiles(#ghc-flag-hpcdirdir)
🔁 Recompilation checking 🔁
-exclude-module=⟨file⟩— treats⟨file⟩as "stable", meaning it gets excluded from having dependencies on it(#ghc-flag-exclude-module-file)-fforce-recomp— turns recompilation checking off. Heads up: this is implied by any-ddump-Xoption when you're compiling a single file (i.e. when you're using-c) 👀(#ghc-flag-fforce-recomp)-fignore-hpc-changes— doesn't recompile modules just because HPC flags changed. Super useful for dodging recompiles when you're in GHCi, and it's enabled by default for GHCi ✨(#ghc-flag-fignore-hpc-changes)-fignore-optim-changes— doesn't recompile modules just because optimisation flags changed. Also great for avoiding recompiles in GHCi, and also enabled by default for GHCi ✨(#ghc-flag-fignore-optim-changes)-include-cpp-deps— includes preprocessor dependencies(#ghc-flag-include-cpp-deps)-include-pkg-deps— treats modules imported from packages as unstable(#ghc-flag-include-pkg-deps)
📁 Redirecting output 📁
-dep-makefile ⟨file⟩— uses⟨file⟩as the makefile(#ghc-flag-dep-makefile-file)-dep-suffix ⟨suffix⟩— makes dependencies that declare that files with suffix.⟨suf⟩⟨osuf⟩depend on interface files with suffix.⟨suf⟩hi(#ghc-flag-dep-suffix-suffix)-dumpdir ⟨dir⟩— redirects dump files 🗂️(#ghc-flag-dumpdir-dir)-dynhisuf ⟨suffix⟩— sets the suffix to use for dynamic interface files(#ghc-flag-dynhisuf-suffix)-dyno ⟨file⟩— sets the dynamic output filename(#ghc-flag-dyno-file)-dynohi ⟨file⟩— sets the filename to put the dynamic interface in(#ghc-flag-dynohi-file)-dynosuf ⟨suffix⟩— sets the dynamic output file suffix(#ghc-flag-dynosuf-suffix)-hcsuf ⟨suffix⟩— sets the suffix to use for intermediate C files(#ghc-flag-hcsuf-suffix)-hidir ⟨dir⟩— sets the directory for interface files(#ghc-flag-hidir-dir)-hiedir ⟨dir⟩— sets the directory for extended interface files(#ghc-flag-hiedir-dir)-hiesuf ⟨suffix⟩— sets the suffix to use for extended interface files(#ghc-flag-hiesuf-suffix)-hisuf ⟨suffix⟩— sets the suffix to use for interface files(#ghc-flag-hisuf-suffix)-o ⟨file⟩— sets the output filename(#ghc-flag-o-file)-odir ⟨dir⟩— sets the directory for object files(#ghc-flag-odir-dir)-ohi ⟨file⟩— sets the filename to put the interface in(#ghc-flag-ohi-file)-osuf ⟨suffix⟩— sets the output file suffix(#ghc-flag-osuf-suffix)-outputdir ⟨dir⟩— sets the output directory(#ghc-flag-outputdir-dir)-stubdir ⟨dir⟩— redirects FFI stub files(#ghc-flag-stubdir-dir)
🗑️ Temporary files 🗑️
-tmpdir ⟨dir⟩— sets the directory for temporary files(#ghc-flag-tmpdir-dir)
🗣️ Verbosity options 🗣️
this whole crew is about how much GHC yaps at you and in what font, basically 💅
-fabstract-refinement-hole-fits— default: off. Toggles whether refinements where one or more of the holes are abstract get reported(#ghc-flag-fabstract-refinement-hole-fits)-fdefer-diagnostics— defers and groups diagnostic messages by severity 📋(#ghc-flag-fdefer-diagnostics)-fdiagnostics-as-json— outputs diagnostics in Json format, as specified by the JSON schema(#ghc-flag-fdiagnostics-as-json)-fdiagnostics-color=⟨always|auto|never⟩— uses colors in error messages 🌈(#ghc-flag-fdiagnostics-color-always-auto-never)-fdiagnostics-show-caret— whether to show little snippets of the original source code 👉(#ghc-flag-fdiagnostics-show-caret)-ferror-spans— outputs the full span in error messages(#ghc-flag-ferror-spans)-fhide-source-paths— hides module source and object paths 🙈(#ghc-flag-fhide-source-paths)-fkeep-going— keeps compiling as far as it possibly can when errors happen, main character energy fr(#ghc-flag-fkeep-going)-fmax-refinement-hole-fits=⟨n⟩— default: 6. Sets the max number of refinement hole fits for typed holes to show in type error messages(#ghc-flag-fmax-refinement-hole-fits-n)-fmax-relevant-binds=⟨n⟩— default: 6. Sets the max number of bindings to show in type error messages(#ghc-flag-fmax-relevant-binds-n)-fmax-valid-hole-fits=⟨n⟩— default: 6. Sets the max number of valid hole fits for typed holes to show in type error messages(#ghc-flag-fmax-valid-hole-fits-n)-fno-show-valid-hole-fits— disables showing the list of valid hole fits for typed holes in type error messages(#ghc-flag-fno-show-valid-hole-fits)-fno-sort-valid-hole-fits— disables the sorting of that list of valid hole fits for typed holes in type error messages(#ghc-flag-fno-sort-valid-hole-fits)-fprint-axiom-incomps— displays equation incompatibilities in closed type families(#ghc-flag-fprint-axiom-incomps)-fprint-equality-relations— distinguishes between equality relations when printing(#ghc-flag-fprint-equality-relations)-fprint-error-index-links=⟨always|auto|never⟩— whether to emit diagnostic codes as ANSI hyperlinks to the Haskell Error Index 🔗(#ghc-flag-fprint-error-index-links-always-auto-never)-fprint-expanded-synonyms— in type errors, also prints type-synonym-expanded types(#ghc-flag-fprint-expanded-synonyms)-fprint-explicit-coercions— prints coercions in types(#ghc-flag-fprint-explicit-coercions)-fprint-explicit-foralls— prints explicitforallquantification in types. See alsoExplicitForAll(#extension-ExplicitForAll)(#ghc-flag-fprint-explicit-foralls)-fprint-explicit-kinds— makes GHC actually show the explicit kind foralls AND the kind arguments in your types. lowkey exposing everything. peep also KindSignatures for the whole vibe 💅-fprint-explicit-runtime-reps— prints theRuntimeRepandLevityvariables in types that are runtime-representation polymorphic. the hidden lore, revealed ✨-fprint-potential-instances— bestie when your type error is being cryptic, this displays ALL the available instances in your type error messages. no more guessing who's available 🫶-fprint-redundant-promotion-ticks— prints out the redundant DataKinds promotion ticks. yeah, the ticks that did nothing. GHC is calling them out fr 💀 (peep DataKinds too)-fprint-typechecker-elaboration— prints extra info straight from the typechecker. the tea ☕-fprint-unicode-syntax— uses unicode syntax when printing expressions, types and kinds. pretty math symbols, we love to see it 🎀 (also check UnicodeSyntax)-frefinement-level-hole-fits=⟨n⟩— default: off. this sets the level of refinement of the refinement hole fits, where level n means hole fits of up to n holes get considered. so like, how far down the rabbit hole are we going 🔍-freverse-errors— outputs your errors in reverse order. bottom-up reveal, iconic-fshow-docs-of-hole-fits— toggles whether it shows the documentation of the valid hole fits in the output. the receipts 📄-fshow-error-context— whether to show textual info about the error context-fshow-hole-constraints— shows constraints when reporting typed holes-fshow-hole-matches-of-hole-fits— toggles whether it shows the type of the additional holes in refinement hole fits-fshow-provenance-of-hole-fits— toggles whether it shows the provenance of the valid hole fits in the output-fshow-type-app-of-hole-fits— toggles whether it shows the type application of the valid hole fits in the output-fshow-type-app-vars-of-hole-fits— toggles whether it shows what type each quantified variable takes in a valid hole fit-fshow-type-of-hole-fits— toggles whether it shows the type of the valid hole fits in the output-fsort-by-size-hole-fits— sorts valid hole fits by size. smallest first, lil baby fits 🐣-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 the provenance nor the type applications of the suggestions. decluttered, clean girl aesthetic 🧚-Rghc-timing— summarises timing stats for GHC (literally the same as+RTS -tstderr). numbers go brrr ⏱️-v— verbose mode (equivalent to-v3)-v⟨n⟩— set the verbosity level. you pick n, bestie
🎀 Warnings 🎀
okay so this whole section is GHC telling you "bestie… I'm not mad, I'm just disappointed" but in flag form 😭
-fenable-th-splice-warnings— generates warnings for Template Haskell splices-fhelpful-errors— makes suggestions for mis-spelled names. it's giving autocorrect but for Haskell 💅-fmax-pmcheck-models=⟨n⟩— a 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— use the C code generator-W— enable normal warnings-w— disable ALL warnings. living in denial, honestly valid 🙈-Wall— enable almost all warnings (the details live in Warnings and sanity-checking)-Wall-missed-specialisations— warns when specialisation of any overloaded function fails-Wall-missed-specializations— alias for-Wall-missed-specialisations(same thing, different spelling, we don't judge)-Wambiguous-fields— warns about ambiguous field selectors or updates-Wauto-orphans— (deprecated) does nothing. dead flag, no thoughts, no behaviour 💀-Wbadly-staged-types— warns 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— warns on uses of the#ifdirective on undefined identifiers-Wdata-kinds-tc— warns when an illegal use of a type or kind without DataKinds is caught by the typechecker-Wdefault— enable default flags-Wdefaulted-exception-context— warns when aControl.Exception.Context.ExceptionContextimplicit parameter gets defaulted toControl.Exception.Context.emptyExceptionContext.
the full paths if you wanna go look:docs/users_guide/../libraries/base-4.20.2.0-inplace/Control-Exception-Context.html#t:ExceptionContextanddocs/users_guide/../libraries/base-4.20.2.0-inplace/Control-Exception-Context.html#v:emptyExceptionContext
-Wdeferred-out-of-scope-variables— reports warnings when variable out-of-scope errors get deferred until runtime. see also-fdefer-out-of-scope-variables.-Wdeferred-type-errors— reports warnings when deferred type errors are enabled. this one is on by default, bestie. see-fdefer-type-errors.-Wdeprecated-flags— warns about uses of commandline flags that are deprecated-Wdeprecated-type-abstractions— warns when type abstractions in constructor patterns are used without enabling TypeApplications-Wdeprecations— warns about uses of functions & types that haveDEPRECATEDpragmas, orWARNINGpragmas with the deprecated category-Wderiving-defaults— warns about default deriving when you're using BOTH DeriveAnyClass and GeneralizedNewtypeDeriving-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— make warnings fatal 🔥 every warning is now a whole crime-Weverything— enable all warnings supported by GHC. all of them. every single one 👑-Wextended-warnings— warns about uses of functions & types that haveWARNINGorDEPRECATEDpragmas, across all categories-Wextra— alias for-W-Wforall-identifier— (deprecated) does nothing-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 of Prelude numeric conversions that are probably the identity (and hence could just 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 the Prelude is implicitly imported-Wimplicit-rhs-quantification— warns when type variables on the RHS of a type synonym are implicitly quantified-Winaccessible-code— warns about inaccessible code-Wincomplete-export-warnings— warns when some but not all of the exports for a name are warned about-Wincomplete-patterns— warns when a pattern match could fail 😭 the classic-Wincomplete-record-selectors— warns when a record selector application could fail-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-Winconsistent-flags— warns when command line options are inconsistent in some way-Winferred-safe-imports— warns when an explicitly Safe Haskell module imports a Safe-Inferred one-Winline-rule-shadowing— warns if a rewrite RULE might fail to fire because the function might be inlined before the rule gets a chance to fire. peep How rules interact with INLINE/NOINLINE pragmas for the deep lore 🧐-Winvalid-haddock— warns when a Haddock comment occurs in an invalid position-Wloopy-superclass-solve— (deprecated) warns when creating potentially-loopy superclass constraint evidence-Wmisplaced-pragmas— yells at you when file header pragmas show up in the module body 💀 like bestie those belong at the top, not vibing in the middle-Wmissed-extra-shared-lib— warns when GHCi can't load a shared lib. that's it, that's the whole flag 😭-Wmissed-specialisations— warn when specialisation of an imported, overloaded function fails. rip to the optimisation that never was 🫶-Wmissed-specializations— alias for-Wmissed-specialisations. same energy, american spelling, no cap ✨-Wmissing-deriving-strategies— warn when aderivingclause is missing a deriving strategy. tell me how you're deriving, don't be mysterious 🙈-Wmissing-export-lists— warn when a module declaration does not explicitly list all exports. transparency is the vibe 💅-Wmissing-exported-pattern-synonym-signatures— warn about pattern synonyms without signatures, only if they are exported. the only if exported part is doing heavy lifting here 🎀-Wmissing-exported-signatures— warn about top-level functions without signatures, only if they are exported. again: exported only, that's the rule ✨-Wmissing-exported-sigs— (deprecated) warn about top-level functions without signatures, only if they are exported. takes precedence over-Wmissing-signatures. old but still bossy 👑-Wmissing-fields— warn when fields of a record are uninitialised. bestie you left a field empty, that's not a look 🌸-Wmissing-home-modules— warn 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 neither inexposed-modules, nor inother-modules. cabal said behave 🧚-Wmissing-import-lists— warn when an import declaration does not explicitly list all the names brought into scope. no sneaky wildcard energy 🦋-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. yes it's the same as the one above, they're twins 💜-Wmissing-methods— warn when class methods are undefined. the class said implement me and you said nothing 😭-Wmissing-monadfail-instances— (deprecated) Warn when a failable pattern is used in a do-block that does not have aMonadFailinstance.-Wmissing-pattern-synonym-signatures— warn when pattern synonyms do not have type signatures.-Wmissing-poly-kind-signatures— warn when inferred polykinded type or class declaration 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 is not explicitly specified. pick a lane bestie 🫶-Wmissing-signatures— warn about top-level functions without signatures.-Wmissing-space-after-bang— (deprecated) Does nothing. literally just exists. a ghost flag 💀-Wmonomorphism-restriction— warn when the Monomorphism Restriction is applied. the MR said hi and GHC said noted 🔥-Wname-shadowing— warn when names are shadowed. two things, one name, chaos 🌈-Wnoncanonical-monad-instances— warn whenApplicativeorMonadinstances have noncanonical definitions ofreturn,pure,(>>), or(*>). See flag description in Warnings and sanity-checking for more details. 👑-Wnoncanonical-monadfail-instances— (deprecated) warn whenMonadorMonadFailinstances have noncanonical definitions offail.-Wnoncanonical-monoid-instances— warn whenSemigrouporMonoidinstances have noncanonical definitions of(<>)ormappend. See flag description in Warnings and sanity-checking for more details. ✨-Wnot— (deprecated) Alias for-w. that's the whole thing, it's giving cryptic 💅-Woperator-whitespace— warn on prefix, suffix, and tight infix uses of infix operators. spacing is self care, fr fr 🌸-Woperator-whitespace-ext-conflict— warn on uses of infix operators that would be parsed differently were a particular GHC extension enabled. plot twist behaviour 🦋-Worphans— warn when the module contains orphan instance declarations or rewrite rules. orphans need a home, not your module 🙈-Woverflowed-literals— warn about literals that will overflow their type. that number does NOT fit bestie 💀-Woverlapping-patterns— warn about overlapping patterns.-Wpartial-fields— warn when defining a partial record field. half a field is not a vibe 😭-Wpartial-type-signatures— warn about holes in partial type signatures whenPartialTypeSignaturesis enabled. Not applicable whenPartialTypeSignaturesis not enabled, in which case errors are generated for such holes. so: with the extension it's a warning, without it it's an error 🫶-Wprepositive-qualified-module— Report imports with a leading/prepositive"qualified". grammar check but for imports ✨-Wredundant-bang-patterns— Warn about redundant bang patterns. the!was doing nothing, embarrassing for it 💅-Wredundant-constraints— Have the compiler warn about redundant constraints in type signatures.-Wredundant-record-wildcards— Warn about record wildcard matches when the wildcard binds no patterns.-Wredundant-strictness-flags— Warn about redundant strictness flags.-Wsafe— warn if the module being compiled is regarded to be safe.-Wsemigroup— (deprecated) Warn when aMonoidis notSemigroup, and on non-Semigroupdefinitions of(<>).-Wsimplifiable-class-constraints— Warn about class constraints in a type signature that can be simplified using a top-level instance declaration.-Wstar-binder— warn about binding the(*)type operator despiteStarIsType. lowkey a name collision situation ⭐-Wstar-is-type— warn when*is used to meanData.Kind.Type.-Wtabs— warn if there are tabs in the source file. tabs said i'm here and GHC said please leave 💀-Wterm-variable-capture— warn when an implicitly quantified type variable captures a term's name.-Wtrustworthy-safe— warn if the module being compiled is marked asTrustworthybut it could instead be marked asSafe, a more informative bound.-Wtype-defaults— warn when defaulting happens. the compiler picked for you, and it's telling on itself 🎀-Wtype-equality-out-of-scope— warn when type equalitya ~ bis used despite being out of scope.-Wtype-equality-requires-operators— warn when type equalitya ~ bis used despite being out of scope.-Wtyped-holes— Report warnings when typed hole errors are deferred until runtime. See-fdefer-typed-holes. the hole got postponed, not forgiven 🕳️-Wunbanged-strict-patterns— warn on pattern bind of unlifted variable that is neither bare nor banged.-Wunicode-bidirectional-format-characters— warn about the usage of unicode bidirectional layout override characters. sneaky invisible text, absolutely not 🔥-Wunrecognised-pragmas— warn about uses of pragmas that GHC doesn't recognise. GHC read your pragma and went who 🙈-Wunrecognised-warning-flags— throw a warning when an unrecognised-W...flag is encountered on the command line.-Wunsafe— warn if the module being compiled is regarded to be unsafe. See Safe Haskell. 😬-Wunsupported-calling-conventions— warn about use of an unsupported calling convention.-Wunsupported-llvm-version— Warn when using-fllvmwith an unsupported version of LLVM.-Wunticked-promoted-constructors— warn if promoted constructors are not ticked.-Wunused-binds— warn about bindings that are unused. Alias for-Wunused-top-binds,-Wunused-local-bindsand-Wunused-pattern-binds. three-for-one deal 👑-Wunused-do-bind— warn about do bindings that appear to throw away values of types other than(). bestie you dropped something 🫶-Wunused-foralls— warn about type variables in user-writtenforalls that are unused.-Wunused-imports— warn about unnecessary imports.-Wunused-local-binds— warn about local bindings that are unused.-Wunused-matches— warn about variables in patterns that aren't used.-Wunused-packages— warn when package is requested on command line, but not needed. cabal dependency said unnecessary 💅-Wunused-pattern-binds— warn about pattern match bindings that are unused.-Wunused-record-wildcards— Warn about record wildcard matches when none of the bound variables are used.-Wunused-top-binds— warn about top-level bindings that are unused.-Wunused-type-patterns— bestie, this one clocks you when you've got type variables that just… never get used?? and they came from patterns in your type family and data family instances. Ghost variables. Nobody invited them. warning time ✨-Wwarn— turns all your warnings into non-fatal ones. like they're still screaming at you but nobody's getting hurt 💅-Wwarnings-deprecations— this one yells at you when you use functions & types that carryDEPRECATEDpragmas, orWARNINGpragmas with thedeprecatedcategory. it's literally just an alias for-Wdeprecations, same energy different name 🎀-Wwrong-do-bind— okay so this is the one that catches you indobindings where you're just… throwing away monadic values that you should have bound instead. the audacity. the wasted monad. caught 📣-Wx-⟨category⟩— warn about uses of functions & types that haveWARNINGpragmas with the given category. plug in your own category, it's giving customizable 👑
💖 COPYRIGHT 💖
Copyright 2015. The University Court of the University of Glasgow. All rights reserved.
🔍 SEE ALSO 🔍
- <https://www.haskell.org/ghc> — the GHC homepage, aka where you go when you need the lore 🌈
🦋 Author 🦋
The GHC Team
🌸 Copyright 🌸
2023, GHC Team
and that's a wrap on the whole page, bestie 💜 this was GHC version 9.10.3, dated Mar 07, 2026, and it lives at GHC(1) — go forth and compile, you absolute icon, periodt ✨🫶
📦 where this page comes from
- ubuntu resolute: ghc 9.10.3-4 · BSD-3-Clause
- ubuntu stonking: ghc 9.10.3-4 · BSD-3-Clause
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms