GHC(1)

📦 version 9.6.6, in debian trixie, ubuntu questing

✨ GHC(1) — the Glasgow Haskell Compiler ✨

okay bestie, buckle up 🎀 this is the manual page for the Glasgow Haskell Compiler, aka ghc, aka the main character of your Haskell journey. it's long, it's gorgeous, and we're doing it in parts, so hydrate and stay with me 💖


💖 NAME 💖

  • ghc — the Glasgow Haskell Compiler. that's the name. that's the whole vibe. 👑

🌸 SYNOPSIS 🌸

ghc [option|filename]
ghci [option|filename]

🦋 DESCRIPTION 🦋

okay so this manual page documents briefly the ghc and ghci commands. heads up though, bestie: ghci is not yet available on all architectures 🙈 so if you can't find it on yours, that's why, it's not you.

there is extensive documentation available in various other formats, including PDF at https://downloads.haskell.org/ghc/latest/docs/users_guide.pdf and HTML at https://downloads.haskell.org/ghc/latest/docs/html/. literally go read it, it's giving encyclopedia but make it slay.

now the important part 🫶 each of GHC's command line options is classified as either static or dynamic:

  • static — a static flag may only be specified on the command line
  • dynamic — a dynamic flag may also be given in an OPTIONS pragma in a source file, or set from the GHCi command-line with :set

as a rule of thumb, all the language options are dynamic, as are the warning options and the debugging options. that's just how they roll 💅

the rest are static, with the notable exceptions of -v, -cpp, -fasm, -fvia-C, -fllvm, and -#include. the OPTIONS section lists the status of each flag, so you can always check who's who.

common suffixes of file names for Haskell are:

  • .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-linked
    • p — built with profiling
  • .⟨way⟩_hi — interface files for "way" ⟨way⟩; common ways are:

✨ OPTIONS ✨

okay here comes the big one, bestie. every single flag, organised by category, no cap, nothing skipped. 🫡


🔥 Code generation 🔥

the "what does the compiler actually produce" girlies:

  • -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
  • -split-objs

💀 Debugging the compiler 💀

the "why is my compiler like this" section. there are SO many of these, it's giving unhinged and honestly? iconic. 💅

  • -dasm-lint
  • -dcmm-lint
  • -dcore-lint
  • -ddump-asm
  • -ddump-asm-conflicts
  • -ddump-asm-liveness
  • -ddump-asm-native
  • -ddump-asm-regalloc
  • -ddump-asm-regalloc-stages
  • -ddump-asm-stats
  • -ddump-bcos
  • -ddump-c-backend
  • -ddump-call-arity
  • -ddump-cfg-weights
  • -ddump-cmm
  • -ddump-cmm-caf
  • -ddump-cmm-cbe
  • -ddump-cmm-cfg
  • -ddump-cmm-cps
  • -ddump-cmm-from-stg
  • -ddump-cmm-info
  • -ddump-cmm-opt
  • -ddump-cmm-proc
  • -ddump-cmm-procmap
  • -ddump-cmm-raw
  • -ddump-cmm-sink
  • -ddump-cmm-sp
  • -ddump-cmm-split
  • -ddump-cmm-switch
  • -ddump-cmm-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-ds
  • -ddump-ds-preopt
  • -ddump-ec-trace
  • -ddump-exitify
  • -ddump-faststrings
  • -ddump-file-prefix=⟨str⟩
  • -ddump-foreign
  • -ddump-hie
  • -ddump-hpc
  • -ddump-if-trace
  • -ddump-inlinings
  • -ddump-js
  • -ddump-json
  • -ddump-late-cc
  • -ddump-llvm
  • -ddump-mod-map
  • -ddump-occur-anal
  • -ddump-opt-cmm
  • -ddump-parsed
  • -ddump-parsed-ast
  • -ddump-prep
  • -ddump-rn
  • -ddump-rn-ast
  • -ddump-rn-stats
  • -ddump-rn-trace
  • -ddump-rtti
  • -ddump-rule-firings
  • -ddump-rule-rewrites
  • -ddump-rules
  • -ddump-simpl
  • -ddump-simpl-iterations
  • -ddump-simpl-stats
  • -ddump-simpl-trace
  • -ddump-spec
  • -ddump-splices
  • -ddump-stg
  • -ddump-stg-cg
  • -ddump-stg-final
  • -ddump-stg-from-core
  • -ddump-stg-tags
  • -ddump-stg-unarised
  • -ddump-str-signatures
  • -ddump-stranal
  • -ddump-tc
  • -ddump-tc-ast
  • -ddump-tc-trace
  • -ddump-ticked
  • -ddump-timings
  • -ddump-to-file
  • -ddump-types
  • -ddump-verbose-inlinings
  • -ddump-view-pattern-commoning
  • -ddump-worker-wrapper
  • -dfaststring-stats
  • -dhex-word-literals
  • -dinitial-unique=⟨s⟩
  • -dinline-check=⟨str⟩
  • -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
  • -fproc-alignment
  • -g
  • -g⟨n⟩

🧚 C pre-processor 🧚

for when you want the C pre-processor to do its little thing:

  • -cpp
  • -D⟨symbol⟩[=⟨value⟩]
  • -U⟨symbol⟩
  • -I⟨dir⟩
  • -U⟨symbol⟩

🍓 Finding imports 🍓

where do the modules live, bestie:

  • -i
  • -i⟨dir⟩[:⟨dir⟩]*

💜 Interactive mode 💜

GHCi girlies rise 🫶 this is the ghci side of life:

  • -fbreak-on-error
  • -fno-break-on-error
  • -fbreak-on-exception
  • -fno-break-on-exception
  • -fghci-hist-size=⟨n⟩
  • -fghci-leak-check
  • -fno-ghci-leak-check
  • -fimplicit-import-qualified
  • -fno-implicit-import-qualified
  • -flocal-ghci-history
  • -fno-local-ghci-history
  • -fno-it
  • -fno-no-it
  • -fprint-bind-result
  • -fno-print-bind-result
  • -fprint-evld-with-show
  • -fshow-loaded-modules
  • -ghci-script
  • -ignore-dot-ghci
  • -no-ignore-dot-ghci
  • -interactive-print ⟨name⟩

🌈 Interface files 🌈

the .hi files, the little gossipy index cards of your code:

  • --show-iface ⟨file⟩
  • -ddump-hi
  • -ddump-hi-diffs
  • -ddump-minimal-imports

🎀 Keeping intermediate files 🎀

for the girlies who hoard every single artifact and honestly, valid:

  • -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 absolute motherlode. every -X extension GHC knows about. this is the part where the language itself gets a glow-up ✨

  • -XAllowAmbiguousTypes
  • -XApplicativeDo
  • -XArrows
  • -XBangPatterns
  • -XBinaryLiterals
  • -XBlockArguments
  • -XCApiFFI
  • -XConstrainedClassMethods
  • -XConstraintKinds
  • -XCPP
  • -XCUSKs
  • -XDataKinds
  • -XDatatypeContexts
  • -XDeepSubsumption
  • -XDefaultSignatures
  • -XDeriveAnyClass
  • -XDeriveDataTypeable
  • -XDeriveFoldable
  • -XDeriveFunctor
  • -XDeriveGeneric
  • -XDeriveLift
  • -XDeriveTraversable
  • -XDerivingStrategies
  • -XDerivingVia
  • -XDisambiguateRecordFields
  • -XDuplicateRecordFields
  • -XEmptyCase
  • -XEmptyDataDecls
  • -XEmptyDataDeriving
  • -XExistentialQuantification
  • -XExplicitForAll
  • -XExplicitNamespaces
  • -XExtendedDefaultRules
  • -XFieldSelectors
  • -XFlexibleContexts
  • -XFlexibleInstances
  • -XForeignFunctionInterface
  • -XFunctionalDependencies
  • -XGADTs
  • -XGADTSyntax
  • -XGeneralisedNewtypeDeriving
  • -XGeneralizedNewtypeDeriving
  • -XGHC2021
  • -XGHCForeignImportPrim
  • -XHaskell2010
  • -XHaskell98
  • -XHexFloatLiterals
  • -XImplicitParams
  • -XImportQualifiedPost
  • -XImpredicativeTypes
  • -XIncoherentInstances
  • -XInstanceSigs
  • -XInterruptibleFFI
  • -XKindSignatures
  • -XLambdaCase
  • -XLexicalNegation
  • -XLiberalTypeSynonyms
  • -XLinearTypes
  • -XMagicHash
  • -XMonadComprehensions
  • -XMonoLocalBinds
  • -XMultiParamTypeClasses
  • -XMultiWayIf
  • -XNamedFieldPuns
  • -XNamedWildCards
  • -XNegativeLiterals
  • -XNoImplicitPrelude
  • -XNoMonomorphismRestriction
  • -XNondecreasingIndentation
  • -XNoPatternGuards
  • -XNoTraditionalRecordSyntax
  • -XNPlusKPatterns
  • -XNullaryTypeClasses
  • -XNumDecimals
  • -XNumericUnderscores
  • -XOverlappingInstances
  • -XOverloadedLabels
  • -XOverloadedLists
  • -XOverloadedRecordDot
  • -XOverloadedRecordUpdate
  • -XOverloadedStrings
  • -XPackageImports
  • -XParallelListComp
  • -XPartialTypeSignatures
  • -XPatternSynonyms
  • -XPolyKinds
  • -XPostfixOperators
  • -XQualifiedDo
  • -XQuantifiedConstraints
  • -XQuasiQuotes
  • -XRank2Types
  • -XRankNTypes
  • -XRebindableSyntax
  • -XRecordWildCards
  • -XRecursiveDo
  • -XRoleAnnotations
  • -XSafe
  • -XScopedTypeVariables
  • -XStandaloneDeriving
  • -XStandaloneKindSignatures
  • -XStarIsType
  • -XStaticPointers
  • -XStrict
  • -XStrictData
  • -XTemplateHaskell
  • -XTemplateHaskellQuotes
  • -XTransformListComp
  • -XTrustworthy
  • -XTupleSections
  • -XTypeApplications
  • -XTypeData
  • -XTypeFamilies
  • -XTypeFamilyDependencies
  • -XTypeInType
  • -XTypeOperators
  • -XTypeSynonymInstances
  • -XUnboxedSums
  • -XUnboxedTuples
  • -XUndecidableInstances
  • -XUndecidableSuperClasses
  • -XUnicodeSyntax
  • -XUnliftedDatatypes
  • -XUnliftedFFITypes
  • -XUnliftedNewtypes
  • -XUnsafe
  • -XViewPatterns

🔗 Linking options 🔗

the "how do we get this thing to actually run" section, fr fr:

  • -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
  • -static
  • -staticlib
  • -threaded
  • -with-rtsopts=⟨opts⟩

💅 Miscellaneous options 💅

the grab bag. the misc drawer of your desk. love her:

  • -ddump-mod-cycles
  • -fexternal-interpreter
  • -ffamily-application-cache
  • -fno-family-application-cache
  • -fglasgow-exts
  • -fno-glasgow-exts
  • -fno-safe-haskell
  • -ghcversion-file ⟨path to ghcversion.h⟩
  • -H ⟨size⟩
  • -hidden-module ⟨module name⟩
  • -j[⟨n⟩]
  • -reexported-module ⟨module name⟩
  • -this-package-name ⟨unit-id⟩
  • -unit @⟨filename⟩
  • -working-dir ⟨dir⟩

⭐ Modes of operation ⭐

the "what are we even doing today" flags. main character energy only:

  • --frontend ⟨module⟩
  • --help
  • -?
  • --info
  • --interactive
  • --make
  • --numeric-version
  • --print-booter-version
  • --print-build-platform
  • --print-c-compiler-flags
  • --print-c-compiler-link-flags
  • --print-debug-on
  • --print-global-package-db
  • --print-have-interpreter
  • --print-have-native-code-generator
  • --print-host-platform
  • --print-ld-flags
  • --print-leading-underscore
  • --print-libdir
  • --print-object-splitting-supported
  • --print-project-git-commit-id
  • --print-project-version
  • --print-rts-ways
  • --print-stage
  • --print-support-smp
  • --print-tables-next-to-code
  • --print-target-platform
  • --print-unregisterised
  • --run ⟨file⟩
  • --show-iface ⟨file⟩
  • --show-options
  • --supported-extensions
  • --supported-languages
  • --version
  • -V
  • -e ⟨expr⟩
  • -M
  • -shared

and that's where part 1 wraps up, bestie 🫶 more coming, stay tuned 💖

🧠 Individual optimizations 🧠

Okay bestie, deep breath. This is THE drawer — every single knob GHC lets you twist, and most of them come in a matched pair: one to switch it on, and the -fno- twin to switch it right back off. Every. Single. One. Is. Here. No skips, no "etc.", periodt 👑

  • -fasm-shortcutting, -fno-asm-shortcutting — on or off, pick a side 💅
  • -fbinary-blob-threshold=⟨n⟩ — takes a number, ⟨n⟩
  • -fblock-layout-cfg, -fno-block-layout-cfg — flip the switch, bestie
  • -fblock-layout-weightless, -fno-block-layout-weightless — yes or no, that's the whole vibe
  • -fblock-layout-weights — just the one, no off-twin listed
  • -fcall-arity, -fno-call-arity — on/off, no cap
  • -fcase-folding, -fno-case-folding — the classic toggle 🎀
  • -fcase-merge, -fno-case-merge — on, or off, your call
  • -fcmm-control-flow, -fno-cmm-control-flow — flip it ✨
  • -fcmm-elim-common-blocks, -fno-cmm-elim-common-blocks — both sides of the coin
  • -fcmm-sink, -fno-cmm-sink — sink or unsink 🫶
  • -fcmm-static-pred, -fno-cmm-static-pred — on/off energy
  • -fcore-constant-folding, -fno-core-constant-folding — toggle szn
  • -fcpr-anal, -fno-cpr-anal — yes pls / no thx
  • -fcross-module-specialise, -fno-cross-module-specialise — flip the switch 💖
  • -fcse, -fno-cse — on, off, done
  • -fdicts-cheap, -fno-dicts-cheap — cheap or not-cheap, iconically
  • -fdicts-strict, -fno-dicts-strict — strict or nah
  • -fdmd-tx-dict-sel, -fno-dmd-tx-dict-sel — the pair, as always
  • -fdmd-unbox-width=⟨n⟩ — a number goes here, ⟨n⟩
  • -fdo-eta-reduction, -fno-do-eta-reduction — toggle it 🌸
  • -fdo-lambda-eta-expansion, -fno-do-lambda-eta-expansion — on/off bestie
  • -feager-blackholing — solo flag, no twin
  • -fenable-rewrite-rules, -fno-enable-rewrite-rules — enable or nah
  • -fexcess-precision, -fno-excess-precision — flip it 💜
  • -fexitification, -fno-exitification — in or out
  • -fexpose-all-unfoldings, -fno-expose-all-unfoldings — expose or hide
  • -ffloat-in, -fno-float-in — float or don't
  • -ffull-laziness, -fno-full-laziness — lazy or not lazy
  • -ffun-to-thunk, -fno-fun-to-thunk — the pair again 🦋
  • -fignore-asserts, -fno-ignore-asserts — ignore or don't
  • -fignore-interface-pragmas, -fno-ignore-interface-pragmas — yes/no
  • -finline-generics, -fno-inline-generics — inline or nah
  • -finline-generics-aggressively, -fno-inline-generics-aggressively — aggressively on, aggressively off 🔥
  • -flate-dmd-anal, -fno-late-dmd-anal — late or not-late
  • -flate-specialise, -fno-late-specialise — flip it
  • -fliberate-case, -fno-liberate-case — liberate or nah
  • -fliberate-case-threshold=⟨n⟩, -fno-liberate-case-threshold — a number for the on-version, plain off for the other
  • -fllvm-pass-vectors-in-regs — single flag, no off-twin
  • -flocal-float-out, -fno-local-float-out — on/off
  • -flocal-float-out-top-level, -fno-local-float-out-top-level — top-level on, top-level off
  • -floopification, -fno-loopification — loop it or don't
  • -fmax-inline-alloc-size=⟨n⟩ — number, ⟨n⟩
  • -fmax-inline-memcpy-insns=⟨n⟩ — number, ⟨n⟩
  • -fmax-inline-memset-insns=⟨n⟩ — number, ⟨n⟩
  • -fmax-simplifier-iterations=⟨n⟩ — number, ⟨n⟩
  • -fmax-uncovered-patterns=⟨n⟩ — number, ⟨n⟩
  • -fmax-worker-args=⟨n⟩ — number, ⟨n⟩
  • -fno-opt-coercion — off-only, no on-twin listed
  • -fno-pre-inlining — off-only
  • -fno-state-hack — off-only
  • -fomit-interface-pragmas, -fno-omit-interface-pragmas — omit or don't
  • -fomit-yields, -fno-omit-yields — the pair
  • -foptimal-applicative-do, -fno-optimal-applicative-do — optimal or not
  • -fpedantic-bottoms, -fno-pedantic-bottoms — pedantic mode on/off 🎀
  • -fpolymorphic-specialisation, -fno-polymorphic-specialisation — flip it
  • -fregs-graph, -fno-regs-graph — graph or nah
  • -fregs-iterative, -fno-regs-iterative — iterative or nah
  • -fsimpl-tick-factor=⟨n⟩ — number, ⟨n⟩
  • -fsimplifier-phases=⟨n⟩ — number, ⟨n⟩
  • -fsolve-constant-dicts, -fno-solve-constant-dicts — solve or don't
  • -fspec-constr, -fno-spec-constr — on/off
  • -fspec-constr-count=⟨n⟩, -fno-spec-constr-count — number or plain off
  • -fspec-constr-keen, -fno-spec-constr-keen — keen or not keen
  • -fspec-constr-threshold=⟨n⟩, -fno-spec-constr-threshold — number or plain off
  • -fspecialise, -fno-specialise — specialise or nah
  • -fspecialise-aggressively, -fno-specialise-aggressively — aggressive on, aggressive off 🔥
  • -fstatic-argument-transformation, -fno-static-argument-transformation — the pair
  • -fstg-cse, -fno-stg-cse — on/off
  • -fstg-lift-lams, -fno-stg-lift-lams — lift or nah
  • -fstg-lift-lams-known, -fno-stg-lift-lams-known — known or nah
  • -fstg-lift-lams-non-rec-args — solo, no off-twin
  • -fstg-lift-lams-non-rec-args-any — solo
  • -fstg-lift-lams-rec-args — solo
  • -fstg-lift-lams-rec-args-any — solo
  • -fstrictness, -fno-strictness — strict or not
  • -fstrictness-before=⟨n⟩ — number, ⟨n⟩
  • -funbox-small-strict-fields, -fno-unbox-small-strict-fields — note the name flips to -fno-unbox- on the off-side, bestie, don't get caught out 🙈
  • -funbox-strict-fields, -fno-unbox-strict-fields — same deal, unbox on the off-side
  • -funfolding-case-scaling=⟨n⟩ — number, ⟨n⟩
  • -funfolding-case-threshold=⟨n⟩ — number, ⟨n⟩
  • -funfolding-creation-threshold=⟨n⟩ — number, ⟨n⟩
  • -funfolding-dict-discount=⟨n⟩ — number, ⟨n⟩
  • -funfolding-fun-discount=⟨n⟩ — number, ⟨n⟩
  • -funfolding-keeness-factor=⟨n⟩ — number, ⟨n⟩ (yes, it's spelled keeness in the flag, no cap)
  • -funfolding-use-threshold=⟨n⟩ — number, ⟨n⟩
  • -fworker-wrapper — solo
  • -fworker-wrapper-cbv — solo

📈 Optimization levels 📈

The preset rack. Instead of twisting every single knob above, you just grab a level and vibe ✨

  • -O
  • -O1
  • -O0
  • -O0
  • -O2
  • -O0
  • -O⟨n⟩
  • -O0
Okay so, yes, -O0 literally appears four separate times in that list. That's not me being messy, that's genuinely what the page says. I'm just the messenger 💀

📦 Package options 📦

All the stuff for telling GHC which packages exist, which ones you trust, and which ones you're side-eyeing 🫶

  • -clear-package-db
  • -distrust ⟨pkg⟩ — takes a package, ⟨pkg⟩
  • -distrust-all-packages
  • -fpackage-trust
  • -global-package-db
  • -hide-all-packages
  • -hide-package ⟨pkg⟩ — ⟨pkg⟩
  • -ignore-package ⟨pkg⟩ — ⟨pkg⟩
  • -no-auto-link-packages
  • -no-global-package-db
  • -no-user-package-db
  • -package ⟨pkg⟩ — ⟨pkg⟩
  • -package-db ⟨file⟩ — a ⟨file⟩
  • -package-env ⟨file⟩|⟨name⟩ — either a ⟨file⟩ or a ⟨name⟩
  • -package-id ⟨unit-id⟩ — a ⟨unit-id⟩
  • -this-unit-id ⟨unit-id⟩ — a ⟨unit-id⟩
  • -trust ⟨pkg⟩ — ⟨pkg⟩
  • -user-package-db

🚦 Phases of compilation 🚦

Where you tell GHC to stop in the pipeline. Love a "just do this bit and chill" moment 💅

  • --merge-objs
  • -C
  • -c
  • -E
  • -F
  • -S
  • -x ⟨suffix⟩ — takes a ⟨suffix⟩

🔧 Overriding external programs 🔧

Swapping out the tools GHC shells out to. You get to pick the ⟨cmd⟩ for each one ✨

  • -pgma ⟨cmd⟩
  • -pgmc ⟨cmd⟩
  • -pgmcxx ⟨cmd⟩
  • -pgmdll ⟨cmd⟩
  • -pgmF ⟨cmd⟩
  • -pgmi ⟨cmd⟩
  • -pgminstall_name_tool ⟨cmd⟩
  • -pgmL ⟨cmd⟩
  • -pgml ⟨cmd⟩
  • -pgmlc ⟨cmd⟩
  • -pgmlm ⟨cmd⟩
  • -pgmlo ⟨cmd⟩
  • -pgmotool ⟨cmd⟩
  • -pgmP ⟨cmd⟩
  • -pgms ⟨cmd⟩
  • -pgmwindres ⟨cmd⟩

🎛️ Phase-specific options 🎛️

Passing an ⟨option⟩ straight through to one particular phase. Each one hands off its own little ⟨option⟩ 🎀

  • -opta ⟨option⟩
  • -optc ⟨option⟩
  • -optcxx ⟨option⟩
  • -optdll ⟨option⟩
  • -optF ⟨option⟩
  • -opti ⟨option⟩
  • -optL ⟨option⟩
  • -optl ⟨option⟩
  • -optlc ⟨option⟩
  • -optlm ⟨option⟩
  • -optlo ⟨option⟩
  • -optP ⟨option⟩
  • -optwindres ⟨option⟩
  • -pgmc-supports-no-pie
  • -pgml-supports-no-pie

🖥️ Platform-specific options 🖥️

CPU feature flags, bestie. Straight-up vibes for the silicon 💜

  • -mavx
  • -mavx2
  • -mavx512cd
  • -mavx512er
  • -mavx512f
  • -mavx512pf
  • -mbmi
  • -mbmi2
  • -msse
  • -msse2
  • -msse3
  • -msse4
  • -msse4.2

🔌 Compiler plugins 🔌

Plugins! Your compiler but ✨customised✨. Trust levels, package choices, the whole saga.

  • -fclear-plugins
  • -fplugin-library=⟨file-path⟩;⟨unit-id⟩;⟨module⟩;⟨args⟩ — four bits separated by semicolons: a ⟨file-path⟩, a ⟨unit-id⟩, a ⟨module⟩, and ⟨args⟩
  • -fplugin-opt=⟨module⟩:⟨args⟩ — a ⟨module⟩ and its ⟨args⟩
  • -fplugin-trustworthy
  • -fplugin=⟨module⟩ — a ⟨module⟩
  • -hide-all-plugin-packages
  • -plugin-package ⟨pkg⟩ — ⟨pkg⟩
  • -plugin-package-id ⟨pkg-id⟩ — a ⟨pkg-id⟩

📊 Profiling 📊

Everything you need to find out where your program's time is actually going 🕵️‍♀️

  • -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⟩ — a ⟨name⟩
  • -fprof-late
  • -fno-prof-late
  • -fprof-late-inline
  • -fno-prof-late-inline
  • -fprof-manual
  • -fno-prof-manual
  • -no-auto
  • -no-auto-all
  • -no-caf-all
  • -prof
  • -ticky
  • -ticky-allocd
  • -ticky-ap-thunk
  • -ticky-dyn-thunk
  • -ticky-LNE
  • -ticky-tag-checks

🧪 Program coverage 🧪

  • -fhpc
  • -hpcdir⟨dir⟩ — a ⟨dir⟩, glued right on there, no space, exactly like that bestie

🔁 Recompilation checking 🔁

All the ways to say "actually, please rebuild" or "no babe, it's fine, leave it" 🌈

  • -exclude-module=⟨file⟩ — a ⟨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 📁

Put your build products wherever you want them. Every one of these takes a ⟨file⟩, a ⟨dir⟩, or a ⟨suffix⟩ 💅

  • -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 🗑️

  • -tmpdir ⟨dir⟩ — your ⟨dir⟩ for the temp stuff 🍓

🗣️ Verbosity options 🗣️

The chattiness dials. How much GHC tells you, how it formats it, and how many hole-fit goodies it dumps on you when your code has a hole in it 🕳️✨

  • -fabstract-refinement-hole-fits
  • -fno-abstract-refinement-hole-fits
  • -fdefer-diagnostics
  • -fdiagnostics-color=⟨always|auto|never⟩ — one of always, auto, or never
  • -fdiagnostics-show-caret
  • -fno-diagnostics-show-caret
  • -ferror-spans
  • -fhide-source-paths
  • -fkeep-going
  • -fmax-refinement-hole-fits=⟨n⟩ — a number ⟨n⟩
  • -fno-max-refinement-hole-fits
  • -fmax-relevant-binds=⟨n⟩ — a number ⟨n⟩
  • -fno-max-relevant-binds
  • -fmax-valid-hole-fits=⟨n⟩ — a number ⟨n⟩
  • -fno-max-valid-hole-fits
  • -fno-show-valid-hole-fits
  • -fno-sort-valid-hole-fits
  • -fsort-valid-hole-fits
  • -fprint-axiom-incomps
  • -fno-print-axiom-incomps
  • -fprint-equality-relations
  • -fno-print-equality-relations
  • -fprint-expanded-synonyms
  • -fno-print-expanded-synonyms
  • -fprint-explicit-coercions
  • -fno-print-explicit-coercions
  • -fprint-explicit-foralls
  • -fno-print-explicit-foralls
  • -fprint-explicit-kinds
  • -fno-print-explicit-kinds
  • -fprint-explicit-runtime-reps
  • -fno-print-explicit-runtime-reps
  • -fprint-potential-instances
  • -fno-print-potential-instances
  • -fprint-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⟩ — a number ⟨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⟩ — the ⟨n⟩ goes right on the end, no space, just like that 💖

✨ Warnings ✨

okay bestie, sit down, hydrate, because this is the list 💅 GHC's warning flags are a whole ecosystem — every single one of them is right here, in order, no skips. Some of them show up more than once in this roster (yes, fr fr, that's literally how it's written, don't come for me 🙈). Collect them all like Pokémon, use them responsibly.

  • -fdefer-out-of-scope-variables
  • -fno-defer-out-of-scope-variables
  • -fdefer-type-errors
  • -fno-defer-type-errors
  • -fdefer-typed-holes
  • -fno-defer-typed-holes
  • -fenable-th-splice-warnings
  • -fno-enable-th-splice-warnings
  • -fhelpful-errors
  • -fno-helpful-errors
  • -fmax-pmcheck-models=⟨n⟩
  • -fshow-warning-groups
  • -fno-show-warning-groups
  • -fvia-C
  • -W
  • -w
  • -w
  • -Wall
  • -w
  • -Wall-missed-specialisations
  • -Wno-all-missed-specialisations
  • -Wall-missed-specializations
  • -Wno-all-missed-specializations
  • -Wambiguous-fields
  • -Wauto-orphans
  • -Wcompat
  • -Wno-compat
  • -Wcompat-unqualified-imports
  • -Wno-compat-unqualified-imports
  • -Wcpp-undef
  • -Wdefault
  • -Wdeferred-out-of-scope-variables
  • -Wno-deferred-out-of-scope-variables
  • -Wdeferred-type-errors
  • -Wno-deferred-type-errors
  • -Wdeprecated-flags
  • -Wno-deprecated-flags
  • -Wdeprecations
  • -Wno-deprecations
  • -Wderiving-defaults
  • -Wno-deriving-defaults
  • -Wderiving-typeable
  • -Wno-deriving-typeable
  • -Wdodgy-exports
  • -Wno-dodgy-exports
  • -Wdodgy-foreign-imports
  • -Wno-dodgy-foreign-imports
  • -Wdodgy-imports
  • -Wno-dodgy-imports
  • -Wduplicate-constraints
  • -Wno-duplicate-constraints
  • -Wduplicate-exports
  • -Wno-duplicate-exports
  • -Wempty-enumerations
  • -Wno-empty-enumerations
  • -Werror
  • -Wwarn
  • -Weverything
  • -Wextra
  • -w
  • -Wforall-identifier
  • -Wno-forall-identifier
  • -Wgadt-mono-local-binds
  • -Wno-gadt-mono-local-binds
  • -Whi-shadowing
  • -Wno-hi-shadowing
  • -Widentities
  • -Wno-identities
  • -Wimplicit-kind-vars
  • -Wno-implicit-kind-vars
  • -Wimplicit-lift
  • -Wno-implicit-lift
  • -Wimplicit-prelude
  • -Wno-implicit-prelude
  • -Winaccessible-code
  • -Wno-inaccessible-code
  • -Wincomplete-patterns
  • -Wno-incomplete-patterns
  • -Wincomplete-record-updates
  • -Wno-incomplete-record-updates
  • -Wincomplete-uni-patterns
  • -Wno-incomplete-uni-patterns
  • -Winferred-safe-imports
  • -Wno-inferred-safe-imports
  • -Winline-rule-shadowing
  • -Wno-inline-rule-shadowing
  • -Winvalid-haddock
  • -Wno-invalid-haddock
  • -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-safe-haskell-mode
  • -Wno-missing-safe-haskell-mode
  • -Wmissing-signatures
  • -Wno-missing-signatures
  • -Wmissing-space-after-bang
  • -Wmonomorphism-restriction
  • -Wno-monomorphism-restriction
  • -Wname-shadowing
  • -Wno-name-shadowing
  • -Wno-compat
  • -Wcompat
  • -Wnoncanonical-monad-instances
  • -Wno-noncanonical-monad-instances
  • -Wnoncanonical-monadfail-instances
  • -Wno-noncanonical-monadfail-instances
  • -Wnoncanonical-monoid-instances
  • -Wno-noncanonical-monoid-instances
  • -Wnot
  • -Woperator-whitespace
  • -Wno-operator-whitespace
  • -Woperator-whitespace-ext-conflict
  • -Wno-operator-whitespace-ext-conflict
  • -Worphans
  • -Wno-orphans
  • -Woverflowed-literals
  • -Wno-overflowed-literals
  • -Woverlapping-patterns
  • -Wno-overlapping-patterns
  • -Wpartial-fields
  • -Wno-partial-fields
  • -Wpartial-type-signatures
  • -Wno-partial-type-signatures
  • -Wprepositive-qualified-module
  • -Wno-prepositive-qualified-module
  • -Wredundant-bang-patterns
  • -Wno-redundant-bang-patterns
  • -Wredundant-constraints
  • -Wno-redundant-constraints
  • -Wredundant-record-wildcards
  • -Wno-redundant-record-wildcards
  • -Wredundant-strictness-flags
  • -Wno-redundant-strictness-flags
  • -Wsafe
  • -Wno-safe
  • -Wsemigroup
  • -Wno-semigroup
  • -Wsimplifiable-class-constraints
  • -Wno-simplifiable-class-constraints
  • -Wstar-binder
  • -Wno-star-binder
  • -Wstar-is-type
  • -Wno-star-is-type
  • -Wtabs
  • -Wno-tabs
  • -Wtrustworthy-safe
  • -Wno-safe
  • -Wtype-defaults
  • -Wno-type-defaults
  • -Wtype-equality-out-of-scope
  • -Wno-type-equality-out-of-scope
  • -Wtype-equality-requires-operators
  • -Wno-type-equality-requires-operators
  • -Wtyped-holes
  • -Wno-typed-holes
  • -Wunbanged-strict-patterns
  • -Wno-unbanged-strict-patterns
  • -Wunicode-bidirectional-format-characters
  • -Wunrecognised-pragmas
  • -Wno-unrecognised-pragmas
  • -Wunrecognised-warning-flags
  • -Wno-unrecognised-warning-flags
  • -Wunsafe
  • -Wno-unsafe
  • -Wunsupported-calling-conventions
  • -Wno-unsupported-calling-conventions
  • -Wunsupported-llvm-version
  • -Wno-monomorphism-restriction
  • -Wunticked-promoted-constructors
  • -Wno-unticked-promoted-constructors
  • -Wunused-binds
  • -Wno-unused-binds
  • -Wunused-do-bind
  • -Wno-unused-do-bind
  • -Wunused-foralls
  • -Wno-unused-foralls
  • -Wunused-imports
  • -Wno-unused-imports
  • -Wunused-local-binds
  • -Wno-unused-local-binds
  • -Wunused-matches
  • -Wno-unused-matches
  • -Wunused-packages
  • -Wno-unused-packages
  • -Wunused-pattern-binds
  • -Wno-unused-pattern-binds
  • -Wunused-record-wildcards
  • -Wno-unused-record-wildcards
  • -Wunused-top-binds
  • -Wno-unused-top-binds
  • -Wunused-type-patterns
  • -Wno-unused-type-patterns
  • -Wwarn
  • -Werror
  • -Wwarnings-deprecations
  • -Wno-warnings-deprecations
  • -Wwrong-do-bind
  • -Wno-wrong-do-bind
every -W… has a -Wno-… twin that turns it back off, and every -f… has a -fno-… twin, so you can vibe whichever way you want. flipping them around is the whole game, bestie 🎀

🛠️ Code generation 🛠️

this is the part where GHC actually makes the machine code (or doesn't, if you're feeling lazy). pick your fighter:

  • -dynamic-too — build dynamic object files and static object files while you're compiling, both at once, overachiever behavior 💅
  • -fasm — use the native code generator
  • -fbyte-code — generate byte-code
  • -fbyte-code-and-object-code — generate object code and byte-code together
  • -fexpose-internal-symbols — produce symbols for all functions, internal functions included
  • -fexternal-dynamic-refs — generate code for linking against dynamic libraries
  • -fllvm — compile using the LLVM code generator
  • -fno-code — omit code generation entirely (we're just here for the vibes)
  • -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's 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
  • -split-objs — split generated object files into smaller files

🔍 Debugging the compiler 🔍

when you want to peek behind the curtain and watch GHC spiral in real time 😭 these dump the compiler's inner workings everywhere. nerdy and iconic.

  • -dasm-lint — ASM pass sanity checking
  • -dcmm-lint — C-- pass sanity checking
  • -dcore-lint — turn on internal sanity checking
  • -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-graph register allocator
  • -ddump-asm-stats — dump statistics from the register allocator
  • -ddump-bcos — dump interpreter byte code
  • -ddump-c-backend — dump C code produced by the C (unregisterised) backend
  • -ddump-call-arity — dump output of the call arity analysis pass
  • -ddump-cfg-weights — dump the assumed weights of the CFG
  • -ddump-cmm — dump the final C-- output
  • -ddump-cmm-caf — dump the results of the C-- CAF analysis pass
  • -ddump-cmm-cbe — dump the results of common block elimination
  • -ddump-cmm-cfg — dump the results of the C-- control flow optimisation pass
  • -ddump-cmm-cps — dump the results of the CPS pass
  • -ddump-cmm-from-stg — dump STG-to-C-- output
  • -ddump-cmm-info — dump the results of the C-- info table augmentation pass
  • -ddump-cmm-opt — dump the results of C-- to C-- optimising passes
  • -ddump-cmm-proc — dump the results of proc-point analysis
  • -ddump-cmm-procmap — dump the results of the C-- proc-point map pass
  • -ddump-cmm-raw — dump raw C--
  • -ddump-cmm-sink — dump the results of the C-- sinking pass
  • -ddump-cmm-sp — dump the results of the C-- stack layout pass
  • -ddump-cmm-split — dump the results of the C-- proc-point splitting pass
  • -ddump-cmm-switch — dump the results of switch lowering passes
  • -ddump-cmm-thread-sanitizer — dump the results of the C-- ThreadSanitizer elaboration pass
  • -ddump-cmm-verbose — write output from main C-- pipeline passes to files
  • -ddump-cmm-verbose-by-proc — show output from main C-- pipeline passes (grouped by proc)
  • -ddump-core-stats — print a one-line summary of the size of the Core program at the end of the optimisation pipeline
  • -ddump-cpr-signatures — dump CPR signatures
  • -ddump-cpranal — dump CPR analysis output
  • -ddump-cs-trace — trace constraint solver
  • -ddump-cse — dump CSE output
  • -ddump-debug — dump generated DWARF debug information
  • -ddump-deriv — dump deriving output
  • -ddump-ds — dump desugarer output
  • -ddump-ec-trace — trace exhaustiveness checker
  • -ddump-exitify — dump output of the exitification pass
  • -ddump-faststrings — dump the whole FastString table when finished
  • -ddump-file-prefix=⟨str⟩ — set the prefix of the filenames used for debugging output
  • -ddump-foreign — dump foreign export stubs
  • -ddump-hie — dump the hie file syntax tree
  • -ddump-hpc — an alias for -ddump-ticked
  • -ddump-if-trace — trace interface files
  • -ddump-inlinings — dump inlinings performed by the simplifier
  • -ddump-js — dump final JavaScript code

okay continuing the flag buffet, bestie — these are the dump/debug flags and they are lowkey giving “backstage pass to GHC’s brain” energy 🧠✨

  • -ddump-json — dumps error messages as JSON documents 💖
  • -ddump-late-cc — dumps Core with late cost centres added ✨
  • -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 — shows renamer stats 🍓
  • -ddump-rn-trace — traces the renamer ✨
  • -ddump-rtti — traces runtime type inference 💖
  • -ddump-rule-firings — dumps rule firing info 🔥
  • -ddump-rule-rewrites — dumps detailed rule firing info 💅
  • -ddump-rules — dumps rewrite rules 🌸
  • -ddump-simpl — dumps 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-splices — dumps TH spliced expressions and what they evaluate to 🌈
  • -ddump-stg — deprecated, bestie — it’s just an 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 — dumps top-level demand signatures ⭐
  • -ddump-stranal — dumps demand analysis output 💖
  • -ddump-tc — dumps typechecker output 🎀
  • -ddump-tc-ast — dumps typechecker output as a syntax tree 🌈
  • -ddump-tc-trace — traces the typechecker 🔥
  • -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 💅
  • -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 type Word# 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. Useful with -ddump-parsed-ast 💖
  • -dlinear-core-lint — turns on internal sanity checking 🔥
  • -dlint — enables several common internal sanity checkers ✨
  • -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 💅
  • -dsuppress-coercion-types — suppresses printing of coercion types in Core dumps to make them shorter 🦋
  • -dsuppress-coercions — suppresses printing of coercions in Core dumps to make them shorter 🌸
  • -dsuppress-core-sizes — suppresses 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 printing of module qualification prefixes 🎀
  • -dsuppress-stg-free-vars — suppresses 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 printing of the stable unfolding of a variable at its binding site 💅
  • -dsuppress-uniques — suppresses printing of uniques in debug output (easier to use diff) 🦋
  • -dsuppress-var-kinds — suppresses printing of variable kinds 🌸
  • -dtag-inference-checks — affirms tag inference results are correct at runtime ✨
  • -dth-dec-file — dumps evaluated TH declarations into *.th.hs files 💜
  • -dunique-increment=⟨i⟩ — sets the increment for the generated Unique’s to ⟨i⟩ 🧚
  • -dverbose-core2core — shows output from each core-to-core pass 🍓
  • -dverbose-stg2stg — shows output from each STG-to-STG pass ⭐
  • -falignment-sanitisation — compiles with alignment checks for all info table dereferences 💖
  • -fcatch-nonexhaustive-cases — adds a default error alternative to case expressions without a default alternative 🔥
  • -fcheck-prim-bounds — instruments array primops with bounds checks ✨
  • -fcmm-thread-sanitizer — enables ThreadSanitizer instrumentation of memory accesses 💅
  • -fdistinct-constructor-tables — generates a fresh info table for each usage of a data constructor 🌸
  • -fdump-with-ways — includes the tag of the enabled ways in the extension of dump files 🦋
  • -finfo-table-map — embeds a lookup table in the generated binary which maps the address of an info table to the source position the closure originated from ⭐
  • -finfo-table-map-with-fallback — includes info tables with no source location information in the info table map 💜
  • -finfo-table-map-with-stack — includes info tables for STACK closures in the info table map 🎀
  • -fllvm-fill-undef-with-garbage — Intruct LLVM to fill dead STG registers with garbage 🌈
  • -fno-info-table-map-with-fallback — omits info tables with no source location information from the info table map 🔥
  • -fno-info-table-map-with-stack — omits info tables for STACK closures from the info table map ✨
  • -fproc-alignment — aligns functions at given boundary 💅
  • -g — produces DWARF debug information in compiled object files. ⟨n⟩ can be 0, 1, or 2, with higher numbers producing richer output. If ⟨n⟩ is omitted, level 2 is assumed 🦋

🌸 C pre-processor 🌸

  • -cpp — runs the C pre-processor on Haskell source files ✨
  • -D⟨symbol⟩[=⟨value⟩] — defines a symbol in the C pre-processor ⭐
  • -I⟨dir⟩ — adds ⟨dir⟩ to the directory search list for #include files 💖
  • -U⟨symbol⟩ — undefines a symbol in the C pre-processor 🔥

🎀 Finding imports 🎀

  • -i — empties the import directory list ✨
  • -i⟨dir⟩[:⟨dir⟩]* — adds ⟨dir⟩, ⟨dir2⟩, etc. to import path 💅

💅 Interactive mode 💅

  • -fbreak-on-error — breaks on uncaught exceptions and errors 🌸
  • -fbreak-on-exception — breaks on any exception thrown 🦋
  • -fghci-hist-size=⟨n⟩ — sets the number of entries GHCi keeps for :history. See The GHCi Debugger ⭐
  • -fghci-leak-check — (Debugging only) checks for space leaks when loading new modules in GHCi 💜
  • -fimplicit-import-qualified — puts in scope qualified identifiers for every loaded module 🎀
  • -flocal-ghci-history — uses current directory for the GHCi command history file .ghci-history 🌈
  • -fno-it — no longer sets the special variable it 🔥
  • -fprint-bind-result — turns on printing of binding results in GHCi ✨
  • -fprint-evld-with-show — instructs :print to use Show instances where possible 💅
  • -fshow-loaded-modules — shows the names of modules that GHCi loaded after a :load command 🦋
  • -ghci-script — reads additional .ghci files 🌸
  • -ignore-dot-ghci — disables reading of .ghci files ⭐
  • -interactive-print ⟨name⟩ — selects the function to use for printing evaluated expressions in GHCi 💖

🦋 Interface files 🦋

  • --show-iface ⟨file⟩ — see Modes of operation 🔥
  • -ddump-hi — dumps the new interface to stdout ✨
  • -ddump-hi-diffs — shows the differences vs. the old interface 💅
  • -ddump-minimal-imports — dumps a minimal set of imports 🌸

🌈 Keeping intermediate files 🌈

  • -keep-hc-file — retains intermediate .hc files 🦋
  • -keep-hi-files — retains intermediate .hi files (the default) ⭐
  • -keep-hscpp-file — retains intermediate .hscpp files 💜
  • -keep-llvm-file — retains intermediate LLVM .ll files. Implies -fllvm 🎀
  • -keep-o-files — retains intermediate .o files (the default) 🔥
  • -keep-s-file — retains intermediate .s files ✨
  • -keep-tmp-files — retains all intermediate temporary files 💅

💜 Language options 💜

  • -XAllowAmbiguousTypes — allows the user to write ambiguous types, and the type inference engine to infer them 🌸
  • -XApplicativeDo — enables Applicative do-notation desugaring 🦋
  • -XArrows — enables arrow notation extension ⭐
  • -XBangPatterns — enables bang patterns 💖
  • -XBinaryLiterals — enables support for binary literals 🎀
  • -XBlockArguments — allows do blocks and other constructs as function arguments 🌈
  • -XCApiFFI — enables the CAPI calling convention 🔥
  • -XConstrainedClassMethods — enables constrained class methods ✨
  • -XConstraintKinds — enables a kind of constraints 💅
  • -XCPP — enables the C preprocessor 🦋
  • -XCUSKs — enables detection of complete user-supplied kind signatures 🌸
  • -XDataKinds — enables datatype promotion ⭐
  • -XDatatypeContexts — allows contexts on data types 💖
  • -XDeepSubsumption — enables deep subsumption 🔥
  • -XDefaultSignatures — enables default signatures ✨
  • -XDeriveAnyClass — bestie you can derive for any class now 💅 like literally any of them
  • -XDeriveDataTypeable — turn on deriving for the Data class 🎀
  • -XDeriveFoldable — derive for Foldable ✨ heads up: DeriveTraversable already gives you this for free
  • -XDeriveFunctor — derive for Functor 🦋 and yeah, DeriveTraversable implies this one too
  • -XDeriveGeneric — derive for the Generic class, iconic behavior fr
  • -XDeriveLift — derive for the Lift class 🌸
  • -XDeriveTraversable — derive for Traversable 👑 and it hands you DeriveFunctor and DeriveFoldable as a lil bonus
  • -XDerivingStrategies — enables deriving strategies, periodt
  • -XDerivingVia — derive instances via types of the same runtime representation 💫 (implies DerivingStrategies)
  • -XDisambiguateRecordFields — turns on record field disambiguation 🎯 and RecordWildCards lowkey implies it already
  • -XDuplicateRecordFields — allow record types with identically-named fields, no cap
  • -XEmptyCase — empty case alternatives? allowed. slay 💀
  • -XEmptyDataDecls — define empty data types, yes really
  • -XEmptyDataDeriving — derive instances of standard type classes for empty data types 🫶
  • -XExistentialQuantification — enable liberalised type synonyms (that's the description, don't @ me)
  • -XExplicitForAll — enable explicit universal quantification ✨ and it's implied by ScopedTypeVariables, LiberalTypeSynonyms, RankNTypes and ExistentialQuantification
  • -XExplicitNamespaces — lets you use the keyword type to specify the namespace of entries in imports and exports (that's "Explicit namespaces in import/export" for the record) 💅 implied by TypeOperators and TypeFamilies
  • -XExtendedDefaultRules — use GHCi's extended default rules in a normal module 🌈
  • -XFieldSelectors — control visibility of field selector functions 👀
  • -XFlexibleContexts — removes some restrictions on class contexts 🎀
  • -XFlexibleInstances — enable flexible instances 💖 (implies TypeSynonymInstances)
  • -XForeignFunctionInterface — enable the foreign function interface 🌍
  • -XFunctionalDependencies — enable functional dependencies ✨ (implies MultiParamTypeClasses)
  • -XGADTs — enable generalised algebraic data types 🔥 implies GADTSyntax and MonoLocalBinds
  • -XGADTSyntax — enable generalised algebraic data type syntax 🦋
  • -XGeneralisedNewtypeDeriving — enable newtype deriving 💅
  • -XGeneralizedNewtypeDeriving — enable newtype deriving (yep, the other spelling, also 💅)
  • -XGHC2021 — use GHC's set of default language extensions from 2021 ⭐
  • -XGHCForeignImportPrim — enable the prim calling convention. intended for internal use only 🙈 like pls don't touch
  • -XHaskell2010 — use the Haskell 2010 language variant 👑
  • -XHaskell98 — use the Haskell 98 language variant 🧚
  • -XHexFloatLiterals — enable support for hexadecimal floating point literals 🔢
  • -XImplicitParams — enable Implicit Parameters 💫
  • -XImportQualifiedPost — ImportQualifiedPost allows the syntax import M qualified 🎀
  • -XImpredicativeTypes — enable impredicative types 🌸 (implies RankNTypes)
  • -XIncoherentInstances — enable incoherent instances 😭 (implies OverlappingInstances)
  • -XInstanceSigs — enable instance signatures ✍️
  • -XInterruptibleFFI — enable interruptible FFI 🛑
  • -XKindSignatures — enable kind signatures 💅 implied by TypeFamilies and PolyKinds
  • -XLambdaCase — enable lambda-case expressions 🌙
  • -XLexicalNegation — use whitespace to determine whether the minus sign stands for negation or subtraction 🚨 like, whitespace is doing the heavy lifting here
  • -XLiberalTypeSynonyms — enable liberalised type synonyms ✨
  • -XLinearTypes — enable linear types 📏
  • -XMagicHash — allow # as a postfix modifier on identifiers 🪄 it's giving magic fr
  • -XMonadComprehensions — enable monad comprehensions 🌀
  • -XMonoLocalBinds — enable "do not generalise local bindings" 🚫 implied by TypeFamilies and GADTs
  • -XMultiParamTypeClasses — enable multi parameter type classes 👯 implied by FunctionalDependencies
  • -XMultiWayIf — enable multi-way if-expressions 🔀
  • -XNamedFieldPuns — enable record puns 😄
  • -XNamedWildCards — enable named wildcards 🃏
  • -XNegativeLiterals — enable support for negative literals ➖
  • -XNoImplicitPrelude — don't implicitly import Prelude 🙅‍♀️ implied by RebindableSyntax
  • -XNoMonomorphismRestriction — disable the monomorphism restriction 💀
  • -XNondecreasingIndentation — allow nested contexts to be at the same indentation level as its enclosing context 📐
  • -XNoPatternGuards — disable pattern guards 🚫 implied by Haskell98
  • -XNoTraditionalRecordSyntax — disable support for traditional record syntax (the kind Haskell 98 supports), like C {f = x} 😔
  • -XNPlusKPatterns — enable support for n+k patterns 🧮 implied by Haskell98
  • -XNullaryTypeClasses — deprecated, does nothing 💀 nullary (no parameter) type classes are now enabled using MultiParamTypeClasses
  • -XNumDecimals — enable support for 'fractional' integer literals 🍰
  • -XNumericUnderscores — enable support for numeric underscores 🖊️
  • -XOverlappingInstances — enable overlapping instances 🫂
  • -XOverloadedLabels — enable overloaded labels 🏷️
  • -XOverloadedLists — enable overloaded lists 📋
  • -XOverloadedRecordDot — Record '.' syntax 🔵
  • -XOverloadedRecordUpdate — Record '.' syntax record updates 🔄
  • -XOverloadedStrings — enable overloaded string literals 🧵
  • -XPackageImports — enable package-qualified imports 📦
  • -XParallelListComp — enable parallel list comprehensions ⚡
  • -XPartialTypeSignatures — enable partial type signatures ✂️
  • -XPatternSynonyms — enable pattern synonyms 🔁
  • -XPolyKinds — enable kind polymorphism 🎭 (implies KindSignatures)
  • -XPostfixOperators — enable postfix operators 📎
  • -XQualifiedDo — enable qualified do-notation desugaring 🍩
  • -XQuantifiedConstraints — allow forall quantifiers in constraints 🗣️
  • -XQuasiQuotes — enable quasiquotation 💬
  • -XRank2Types — enable rank-2 types 🙌 it's just a synonym for RankNTypes
  • -XRankNTypes — enable rank-N types 🏆 implied by ImpredicativeTypes
  • -XRebindableSyntax — employ rebindable syntax 🧩 (implies NoImplicitPrelude)
  • -XRecordWildCards — enable record wildcards 🃏✨ implies DisambiguateRecordFields
  • -XRecursiveDo — enable recursive do (mdo) notation 🔄
  • -XRoleAnnotations — enable role annotations 🎬
  • -XSafe — enable the Safe Haskell Safe mode 🛡️
  • -XScopedTypeVariables — enable lexically-scoped type variables 🔍
  • -XStandaloneDeriving — enable standalone deriving 🧍
  • -XStandaloneKindSignatures — allow the use of standalone kind signatures ✍️
  • -XStarIsType — treat * as Data.Kind.Type ⭐
  • -XStaticPointers — enable static pointers 📌
  • -XStrict — make bindings in the current module strict by default 😤
  • -XStrictData — enable default strict datatype fields 📦
  • -XTemplateHaskell — enable Template Haskell 🧬
  • -XTemplateHaskellQuotes — enable the quotation subset of Template Haskell 💬
  • -XTransformListComp — enable generalised list comprehensions 🌀
  • -XTrustworthy — enable the Safe Haskell Trustworthy mode 🤝
  • -XTupleSections — enable tuple sections 🧩
  • -XTypeApplications — enable type application syntax in terms, patterns and types 🎯
  • -XTypeData — enable type data declarations 🗂️
  • -XTypeFamilies — enable type families 👨‍👩‍👧 implies ExplicitNamespaces, KindSignatures, and MonoLocalBinds
  • -XTypeFamilyDependencies — enable injective type families 💉 (implies TypeFamilies)
  • -XTypeInType — deprecated. enable kind polymorphism and datatype promotion 😬
  • -XTypeOperators — enable type operators ➕ (implies ExplicitNamespaces)
  • -XTypeSynonymInstances — enable type synonyms in instance heads 🎭 implied by FlexibleInstances
  • -XUnboxedSums — enable unboxed sums 📦
  • -XUnboxedTuples — enable the use of unboxed tuple syntax 📦📦
  • -XUndecidableInstances — enable undecidable instances 🤔
  • -XUndecidableSuperClasses — allow all superclass constraints, including those that may result in non-termination of the typechecker 💀 like bestie this one can literally loop forever, be careful
  • -XUnicodeSyntax — enable unicode syntax ✨
  • -XUnliftedDatatypes — enable unlifted data types 🪂
  • -XUnliftedFFITypes — enable unlifted FFI types 🪂
  • -XUnliftedNewtypes — enable unlifted newtypes 🪂
  • -XUnsafe — enable Safe Haskell Unsafe mode ⚠️
  • -XViewPatterns — enable view patterns 👓

🎀 Linking options 🎀

  • -c — stop after generating the object (.o) file 🛑
  • -debug — use the debugging runtime 🐛
  • -dylib-install-name ⟨path⟩ — set the install name (via -install_name passed to Apple's linker), specifying the full install path of the library file 📍 any libraries or executables that link with it later will pick up that path as their runtime search location for it. (Darwin/OS X only 🍎)
  • -dynamic — build dynamically-linked object files and executables 🌀
  • -dynload — selects one of a number of modes for finding shared libraries at runtime 🔎
  • -eventlog — enable runtime event tracing 📊
  • -fcompact-unwind — instruct the linker to produce a __compact_unwind section 📐
  • -fkeep-cafs — do not garbage-collect CAFs (top-level expressions) at runtime 🗑️
  • -flink-rts — link the runtime when generating a shared or static library 🔗
  • -fno-embed-manifest — do not embed the manifest in the executable (Windows only 🪟)
  • -fno-gen-manifest — do not generate a manifest file (Windows only 🪟)
  • -fno-shared-implib — don't generate an import library for a DLL (Windows only 🪟)
  • -framework ⟨name⟩ — on Darwin/OS X/iOS only, link in the framework ⟨name⟩ 🍏 this option corresponds to the -framework option for Apple's Linker
  • -framework-path ⟨dir⟩ — on Darwin/OS X/iOS only, add ⟨dir⟩ to the list of directories searched for frameworks 🔍 this option corresponds to the -F option for Apple's Linker
  • -fsplit-sections — split sections for link-time dead-code stripping ✂️
  • -fuse-rpaths — set the rpath based on -L flags 🛤️
  • -fwhole-archive-hs-libs — okay so when you're linking a binary executable, this one slips the flag -Wl,--whole-archive in right before any -l flags for Haskell libraries, and then -Wl,--no-whole-archive after them. 💅
  • -L ⟨dir⟩ — toss ⟨dir⟩ onto the list of directories we go hunting in for libraries. 🕵️♀️
  • -l ⟨lib⟩ — link in library ⟨lib⟩, that's it, that's the whole vibe. 🔗
  • -main-is ⟨thing⟩ — sets the main module and function. main character energy, literally. 👑
  • -no-hs-main — don't assume this program contains main. assumptions? not today bestie. 🙈
  • -no-pie — don't tell the linker to produce a position-independent executable.
  • -no-rtsopts-suggestions — don't print those RTS suggestions about linking with -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩]. we get it, we get it. 😭
  • -package ⟨name⟩ — expose package ⟨pkg⟩. come out, come out, wherever you are. ✨
  • -pie — tell the linker to produce a position-independent executable.
  • -rdynamic — this instructs the linker to add all symbols, not just the used ones, to the dynamic symbol table. currently Linux and Windows/MinGW32 only. it's equivalent to using -optl -rdynamic on Linux, and -optl -export-all-symbols on Windows. 🐧
  • -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩] — controls whether the RTS behaviour can be tweaked via command-line flags and the GHCRTS environment variable. here's the breakdown, stay with me:
    • none means no RTS flags can be given at all, periodt.
    • some means only a minimum of safe options can be given — and that's the default, btw.
    • all (or no argument at all) means all RTS flags are permitted, go off.
    • ignore means RTS flags can be given, but they're treated as regular arguments and passed to the Haskell program as arguments instead. sneaky.
    • ignoreAll is the same as ignore, except GHCRTS is also ignored.
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).
  • -static — use static Haskell libraries.
  • -staticlib — generate a standalone static library (as opposed to an executable). super 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. threads? we love threads. 🧵
  • -with-rtsopts=⟨opts⟩ — set the default RTS options to ⟨opts⟩.

🎀 Miscellaneous options 🎀

  • -ddump-mod-cycles — dump module cycles. 🔄
  • -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 extensions for exactly which ones. throwback behaviour fr. ⚠️
  • -fno-safe-haskell — disable Safe Haskell.
  • -ghcversion-file ⟨path to ghcversion.h⟩ — (GHC as a C compiler only) use this ghcversion.h file. 📄
  • -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. lowkey mysterious. 🤫
  • -j[⟨n⟩] — when compiling with --make, compile ⟨n⟩ modules in parallel. multitasking icon. ⚡
  • -reexported-module ⟨module name⟩ — a module which should be reexported from this unit.
  • -this-package-name ⟨unit-id⟩ — the name of the package which this module would be part of when installed.
  • -unit @⟨filename⟩ — specify the options to build a specific unit.
  • -working-dir ⟨dir⟩ — specify the directory a unit is expected to be compiled in. 📁

✨ Modes of operation ✨

  • --frontend ⟨module⟩ — run GHC with the given frontend plugin; see Frontend plugins for details.
  • --help — display help. when in doubt, ask for help bestie. 🆘
  • --info — display information about the compiler.
  • --interactive — interactive mode — normally used by just running ghci; see Using GHCi for details. 💬
  • --make — build a multi-module Haskell program, automatically figuring out dependencies. likely to be much easier, and faster, than using make; see Using ghc --make for details. this one ate. 🔥
  • --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. commit history but make it glamorous. 🫧
  • --print-project-version — display GHC version.
  • --print-rts-ways — display which way RTS was built.
  • --print-stage — display stage number of GHC.
  • --print-support-smp — display whether GHC was compiled with SMP support.
  • --print-tables-next-to-code — display whether GHC was compiled with --enable-tables-next-to-code.
  • --print-target-platform — display target platform of GHC.
  • --print-unregisterised — display whether this GHC was built in unregisterised mode.
  • --run ⟨file⟩ — run a Haskell program. 🏃♀️
  • --show-iface ⟨file⟩ — display the contents of an interface file.
  • --show-options — display the supported command line options.
  • --supported-extensions — display the supported language extensions.
  • --version — display GHC version. the classic. 💖
  • -e ⟨expr⟩ — evaluate expr; see Expression evaluation mode for details.
  • -M — generate dependency information suitable for use in a Makefile; see Dependency generation for details.
  • -shared — create a shared object.

💅 Individual optimizations 💅

okay this is the optimization section and it's long but every single one matters, so buckle up bestie.

  • -fasm-shortcutting — enable shortcutting on assembly.
  • -fbinary-blob-threshold=⟨n⟩ — default: 500K. tweak assembly generator for binary blobs.
  • -fblock-layout-cfg — use the new cfg based block layout algorithm.
  • -fblock-layout-weightless — ignore cfg weights for code layout.
  • -fblock-layout-weights — sets edge weights used by the new code layout algorithm.
  • -fcall-arity — enable call-arity optimisation. implied by -O.
  • -fcase-folding — enable constant folding in case expressions. implied by -O.
  • -fcase-merge — enable case-merging. implied by -O.
  • -fcmm-control-flow — enable control flow optimisation in the Cmm backend. implied by -O.
  • -fcmm-elim-common-blocks — enable Cmm common block elimination. implied by -O.
  • -fcmm-sink — enable Cmm sinking. implied by -O.
  • -fcmm-static-pred — enable static control flow prediction. implied by -O.
  • -fcore-constant-folding — enable constant folding in Core. implied by -O.
  • -fcpr-anal — turn on Constructed Product Result analysis. implied by -O.
  • -fcross-module-specialise — turn on specialisation of overloaded functions imported from other modules.
  • -fcse — enable common sub-expression elimination. implied by -O.
  • -fdicts-cheap — make dictionary-valued expressions seem cheap to the optimiser.
  • -fdicts-strict — make dictionaries strict. implied by -O2.
  • -fdmd-tx-dict-sel — (deprecated) use a special demand transformer for dictionary selectors. ⚠️
  • -fdmd-unbox-width=⟨n⟩ — default: 3. boxity analysis pretends that returned records with this many fields can be unboxed.
  • -fdo-eta-reduction — enable eta-reduction. implied by -O.
  • -fdo-lambda-eta-expansion — enable lambda eta-expansion. always enabled by default. no notes. ✨
  • -feager-blackholing — turn on eager blackholing.
  • -fenable-rewrite-rules — switch on all rewrite rules (including rules generated by automatic specialisation of overloaded functions). implied by -O.
  • -fexcess-precision — enable excess intermediate precision.
  • -fexitification — enables exitification optimisation. implied by -O.
  • -fexpose-all-unfoldings — expose all unfoldings, even for very large or recursive functions. no secrets, we're all friends 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 -O0 only.
  • -finline-generics — annotate methods of derived Generic and Generic1 instances with INLINE[1] pragmas based on heuristics. implied by -O.
  • -finline-generics-aggressively — annotate methods of all derived Generic and Generic1 instances with INLINE[1] pragmas.
  • -flate-dmd-anal — run demand analysis again, at the end of the simplification pipeline.
  • -flate-specialise — run a late specialisation pass.
  • -fliberate-case — turn on the liberate-case transformation. implied by -O2.
  • -fliberate-case-threshold=⟨n⟩ — default: 2000. set the size threshold for the liberate-case transformation to ⟨n⟩.
  • -fllvm-pass-vectors-in-regs — (deprecated) does nothing. literally nothing. icon of doing the least. 💀
  • -flocal-float-out — enable local floating definitions out of let-binds.
  • -flocal-float-out-top-level — enable local floating to float top-level bindings.
  • -floopification — turn saturated self-recursive tail-calls into local jumps in the generated assembly. implied by -O.
  • -fmax-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. inline memcpy calls if they would generate no more than ⟨n⟩ pseudo instructions.
  • -fmax-inline-memset-insns=⟨n⟩ — default: 32. inline memset calls if they would generate no more than ⟨n⟩ pseudo instructions.
  • -fmax-simplifier-iterations=⟨n⟩ — default: 4. caps how many times the simplifier is allowed to loop, bestie. that's the limit, periodt.
  • -fmax-uncovered-patterns=⟨n⟩ — default: 4. the most patterns GHC will show you when it's yelling about non-exhaustive ones. yes she will only show a few and leave you guessing 💀
  • -fmax-worker-args=⟨n⟩ — default: 10. biggest number of value arguments a worker is allowed to take.
  • -fno-opt-coercion — turns the coercion optimiser OFF. bye bestie 👋
  • -fno-pre-inlining — turns pre-inlining OFF.
  • -fno-state-hack — turns off the state hack, which is the whole thing where any lambda taking a real-world state token as an argument gets treated as single-entry, so it's considered fine to inline stuff inside it. turning it off means none of that.
  • -fomit-interface-pragmas — don't generate interface pragmas. it's only implied by -O0, just so you know.
  • -fomit-yields — skips heap checks whenever no allocation is actually happening. no alloc, no check, no problem ✨
  • -foptimal-applicative-do — uses a slower but better algorithm for ApplicativeDo. slower algorithm, better results, it's giving quality over speed 💅
  • -fpedantic-bottoms — makes GHC extra precise about how it handles bottom (but also go look at -fno-state-hack). specifically: GHC will not eta-expand through a case expression. she's being pedantic, that's the whole point.
  • -fpolymorphic-specialisation — lets specialisation abstract over free type variables.
  • -fregs-graph — uses the graph colouring register allocator for register allocation in the native code generator.
  • -fregs-iterative — uses the iterative coalescing graph colouring register allocator in the native code generator. (yes, that's a different one from the above, don't @ me)
  • -fsimpl-tick-factor=⟨n⟩ — default: 100. sets the percentage factor for simplifier ticks.
  • -fsimplifier-phases=⟨n⟩ — default: 2. sets how many phases the simplifier runs. ignored with -O0 just so you know.
  • -fsolve-constant-dicts — when solving constraints, try to eagerly solve super classes using the dictionaries you already have.
  • -fspec-constr — turns on the SpecConstr transformation. implied by -O2.
  • -fspec-constr-count=⟨n⟩ — default: 3.*. sets the max number of specialisations SpecConstr will create for any one function to ⟨n⟩.
  • -fspec-constr-keen — specialises a call that has an explicit constructor argument, even when that argument isn't scrutinised in the body of the function. she's keen about it 🔥
  • -fspec-constr-threshold=⟨n⟩ — default: 2000. sets the size threshold for the SpecConstr transformation to ⟨n⟩.
  • -fspecialise — turns on specialisation of overloaded functions. implied by -O.
  • -fspecialise-aggressively — turns on specialisation of overloaded functions regardless of size, as long as an unfolding is available. no size discrimination here 💅
  • -fstatic-argument-transformation — turns on the static argument transformation.
  • -fstg-cse — enables common sub-expression elimination on the STG intermediate language.
  • -fstg-lift-lams — enables late lambda lifting on the STG intermediate language. implied by -O2.
  • -fstg-lift-lams-known — allows turning known calls into unknown calls while doing late lambda lifting.
  • -fstg-lift-lams-non-rec-args — creates top-level non-recursive functions with at most <n> parameters while doing late lambda lifting.
  • -fstg-lift-lams-rec-args — creates top-level recursive functions with at most <n> parameters while doing late lambda lifting.
  • -fstrictness — turns on demand analysis. implied by -O. and it implies -fworker-wrapper too, chain reaction ✨
  • -fstrictness-before=⟨n⟩ — runs an extra demand analysis before simplifier phase ⟨n⟩.
  • -funbox-small-strict-fields — flattens strict constructor fields that have a pointer-sized representation. implied by -O.
  • -funbox-strict-fields — flattens strict constructor fields.
  • -funfolding-case-scaling=⟨n⟩ — default: 30. applies a penalty of (inlining_cost * 1/n) for every level of case nesting.
  • -funfolding-case-threshold=⟨n⟩ — default: 2. reduces inlining for cases nested deeper than n.
  • -funfolding-creation-threshold=⟨n⟩ — default: 750. tweaks unfolding settings.
  • -funfolding-dict-discount=⟨n⟩ — default: 30. tweaks unfolding settings.
  • -funfolding-fun-discount=⟨n⟩ — default: 60. tweaks unfolding settings.
  • -funfolding-keeness-factor=⟨n⟩ — this has been deprecated in GHC 9.0.1. rip 🪦
  • -funfolding-use-threshold=⟨n⟩ — default: 80. tweaks unfolding settings.
  • -fworker-wrapper — enables the worker/wrapper transformation.
  • -fworker-wrapper-cbv — enables w/w splits for wrappers whose sole purpose is evaluating arguments.

✨ Optimization levels ✨

  • -O — enable level 1 optimisations 🚀
  • -O0 — disable optimisations (this is the default).
  • -O2 — enable level 2 optimisations.
  • -O⟨n⟩ — any -On where n > 2 is the same as -O2. so don't think -O7 is gonna hit different, bestie, it's just -O2.

🎀 Package options 🎀

  • -clear-package-db — clears the package db stack. empty. clean slate.
  • -distrust ⟨pkg⟩ — exposes package ⟨pkg⟩ and sets it to be distrusted. see Safe Haskell.
  • -distrust-all-packages — distrusts all packages by default. see Safe Haskell.
  • -fpackage-trust — enables the Safe Haskell trusted package requirement for trustworthy modules.
  • -global-package-db — adds the global package db to the stack.
  • -hide-all-packages — hides all packages by default.
  • -hide-package ⟨pkg⟩ — hides package ⟨pkg⟩.
  • -ignore-package ⟨pkg⟩ — ignores package ⟨pkg⟩.
  • -no-auto-link-packages — don't automatically link in the base and rts packages.
  • -no-global-package-db — removes the global package db from the stack.
  • -no-user-package-db — removes the user's package db from the stack.
  • -package ⟨pkg⟩ — exposes package ⟨pkg⟩.
  • -package-db ⟨file⟩ — adds ⟨file⟩ to the package db stack.
  • -package-env ⟨file⟩|⟨name⟩ — uses the specified package environment.
  • -package-id ⟨unit-id⟩ — exposes package by id ⟨unit-id⟩.
  • -this-unit-id ⟨unit-id⟩ — compile so this is part of unit (i.e. package) ⟨unit-id⟩.
  • -trust ⟨pkg⟩ — exposes package ⟨pkg⟩ and sets it to be trusted. see Safe Haskell.
  • -user-package-db — adds the user's package db to the stack.

🌈 Phases of compilation 🌈

  • --merge-objs — merges a set of objects into a GHCi library.
  • -C — stop after generating C (.hc file).
  • -c — stop after generating object (.o) file.
  • -E — stop after preprocessing (.hspp file).
  • -F — enable the use of a pre-processor (set with -pgmF ⟨cmd⟩).
  • -S — stop after generating assembly (.s file).
  • -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.
  • -pgmcxx ⟨cmd⟩ — use ⟨cmd⟩ as the C++ compiler.
  • -pgmdll ⟨cmd⟩ — use ⟨cmd⟩ as the DLL generator.
  • -pgmF ⟨cmd⟩ — use ⟨cmd⟩ as the pre-processor (with -F only).
  • -pgmi ⟨cmd⟩ — use ⟨cmd⟩ as the external interpreter command.
  • -pgminstall_name_tool ⟨cmd⟩ — use ⟨cmd⟩ as the program to inject runpath into mach-o dylibs on macOS.
  • -pgmL ⟨cmd⟩ — use ⟨cmd⟩ as the literate pre-processor.
  • -pgml ⟨cmd⟩ — use ⟨cmd⟩ as the linker.
  • -pgmlc ⟨cmd⟩ — use ⟨cmd⟩ as the LLVM compiler.
  • -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 -cpp only).
  • -pgms ⟨cmd⟩ — use ⟨cmd⟩ as the splitter.
  • -pgmwindres ⟨cmd⟩ — use ⟨cmd⟩ as the program for embedding manifests on Windows.

🦋 Phase-specific options 🦋

  • -opta ⟨option⟩ — pass ⟨option⟩ to the assembler.
  • -optc ⟨option⟩ — pass ⟨option⟩ to the C compiler.
  • -optcxx ⟨option⟩ — pass ⟨option⟩ to the C++ compiler.
  • -optdll ⟨option⟩ — pass ⟨option⟩ to the DLL generator.
  • -optF ⟨option⟩ — pass ⟨option⟩ to the custom pre-processor.
  • -opti ⟨option⟩ — pass ⟨option⟩ to the interpreter sub-process.
  • -optL ⟨option⟩ — pass ⟨option⟩ to the literate pre-processor.
  • -optl ⟨option⟩ — pass ⟨option⟩ to the linker.
  • -optlc ⟨option⟩ — pass ⟨option⟩ to the LLVM compiler.
  • -optlm ⟨option⟩ — pass ⟨option⟩ to the linker when merging object files.
  • -optlo ⟨option⟩ — pass ⟨option⟩ to the LLVM optimiser.
  • -optP ⟨option⟩ — pass ⟨option⟩ to cpp (with -cpp only).
  • -optwindres ⟨option⟩ — pass ⟨option⟩ to windres.
  • -pgmc-supports-no-pie — (deprecated) indicates that the linker supports -no-pie.
  • -pgml-supports-no-pie — indicates that the linker supports -no-pie.

⭐ Platform-specific options ⭐

  • -mavx — (x86 only) enable support for AVX SIMD extensions.
  • -mavx2 — (x86 only) enable support for AVX2 SIMD extensions.
  • -mavx512cd — (x86 only) enable support for AVX512-CD SIMD extensions.
  • -mavx512er — (x86 only) enable support for AVX512-ER SIMD extensions.
  • -mavx512f — (x86 only) enable support for AVX512-F SIMD extensions.
  • -mavx512pf — (x86 only) enable support for AVX512-PF SIMD extensions.
  • -mbmi — (x86 only) use BMI1 for bit manipulation operations.
  • -mbmi2 — (x86 only) use BMI2 for bit manipulation operations.
  • -msse — (x86 only) use SSE for floating-point operations.
  • -msse2 — (x86 only) use SSE2 for floating-point operations.
  • -msse3 — (x86 only) use SSE3 for floating-point operations.
  • -msse4 — (x86 only) use SSE4 for floating-point operations.
  • -msse4.2 — (x86 only) use SSE4.2 for floating-point operations.

🧚 Compiler plugins 🧚

  • -fclear-plugins — clears the list of active plugins.
  • -fplugin-library=⟨file-path⟩;⟨unit-id⟩;⟨module⟩;⟨args⟩ — loads a pre-compiled static plugin from an external library.
  • -fplugin-opt=⟨module⟩:⟨args⟩ — gives arguments to a plugin module; the module must be specified with -fplugin=⟨module⟩.
  • -fplugin-trustworthy — trusts the used plugins and stops marking the compiled module as unsafe.
  • -fplugin=⟨module⟩ — loads a plugin exported by a given module.
  • -hide-all-plugin-packages — hides all packages for plugins by default.
  • -plugin-package ⟨pkg⟩ — exposes ⟨pkg⟩ for plugins.
  • -plugin-package-id ⟨pkg-id⟩ — expose ⟨pkg-id⟩ so plugins can see it. bestie, that's the whole job 💫

🌸 Profiling 🌸

so you wanna know where your program is actually spending its lil life?? this is the section, no cap 🔥

  • -auto — (deprecated 😭) alias for -fprof-auto-exported
  • -auto-all — (deprecated 😭) alias for -fprof-auto
  • -caf-all — (deprecated 😭) alias for -fprof-cafs
  • -fno-prof-count-entries — do not collect entry counts, periodt
  • -fprof-auto — auto-add SCCs to every binding that is not marked INLINE ✨
  • -fprof-auto-calls — auto-add SCCs to all call sites 👀
  • -fprof-auto-exported — auto-add SCCs to all exported bindings that aren't marked INLINE
  • -fprof-auto-top — auto-add SCCs to all top-level bindings that aren't marked INLINE
  • -fprof-cafs — auto-add SCCs to all CAFs 🎀
  • -fprof-callers=⟨name⟩ — auto-add SCCs to every call-site of the function called ⟨name⟩ 🫶
  • -fprof-late — auto-add SCCs to all top level bindings, but like… after the core pipeline has already run 🦋
  • -fprof-late-inline — auto-add SCCs to all top level bindings after the optimizer has run, and keep them when inlining
  • -fprof-manual — process the manual SCC annotations you wrote yourself 💅
  • -no-auto — (deprecated 😭) alias for -fno-prof-auto
  • -no-auto-all — (deprecated 😭) alias for -fno-prof-auto
  • -no-caf-all — (deprecated 😭) alias for -fno-prof-cafs
  • -prof — turn on profiling, that's it, that's the option 🔥
  • -ticky — turn on ticky-ticky profiling ✨
  • -ticky-allocd — track how many times each closure type gets allocated
  • -ticky-ap-thunk — don't use standard AP thunks, so you get more reliable entry counters 👑
  • -ticky-dyn-thunk — track allocations of dynamic thunks
  • -ticky-LNE — treat join point binders kinda like thunks/functions 💜
  • -ticky-tag-checks — emit dummy ticky counters to record how many tag-inference checks tag inference avoided 🌈

🍓 Program coverage 🍓

  • -fhpc — turn on Haskell program coverage instrumentation 🎀
  • -hpcdir⟨dir⟩ — set the directory where GHC puts its .mix files 🦋

💅 Recompilation checking 💅

  • -exclude-module=⟨file⟩ — treat ⟨file⟩ as "stable", i.e. exclude it from having dependencies on it 🫶
  • -fforce-recomp — turn off recompilation checking entirely. ngl this is implied by any -ddump-X option when you're compiling a single file (i.e. when you're using -c)
  • -fignore-hpc-changes — don't recompile modules just to match changes to HPC flags. super useful for dodging recompiles in GHCi, and it's on by default for GHCi ✨
  • -fignore-optim-changes — don't recompile modules just to match changes to optimisation flags. same deal: great for GHCi, and enabled by default for GHCi ✨
  • -include-cpp-deps — include preprocessor dependencies 👀
  • -include-pkg-deps — treat modules imported from packages as unstable 😭

🌈 Redirecting output 🌈

okay this is the whole "where do my files even go" section, iconic honestly

  • -dep-makefile ⟨file⟩ — use ⟨file⟩ as the makefile
  • -dep-suffix ⟨suffix⟩ — make dependencies that declare that files with suffix .<⟨suf⟩><osuf> depend on interface files with suffix .<⟨suf⟩>hi
  • -dumpdir ⟨dir⟩ — redirect dump files 📁
  • -dynhisuf ⟨suffix⟩ — set the suffix to use for dynamic interface files
  • -dyno ⟨file⟩ — set dynamic output filename
  • -dynohi ⟨file⟩ — set the filename in which to put the dynamic interface
  • -dynosuf ⟨suffix⟩ — set the dynamic output file suffix
  • -hcsuf ⟨suffix⟩ — set the suffix to use for intermediate C files
  • -hidir ⟨dir⟩ — set directory for interface files
  • -hiedir ⟨dir⟩ — set directory for extended interface files
  • -hiesuf ⟨suffix⟩ — set the suffix to use for extended interface files
  • -hisuf ⟨suffix⟩ — set the suffix to use for interface files
  • -o ⟨file⟩ — set output filename
  • -odir ⟨dir⟩ — set directory for object files
  • -ohi ⟨file⟩ — set the filename in which to put the interface
  • -osuf ⟨suffix⟩ — set the output file suffix
  • -outputdir ⟨dir⟩ — set output directory
  • -stubdir ⟨dir⟩ — redirect FFI stub files 🧚

⭐ Temporary files ⭐

  • -tmpdir ⟨dir⟩ — set the directory for temporary files 🗂️

🎀 Verbosity options 🎀

the way GHC will literally tell you everything if you ask nicely… obsessed

  • -fabstract-refinement-hole-fits — default: off. toggles whether refinements where one or more of the holes are abstract get reported 👀
  • -fdefer-diagnostics — defer and group diagnostic messages by severity
  • -fdiagnostics-color=⟨always|auto|never⟩ — use colors in error messages 🌈
  • -fdiagnostics-show-caret — whether to show snippets of the original source code
  • -ferror-spans — output the full span in error messages
  • -fhide-source-paths — hide module source and object paths 🙈
  • -fkeep-going — keep compiling as far as possible even when there are errors 💪
  • -fmax-refinement-hole-fits=⟨n⟩ — default: 6. set the max number of refinement hole fits for typed holes to display in type error messages
  • -fmax-relevant-binds=⟨n⟩ — default: 6. set the max number of bindings to display in type error messages
  • -fmax-valid-hole-fits=⟨n⟩ — default: 6. set the max number of valid hole fits for typed holes to display in type error messages
  • -fno-show-valid-hole-fits — disables showing a list of valid hole fits for typed holes in type error messages
  • -fno-sort-valid-hole-fits — disables the sorting of the list of valid hole fits for typed holes in type error messages
  • -fprint-axiom-incomps — display equation incompatibilities in closed type families
  • -fprint-equality-relations — distinguish between equality relations when printing
  • -fprint-expanded-synonyms — in type errors, also print type-synonym-expanded types
  • -fprint-explicit-coercions — print coercions in types
  • -fprint-explicit-foralls — print explicit forall quantification in types. see also ExplicitForAll ✨
  • -fprint-explicit-kinds — print explicit kind foralls and kind arguments in types. see also KindSignatures
  • -fprint-explicit-runtime-reps — print RuntimeRep and Levity variables in types which are runtime-representation polymorphic
  • -fprint-potential-instances — display all available instances in type error messages 👀
  • -fprint-redundant-promotion-ticks — print redundant DataKinds promotion ticks
  • -fprint-typechecker-elaboration — print extra information from the typechecker
  • -fprint-unicode-syntax — use unicode syntax when printing expressions, types and kinds. see also UnicodeSyntax 💅
  • -frefinement-level-hole-fits=⟨n⟩ — default: off. sets the level of refinement of the refinement hole fits, where level n means that hole fits of up to n holes will be considered
  • -freverse-errors — output errors in reverse order 🙃
  • -fshow-docs-of-hole-fits — toggles whether to show the documentation of the valid hole fits in the output
  • -fshow-error-context — whether to show textual information about error context
  • -fshow-hole-constraints — show constraints when reporting typed holes
  • -fshow-hole-matches-of-hole-fits — toggles whether to show the type of the additional holes in refinement hole fits
  • -fshow-provenance-of-hole-fits — toggles whether to show the provenance of the valid hole fits in the output
  • -fshow-type-app-of-hole-fits — toggles whether to show the type application of the valid hole fits in the output
  • -fshow-type-app-vars-of-hole-fits — toggles whether to show what type each quantified variable takes in a valid hole fit
  • -fshow-type-of-hole-fits — toggles whether to show the type of the valid hole fits in the output
  • -fsort-by-size-hole-fits — sort valid hole fits by size
  • -fsort-by-subsumption-hole-fits — sort valid hole fits by subsumption
  • -funclutter-valid-hole-fits — unclutter the list of valid hole fits by not showing provenance nor type applications of suggestions 🧹
  • -Rghc-timing — summarise timing stats for GHC (same as +RTS -tstderr) ⏱️
  • -v — verbose mode (equivalent to -v3)
  • -v⟨n⟩ — set verbosity level

💀 Warnings 💀

  • -fdefer-out-of-scope-variables — convert variable out of scope variables errors into warnings. implied by -fdefer-type-errors. see also -Wdeferred-out-of-scope-variables 😌
  • -fdefer-type-errors — turn type errors into warnings, deferring the error until runtime. implies -fdefer-typed-holes and -fdefer-out-of-scope-variables. see also -Wdeferred-type-errors 😭
  • -fdefer-typed-holes — convert typed hole errors into warnings, deferring the error until runtime. implied by -fdefer-type-errors. see also -Wtyped-holes
  • -fenable-th-splice-warnings — generate warnings for Template Haskell splices
  • -fhelpful-errors — make suggestions for mis-spelled names 🫶
  • -fmax-pmcheck-models=⟨n⟩ — soft limit on the number of parallel models the pattern match checker should check a pattern match clause against
  • -fshow-warning-groups — show which group an emitted warning belongs to
  • -fvia-C — use the C code generator
  • -W — enable normal warnings
  • -w — disable all warnings 🤫
  • -Wall — enable almost all warnings (details in Warnings and sanity-checking) 🔥
  • -Wall-missed-specialisations — warn when specialisation of any overloaded function fails
  • -Wall-missed-specializations — alias for -Wall-missed-specialisations
  • -Wambiguous-fields — warn about ambiguous field selectors or updates
  • -Wauto-orphans — (deprecated 😭) does nothing
  • -Wcompat — enable future compatibility warnings (details in Warnings and sanity-checking)
  • -Wcompat-unqualified-imports — report unqualified imports of core libraries which are expected to cause compatibility problems in future releases
  • -Wcpp-undef — warn on uses of the #if directive on undefined identifiers
  • -Wdefault — enable default flags
  • -Wdeferred-out-of-scope-variables — report warnings when variable out-of-scope errors are deferred until runtime. see -fdefer-out-of-scope-variables
  • -Wdeferred-type-errors — report warnings when deferred type errors are enabled. this option is enabled by default. see -fdefer-type-errors ✨

okay bestie we're STILL in the -W warnings and this list is genuinely its own personality at this point 💅 every single one, no skips, let's go 🫶

  • -Wdeprecated-flags — yells at you when you use commandline flags that are deprecated. old news, hang it up 💀
  • -Wdeprecations — warns about uses of functions & types that have warnings or deprecated pragmas. it's an alias for -Wwarnings-deprecations ✨
  • -Wderiving-defaults — warns about default deriving when you're using both DeriveAnyClass and GeneralizedNewtypeDeriving at once. pick a lane bestie 😭
  • -Wderiving-typeable — warns when Typeable is derived 👀
  • -Wdodgy-exports — warns about dodgy exports. yes that's the whole description, it's giving mysterious 🕵️
  • -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. we heard you the first time 🗣️
  • -Wduplicate-exports — warns when an entity is exported multiple times
  • -Wempty-enumerations — warns about enumerations that are empty. empty. void. nothing there. iconic 🌸
  • -Werror — make warnings fatal. every lil warning becomes a whole crisis 🔥
  • -Weverything — enable all warnings supported by GHC. the maximalist queen option, she does the most 👑
  • -Wextra — alias for -W
  • -Wforall-identifier — warns when forall is used as an identifier (at definition sites)
  • -Wgadt-mono-local-binds — warns when pattern matching on a GADT without MonoLocalBinds
  • -Whi-shadowing — (deprecated) warns when a .hi file in the current directory shadows a library
  • -Widentities — warns about uses of Prelude numeric conversions that are probably the identity (and hence could be omitted). girl you did nothing, just say that 💅
  • -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
  • -Winaccessible-code — warns about inaccessible code
  • -Wincomplete-patterns — warns when a pattern match could fail. your case is not as covered as you think 🫣
  • -Wincomplete-record-updates — warns when a record update could fail
  • -Wincomplete-uni-patterns — warns when a pattern match in a lambda expression, pattern binding or a lazy pattern could fail
  • -Winferred-safe-imports — warns when an explicitly Safe Haskell module imports a Safe-Inferred one
  • -Winline-rule-shadowing — Warns if a rewrite RULE might fail to fire because the function might be inlined before the rule has a chance to fire. See How rules interact with INLINE/NOINLINE pragmas. the race condition of it all 😭
  • -Winvalid-haddock — warns when a Haddock comment occurs in an invalid position
  • -Wloopy-superclass-solve — warns when creating potentially-loopy superclass constraint evidence 🔄
  • -Wmisplaced-pragmas — warns about uses of file header pragmas in the module body
  • -Wmissed-extra-shared-lib — Warns when GHCi can't load a shared lib.
  • -Wmissed-specialisations — warns when specialisation of an imported, overloaded function fails.
  • -Wmissed-specializations — alias for -Wmissed-specialisations
  • -Wmissing-deriving-strategies — warns when a deriving clause is missing a deriving strategy
  • -Wmissing-export-lists — warns when a module declaration does not explicitly list all exports
  • -Wmissing-exported-pattern-synonym-signatures — warns about pattern synonyms without signatures, only if they are exported
  • -Wmissing-exported-signatures — warns about top-level functions without signatures, only if they are exported
  • -Wmissing-exported-sigs — (deprecated) warns about top-level functions without signatures, only if they are exported. takes precedence over -Wmissing-signatures ⚠️
  • -Wmissing-fields — warns when fields of a record are uninitialised
  • -Wmissing-home-modules — warns when encountering a home module imported, but not listed on the command line. Useful for cabal to ensure GHC won't pick up modules, not listed neither in exposed-modules, nor in other-modules. cabal said stay in your lane 📋
  • -Wmissing-import-lists — warns when an import declaration does not explicitly list all the names brought into scope
  • -Wmissing-kind-signatures — warns when type declarations don't have kind signatures nor CUSKs
  • -Wmissing-local-signatures — warns about polymorphic local bindings without signatures
  • -Wmissing-local-sigs — (deprecated) warns about polymorphic local bindings without signatures
  • -Wmissing-methods — warns when class methods are undefined. the class is missing its girlies 🎀
  • -Wmissing-monadfail-instances — (deprecated) Warns when a failable pattern is used in a do-block that does not have a MonadFail instance.
  • -Wmissing-pattern-synonym-signatures — warns when pattern synonyms do not have type signatures
  • -Wmissing-safe-haskell-mode — warns when the Safe Haskell mode is not explicitly specified.
  • -Wmissing-signatures — warns about top-level functions without signatures
  • -Wmissing-space-after-bang — (deprecated) Does nothing. literally zero, a ghost, an empty vessel 💀
  • -Wmonomorphism-restriction — warns when the Monomorphism Restriction is applied
  • -Wname-shadowing — warns when names are shadowed. bestie your local is wearing your global's outfit 🙈
  • -Wno-compat — Disables all warnings enabled by -Wcompat.
  • -Wnoncanonical-monad-instances — warns when Applicative or Monad instances have noncanonical definitions of return, pure, (>>), or (*>). See flag description in Warnings and sanity-checking for more details.
  • -Wnoncanonical-monadfail-instances — (deprecated) warns when Monad or MonadFail instances have noncanonical definitions of fail.
  • -Wnoncanonical-monoid-instances — warns when Semigroup or Monoid instances have noncanonical definitions of (<>) or mappend. See flag description in Warnings and sanity-checking for more details.
  • -Wnot — (deprecated) Alias for -w
  • -Woperator-whitespace — warns on prefix, suffix, and tight infix uses of infix operators
  • -Woperator-whitespace-ext-conflict — warns on uses of infix operators that would be parsed differently were a particular GHC extension enabled
  • -Worphans — warns when the module contains orphan instance declarations or rewrite rules. no parents, no home, just vibes 😢
  • -Woverflowed-literals — warns about literals that will overflow their type
  • -Woverlapping-patterns — warns about overlapping patterns
  • -Wpartial-fields — warns when defining a partial record field.
  • -Wpartial-type-signatures — warns about holes in partial type signatures when PartialTypeSignatures is enabled. Not applicable when PartialTypeSignatures is not enabled, in which case errors are generated for such holes. 🕳️
  • -Wprepositive-qualified-module — Reports imports with a leading/prepositive "qualified"
  • -Wredundant-bang-patterns — Warns about redundant bang patterns. ! for nothing fr fr
  • -Wredundant-constraints — Has the compiler warn about redundant constraints in type signatures.
  • -Wredundant-record-wildcards — Warns about record wildcard matches when the wildcard binds no patterns.
  • -Wredundant-strictness-flags — Warns about redundant strictness flags.
  • -Wsafe — warns if the module being compiled is regarded to be safe.
  • -Wsemigroup — warns when a Monoid is not Semigroup, and on non-Semigroup definitions of (<>)?
  • -Wsimplifiable-class-constraints — Warns about class constraints in a type signature that can be simplified using a top-level instance declaration.
  • -Wstar-binder — warns about binding the (*) type operator despite StarIsType
  • -Wstar-is-type — warns when * is used to mean Data.Kind.Type
  • -Wtabs — warns if there are tabs in the source file. tabs are NOT the moment 🚫
  • -Wtrustworthy-safe — warns if the module being compiled is marked as Trustworthy but it could instead be marked as Safe, a more informative bound.
  • -Wtype-defaults — warns when defaulting happens
  • -Wtype-equality-out-of-scope — warns when type equality a ~ b is used despite being out of scope
  • -Wtype-equality-requires-operators — warns when type equality a ~ b is used despite being out of scope
  • -Wtyped-holes — Reports warnings when typed hole errors are deferred until runtime. See -fdefer-typed-holes.
  • -Wunbanged-strict-patterns — warns on pattern bind of unlifted variable that is neither bare nor banged
  • -Wunicode-bidirectional-format-characters — warns about the usage of unicode bidirectional layout override characters
  • -Wunrecognised-pragmas — warns about uses of pragmas that GHC doesn't recognise
  • -Wunrecognised-warning-flags — throws a warning when an unrecognised -W... flag is encountered on the command line.
  • -Wunsafe — warns if the module being compiled is regarded to be unsafe. See Safe Haskell
  • -Wunsupported-calling-conventions — warns about use of an unsupported calling convention
  • -Wunsupported-llvm-version — Warns when using -fllvm with an unsupported version of LLVM.
  • -Wunticked-promoted-constructors — warns if promoted constructors are not ticked
  • -Wunused-binds — warns about bindings that are unused. Alias for -Wunused-top-binds, -Wunused-local-binds and -Wunused-pattern-binds
  • -Wunused-do-bind — warns about do bindings that appear to throw away values of types other than ()
  • -Wunused-foralls — warns about type variables in user-written forall\s that are unused
  • -Wunused-imports — warns about unnecessary imports
  • -Wunused-local-binds — warns about local bindings that are unused
  • -Wunused-matches — warns about variables in patterns that aren't used
  • -Wunused-packages — warns when package is requested on command line, but not needed. you brought a whole package and didn't even use it 🎒
  • -Wunused-pattern-binds — warns about pattern match bindings that are unused
  • -Wunused-record-wildcards — Warns about record wildcard matches when none of the bound variables are used.
  • -Wunused-top-binds — warns about top-level bindings that are unused
  • -Wunused-type-patterns — warns about unused type variables which arise from patterns in type family and data family instances
  • -Wwarn — make warnings non-fatal. back to chill mode, breathe 😌
  • -Wwarnings-deprecations — warns about uses of functions & types that have warnings or deprecated pragmas
  • -Wwrong-do-bind — warns about do bindings that appear to throw away monadic values that you should have bound instead. girl you dropped the monad on the floor 💀

Copyright 2015. The University Court of the University of Glasgow. All rights reserved. 🏛️✨

👀 SEE ALSO 👀


💖 AUTHOR 💖

The GHC Team wrote this whole entire thing. yes, the GHC Team. iconic behavior, no cap. 👑


2020, GHC Team — that's the copyright, periodt. 💅


okay so that's the whole page, we made it to the end and honestly? slay. 🌈 this was GHC as documented for version 9.6.6, dated Feb 17, 2025 — like, that's the release and the date it got written up, and now you know them both so you never have to wonder which build you're reading about. 🫶

go compile something cute. mwah. 💖✨🎀

📦 where this page comes from