GHC(1)

📦 version 9.0.2, in debian bookworm

💖 GHC(1) — Glasgow Haskell Compiler 💖

okay bestie, buckle up, because this is the manual page for ghc, aka the Glasgow Haskell Compiler, and it is long. We're doing it in parts, so this is part one, and yes it's giving "iconic reference doc that ate". ✨


🌸 NAME 🌸

ghc — the Glasgow Haskell Compiler 🦋


✨ SYNOPSIS ✨

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

🎀 DESCRIPTION 🎀

So this manual page documents, briefly, the ghc and ghci commands. Heads up though — ghci is not yet available on all architectures, so if it's not vibing on your machine, that's why, no cap.

There's extensive documentation in a bunch of other formats too, if you want the full lore:


okay so here's the thing you actually need to internalise: every single one of GHC's command line options is classified as either static or dynamic. 💅

  • A static flag may only be specified on the command line.
  • 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, and so are the warning options and the debugging options. 🫶

Everything else is static, with the notable exceptions of -v, -cpp, -fasm, -fvia-C, -fllvm, and -#include. The OPTIONS sections list the status of each flag, so if you're ever unsure, that's where you look. iykyk.


🧚 Common suffixes of file names for Haskell 🧚

  • .hs — Haskell source code; preprocess, compile
  • .lhs — literate Haskell source; unlit, preprocess, compile
  • .hi — Interface file; contains information about exported symbols
  • .hc — intermediate C files
  • .⟨way⟩_o — object files for "way" ⟨way⟩; common ways are:
    • dyn — dynamically-linked
    • p — built with profiling
  • .⟨way⟩_hi — interface files for "way" ⟨way⟩; common ways are:

💅 OPTIONS 💅

This is the big one. Every flag, every category, zero skips, we are not leaving anyone behind. 👑

🔥 Code generation 🔥

-dynamic-too -fasm -fllvm -fbyte-code -fexternal-dynamic-refs
-fllvm -fasm -fno-code -fobject-code -fPIC -fPIE
-fwrite-interface

💀 Debugging the compiler 💀

the compiler-debugging flags, and yes there are a lot, and yes I typed every single one:

-dcmm-lint -dcore-lint -ddump-asm -ddump-asm-expanded
-ddump-asm-liveness -ddump-asm-native -ddump-asm-regalloc
-ddump-asm-regalloc-stages -ddump-asm-stats -ddump-bcos
-ddump-cfg-weights -ddump-cmm -ddump-cmm-caf -ddump-cmm-cbe
-ddump-cmm-cfg -ddump-cmm-cps -ddump-cmm-from-stg -ddump-cmm-info
-ddump-cmm-opt -ddump-cmm-proc -ddump-cmm-procmap -ddump-cmm-raw
-ddump-cmm-sink -ddump-cmm-sp -ddump-cmm-split -ddump-cmm-switch
-ddump-cmm-verbose -ddump-cmm-verbose-by-proc -ddump-core-stats
-ddump-cpr-signatures -ddump-cpranal -ddump-cse -ddump-deriv
-ddump-ds -ddump-ds-preopt -ddump-ec-trace
-ddump-file-prefix=⟨str⟩ -ddump-foreign -ddump-hie -ddump-hpc
-ddump-if-trace -ddump-inlinings -ddump-json -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-spec
-ddump-splices -ddump-stg -ddump-stg-final -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-worker-wrapper
-dfaststring-stats -dhex-word-literals -dinitial-unique=⟨s⟩
-dinline-check=⟨str⟩ -dlinear-core-lint -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-coercions
-dsuppress-idinfo -dsuppress-module-prefixes
-dsuppress-stg-free-vars -dsuppress-ticks -dsuppress-timestamps
-dsuppress-type-applications -dsuppress-type-signatures
-dsuppress-unfoldings -dsuppress-uniques -dsuppress-var-kinds
-dth-dec-file -dunique-increment=⟨i⟩ -dverbose-core2core
-dverbose-stg2stg -falignment-sanitisation -fcatch-bottoms
-fllvm-fill-undef-with-garbage -fproc-alignment -g -g⟨n⟩

🍓 C pre-processor 🍓

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

🦋 Finding imports 🦋

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

🎀 Interactive mode 🎀

-fbreak-on-error -fno-break-on-error -fbreak-on-exception
-fno-break-on-exception -fghci-hist-size=⟨n⟩ -fghci-leak-check
-fno-ghci-leak-check -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 -interactive-print ⟨name⟩

🌈 Interface files 🌈

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

🌸 Keeping intermediate files 🌸

-keep-hc-file -keep-hc-files -keep-hi-files -no-keep-hi-files
-keep-hscpp-file -keep-hscpp-files -keep-llvm-file
-keep-llvm-files -keep-o-files -no-keep-o-files -keep-s-file
-keep-s-files -keep-tmp-files

👑 Language options 👑

every single -X flag, all of them, main character energy, no cuts:

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

⭐ Linking options ⭐

-c -debug -dylib-install-name ⟨path⟩ -dynamic -dynload -eventlog
-fkeep-cafs -flink-rts -fno-embed-manifest -fno-gen-manifest
-fno-shared-implib -framework ⟨name⟩ -framework-path ⟨dir⟩
-fuse-rpaths -fno-use-rpaths -fwhole-archive-hs-libs -L ⟨dir⟩ -l
⟨lib⟩ -main-is ⟨thing⟩ -no-hs-main -no-rtsopts-suggestions
-package ⟨name⟩ -pie -rdynamic
-rtsopts[=⟨none|some|all|ignore|ignoreAll⟩] -shared
-split-sections -static -staticlib -threaded -with-rtsopts=⟨opts⟩

🧚 Miscellaneous options 🧚

-fexternal-interpreter -fglasgow-exts -fno-glasgow-exts
-fno-safe-haskell -ghcversion-file ⟨path to ghcversion.h⟩ -H
⟨size⟩ -j[⟨n⟩]

🔮 Modes of operation 🔮

--frontend ⟨module⟩ --help -? --info --interactive --make
--mk-dll --numeric-version --print-libdir --show-iface ⟨file⟩
--show-options --supported-extensions --supported-languages
--version -V -e ⟨expr⟩ -M

that's part one bestie, and there's more coming — don't go anywhere 💜

✨ Individual optimizations ✨

okay bestie buckle UP, because this is the long one 😭 these are all the individual optimization toggles, and the original page just... lists them all, one after another, no descriptions, no mercy, no cap. So here they are, every single one, in order, exactly as written. The way this list just keeps going is giving "shopping list written by someone who has never been to a shop" 💅

  • -fasm-shortcutting
  • -fno-asm-shortcutting
  • -fbinary-blob-threshold=⟨n⟩
  • -fblock-layout-cfg
  • -fno-block-layout-cfg
  • -fblock-layout-weightless
  • -fno-block-layout-weightless
  • -fblock-layout-weights
  • -fcall-arity
  • -fno-call-arity
  • -fcase-folding
  • -fno-case-folding
  • -fcase-merge
  • -fno-case-merge
  • -fcmm-elim-common-blocks
  • -fno-cmm-elim-common-blocks
  • -fcmm-sink
  • -fno-cmm-sink
  • -fcmm-static-pred
  • -fno-cmm-static-pred
  • -fcpr-anal
  • -fno-cpr-anal
  • -fcross-module-specialise
  • -fno-cross-module-specialise
  • -fcse
  • -fno-cse
  • -fdicts-cheap
  • -fno-dicts-cheap
  • -fdicts-strict
  • -fno-dicts-strict
  • -fdmd-tx-dict-sel
  • -fno-dmd-tx-dict-sel
  • -fdo-eta-reduction
  • -fno-do-eta-reduction
  • -fdo-lambda-eta-expansion
  • -fno-do-lambda-eta-expansion
  • -feager-blackholing
  • -fenable-rewrite-rules
  • -fno-enable-rewrite-rules
  • -fexcess-precision
  • -fno-excess-precision
  • -fexitification
  • -fno-exitification
  • -fexpose-all-unfoldings
  • -fno-expose-all-unfoldings
  • -ffloat-in
  • -fno-float-in
  • -ffull-laziness
  • -fno-full-laziness
  • -ffun-to-thunk
  • -fno-fun-to-thunk
  • -fignore-asserts
  • -fno-ignore-asserts
  • -fignore-interface-pragmas
  • -fno-ignore-interface-pragmas
  • -flate-dmd-anal
  • -fno-late-dmd-anal
  • -flate-specialise
  • -fno-late-specialise
  • -fliberate-case
  • -fno-liberate-case
  • -fliberate-case-threshold=⟨n⟩
  • -fno-liberate-case-threshold
  • -fllvm-pass-vectors-in-regs
  • -fno-llvm-pass-vectors-in-regs
  • -floopification
  • -fno-loopification
  • -fmax-inline-alloc-size=⟨n⟩
  • -fmax-inline-memcpy-insns=⟨n⟩
  • -fmax-inline-memset-insns=⟨n⟩
  • -fmax-simplifier-iterations=⟨n⟩
  • -fmax-uncovered-patterns=⟨n⟩
  • -fmax-worker-args=⟨n⟩
  • -fno-opt-coercion
  • -fno-pre-inlining
  • -fno-state-hack
  • -fomit-interface-pragmas
  • -fno-omit-interface-pragmas
  • -fomit-yields
  • -fno-omit-yields
  • -foptimal-applicative-do
  • -fno-optimal-applicative-do
  • -fpedantic-bottoms
  • -fno-pedantic-bottoms
  • -fregs-graph
  • -fno-regs-graph
  • -fregs-iterative
  • -fno-regs-iterative
  • -fsimpl-tick-factor=⟨n⟩
  • -fsimplifier-phases=⟨n⟩
  • -fsolve-constant-dicts
  • -fno-solve-constant-dicts
  • -fspec-constr
  • -fno-spec-constr
  • -fspec-constr-count=⟨n⟩
  • -fno-spec-constr-count
  • -fspec-constr-keen
  • -fno-spec-constr-keen
  • -fspec-constr-threshold=⟨n⟩
  • -fno-spec-constr-threshold
  • -fspecialise
  • -fno-specialise
  • -fspecialise-aggressively
  • -fno-specialise-aggressively
  • -fstatic-argument-transformation
  • -fno-static-argument-transformation
  • -fstg-cse
  • -fno-stg-cse
  • -fstg-lift-lams
  • -fno-stg-lift-lams
  • -fstg-lift-lams-known
  • -fno-stg-lift-lams-known
  • -fstg-lift-lams-non-rec-args
  • -fno-stg-lift-lams-non-rec-args-any
  • -fstg-lift-lams-rec-args
  • -fno-stg-lift-lams-rec-args-any
  • -fstrictness
  • -fno-strictness
  • -fstrictness-before=⟨n⟩
  • -funbox-small-strict-fields
  • -fno-unbox-small-strict-fields
  • -funbox-strict-fields
  • -fno-unbox-strict-fields
  • -funfolding-creation-threshold=⟨n⟩
  • -funfolding-dict-discount=⟨n⟩
  • -funfolding-fun-discount=⟨n⟩
  • -funfolding-keeness-factor=⟨n⟩
  • -funfolding-use-threshold=⟨n⟩
  • -fworker-wrapper
bestie note: yes, some of these are only listed in their -fno- form, and some only in their positive form. That's literally what the original says, so I'm not touching it, not "fixing" it, not adding anything. We report, we don't editorialise 🫶

🌈 Optimization levels 🌈

the level squad. presented in exactly the order the page gives them, duplicates and all, because I am NOT the one who gets to tidy this up 💀

  • -O
  • -O1
  • -O0
  • -O0
  • -O2
  • -O0
  • -O⟨n⟩
  • -O0

🎀 Package options 🎀

package wrangling time, bestie. these are the ones that deal with packages and package databases 🍓

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

🦋 Phases of compilation 🦋

the phase crew. short list, big energy ✨

  • -C
  • -c
  • -E
  • -F
  • -S
  • -x ⟨suffix⟩

💅 Overriding external programs 💅

when you want GHC to call a different program than the one it would normally reach for, you come here and hand it a ⟨cmd⟩. every single one, in order:

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

⭐ Phase-specific options ⭐

for when you wanna whisper an ⟨option⟩ directly into one specific phase's ear. also there's -pgmc-supports-no-pie chilling at the end, absolutely unbothered, not taking an argument, just existing. iconic honestly.

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

🌸 Platform-specific options 🌸

three flags, very exclusive, very "you know if you know" 🌈

  • -mbmi2
  • -msse2
  • -msse4.2

🧚 Compiler plugins 🧚

the plugin posse 💜 note that -fplugin-opt=⟨module⟩:⟨args⟩ and -fplugin=⟨module⟩ are written with an = right there in the flag, so keep the = exactly, bestie, no freestyling.

  • -fclear-plugins
  • -fplugin-opt=⟨module⟩:⟨args⟩
  • -fplugin-trustworthy
  • -fplugin=⟨module⟩
  • -hide-all-plugin-packages
  • -plugin-package ⟨pkg⟩
  • -plugin-package-id ⟨pkg-id⟩

🔥 Profiling 🔥

yes the original really does list -fprof-auto and -fno-prof-auto more than once, and yes -fprof-cafs / -fno-prof-cafs show up twice too. I am keeping ALL of it, in order, because that's the assignment. main character energy from a list with duplicates ngl 💀

  • -fno-prof-auto
  • -fprof-auto
  • -fno-prof-cafs
  • -fprof-cafs
  • -fno-prof-count-entries
  • -fprof-count-entries
  • -fprof-auto
  • -fno-prof-auto
  • -fprof-auto-calls
  • -fno-prof-auto-calls
  • -fprof-auto-exported
  • -fno-prof-auto
  • -fprof-auto-top
  • -fno-prof-auto
  • -fprof-cafs
  • -fno-prof-cafs
  • -prof
  • -ticky

🫶 Program coverage 🫶

one flag. one. a whole section for a single icon. we stan efficiency.

  • -fhpc

💖 Recompilation checking 💖

the "did anything actually change or are we redoing this for fun" squad 🙈

  • -fforce-recomp
  • -fno-force-recomp
  • -fignore-hpc-changes
  • -fno-ignore-hpc-changes
  • -fignore-optim-changes
  • -fno-ignore-optim-changes

🎀 Redirecting output 🎀

where all your build artefacts and dep files get told where to live 🍓

  • --exclude-module=⟨file⟩
  • -ddump-mod-cycles
  • -dep-makefile ⟨file⟩
  • -dep-suffix ⟨suffix⟩
  • -dumpdir ⟨dir⟩
  • -hcsuf ⟨suffix⟩
  • -hidir ⟨dir⟩
  • -hiedir ⟨dir⟩
  • -hiesuf ⟨suffix⟩
  • -hisuf ⟨suffix⟩
  • -include-cpp-deps
  • -include-pkg-deps
  • -o ⟨file⟩
  • -odir ⟨dir⟩
  • -ohi ⟨file⟩
  • -osuf ⟨suffix⟩
  • -outputdir ⟨dir⟩
  • -stubdir ⟨dir⟩
heads up bestie: --exclude-module=⟨file⟩ has a double dash, unlike basically everything else around it. that's not a typo on my part, that's what the page says, and I'm not about to gaslight you about a dash 💅

🌈 Temporary files 🌈

one flag, one job, one <dir>:

  • -tmpdir ⟨dir⟩

✨ Verbosity options ✨

final boss of this part, and it's a whole MOOD. all the hole-fit, printing, and diagnostics knobs, plus -v and -v⟨n⟩ and -Rghc-timing at the end. every single one, in order, no cap 🌸

  • -fabstract-refinement-hole-fits
  • -fno-abstract-refinement-hole-fits
  • -fdefer-diagnostics
  • -fdiagnostics-color=⟨always|auto|never⟩
  • -fdiagnostics-show-caret
  • -fno-diagnostics-show-caret
  • -ferror-spans
  • -fhide-source-paths
  • -fkeep-going
  • -fmax-refinement-hole-fits=⟨n⟩
  • -fno-max-refinement-hole-fits
  • -fmax-relevant-binds=⟨n⟩
  • -fno-max-relevant-binds
  • -fmax-valid-hole-fits=⟨n⟩
  • -fno-max-valid-hole-fits
  • -fno-show-valid-hole-fits
  • -fno-sort-valid-hole-fits
  • -fsort-valid-hole-fits
  • -fprint-axiom-incomps
  • -fno-print-axiom-incomps
  • -fprint-equality-relations
  • -fno-print-equality-relations
  • -fprint-expanded-synonyms
  • -fno-print-expanded-synonyms
  • -fprint-explicit-coercions
  • -fno-print-explicit-coercions
  • -fprint-explicit-foralls
  • -fno-print-explicit-foralls
  • -fprint-explicit-kinds
  • -fno-print-explicit-kinds
  • -fprint-explicit-runtime-reps
  • -fno-print-explicit-runtime-reps
  • -fprint-potential-instances
  • -fno-print-potential-instances
  • -fprint-typechecker-elaboration
  • -fno-print-typechecker-elaboration
  • -fprint-unicode-syntax
  • -fno-print-unicode-syntax
  • -frefinement-level-hole-fits=⟨n⟩
  • -fno-refinement-level-hole-fits
  • -freverse-errors
  • -fno-reverse-errors
  • -fshow-docs-of-hole-fits
  • -fno-show-docs-of-hole-fits
  • -fshow-hole-constraints
  • -fshow-hole-matches-of-hole-fits
  • -fno-show-hole-matches-of-hole-fits
  • -fshow-provenance-of-hole-fits
  • -fno-show-provenance-of-hole-fits
  • -fshow-type-app-of-hole-fits
  • -fno-show-type-app-of-hole-fits
  • -fshow-type-app-vars-of-hole-fits
  • -fno-show-type-app-vars-of-hole-fits
  • -fshow-type-of-hole-fits
  • -fno-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⟩
fr fr that's a lot of hole-fit flags. but that's the page, and we love her, and we're not skipping a single one 💜

⚠️ Warnings ⚠️

okay bestie, this next part is literally just the entire warning alphabet. every single flag, no skips, no cap. i'm putting them in a code block so your eyes don't explode. 💅

-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-splices -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
-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-import -Wdodgy-imports
-Wno-dodgy-imports -Wduplicate-constraints
-Wno-duplicate-constraints -Wduplicate-exports
-Wno-duplicate-exports -Wempty-enumerations
-Wno-empty-enumerations -Werror -Wwarn -Weverything
-Whi-shadowing -Wno-hi-shadowing -Widentities -Wno-identities
-Wimplicit-kind-vars -Wno-implicit-kind-vars -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 -Wmissed-extra-shared-lib
-Wno-missed-extra-shared-lib -Wmissed-specialisations
-Wno-missed-specialisations -Wmissing-deriving-strategies
-Wno-missing-deriving-strategies -Wmissing-export-lists
-fnowarn-missing-export-lists -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 -fnowarn-missing-import-lists
-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 -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 -Wredundant-constraints
-Wno-redundant-constraints -Wredundant-record-wildcards
-Wno-redundant-record-wildcards -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 -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

that's the whole list, fr fr. don't ask me to explain each one, the compiler docs do that. but they're all here. ✨


🛠️ Code generation 🛠️

  • -dynamic-too — bestie, this one builds dynamic object files AND static object files during compilation. double the slay, double the files. 💖
  • -fasm — use the native code generator. it's giving assembly realness. ✨
  • -fbyte-code — generate byte-code. lowkey retro. 🎀
  • -fexternal-dynamic-refs — generate code for linking against dynamic libraries. dynamic queen. 💅
  • -fllvm — compile using the LLVM code generator. LLVM stans rise. 🔥
  • -fno-code — omit code generation. not me skipping the whole point lol. 🙈
  • -fobject-code — generate object code. the classic. 👑
  • -fPIC — generate position-independent code (where available). independent icon. 🌈
  • -fPIE — generate code for a position-independent executable (where available). PIE, get it? 🥧
  • -fwrite-interface — always write interface files. no skipping. ⭐

🐛 Debugging the compiler 🐛

  • -dcmm-lint — C-- pass sanity checking. like a vibe check for your C--. 🧚
  • -dcore-lint — turn on internal sanity checking. because even compilers need therapy. 💜
  • -ddump-asm — dump final assembly. raw and unfiltered. 🔥
  • -ddump-asm-expanded — dump the result of the synthetic instruction expansion pass. 💅
  • -ddump-asm-liveness — dump assembly augmented with register liveness. liveness check but make it assembly. ✨
  • -ddump-asm-native — dump initial assembly. the before picture. 🎀
  • -ddump-asm-regalloc — dump the result of register allocation. where do the registers go? here. 👑
  • -ddump-asm-regalloc-stages — dump the build/spill stages of the -fregs-graph register allocator. 🌸
  • -ddump-asm-stats — dump statistics from the register allocator. numbers slay. 📊
  • -ddump-bcos — dump interpreter byte code. bcos = byte code, obviously. 💖
  • -ddump-cfg-weights — dump the assumed weights of the CFG. control flow graph says what? 🦋
  • -ddump-cmm — dump the final C-- output. C-- is not C, bestie. 😭
  • -ddump-cmm-caf — dump the results of the C-- CAF analysis pass. ☕
  • -ddump-cmm-cbe — dump the results of common block elimination. bye bye common blocks. 👋
  • -ddump-cmm-cfg — dump the results of the C-- control flow optimisation pass. 🌈
  • -ddump-cmm-cps — dump the results of the CPS pass. continuation-passing style, iykyk. 💜
  • -ddump-cmm-from-stg — dump STG-to-C-- output. STG to C--, the glow up. ✨
  • -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. C-- to C--, it's giving self-love. 💅
  • -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--. no filter. 🔥
  • -ddump-cmm-sink — dump the results of the C-- sinking pass. sinking, not stinking. 🙈
  • -ddump-cmm-sp — dump the results of the C-- stack layout pass. stack it up. 🥞
  • -ddump-cmm-split — dump the results of the C-- proc-point splitting pass. 💔
  • -ddump-cmm-switch — dump the results of switch lowering passes. switch it up. 🔄
  • -ddump-cmm-verbose — write output from main C-- pipeline passes to files. verbose queen. 👑
  • -ddump-cmm-verbose-by-proc — show output from main C-- pipeline passes (grouped by proc). organized and iconic. 🗂️
  • -ddump-core-stats — print a one-line summary of the size of the Core program at the end of the optimisation pipeline. one line, big facts. 📏
  • -ddump-cpr-signatures — dump CPR signatures. CPR = constructed product result, no cap. 💖
  • -ddump-cpranal — dump CPR analysis output. 📝
  • -ddump-cse — dump CSE output. common subexpression elimination, slay. ✨
  • -ddump-deriv — dump deriving output. derived, not copied. 🎀
  • -ddump-ds — dump desugarer output. sugar? gone. 🍬
  • -ddump-ec-trace — trace exhaustiveness checker. are you exhaustive? prove it. 🕵️
  • -ddump-file-prefix=⟨str⟩ — set the prefix of the filenames used for debugging output. name your dumps. 🏷️
  • -ddump-foreign — dump foreign export stubs. foreign but friendly. 🌍
  • -ddump-hie — dump the hie file syntax tree. HIE = Haskell Interface, iykyk. 🌳
  • -ddump-hpc — an alias for -ddump-ticked. same energy, different name. 💅
  • -ddump-if-trace — trace interface files. interface files, but make it a detective story. 🔎
  • -ddump-inlinings — dump inlinings performed by the simplifier. get inlined. 📥
  • -ddump-json — dump error messages as JSON documents. errors but structured. 🧾
  • -ddump-llvm — dump LLVM intermediate code. LLVM in the house. 🏠
  • -ddump-mod-map — dump the state of the module mapping database. where did my modules go? 🗺️
  • -ddump-occur-anal — dump occurrence analysis output. how many times did it show up? 👀
  • -ddump-opt-cmm — dump the results of C-- to C-- optimising passes. optimise, bestie. ✨
  • -ddump-parsed — dump parse tree. tree time. 🌲
  • -ddump-parsed-ast — dump parser output as a syntax tree. AST = abstract syntax tree, obviously. 🌴
  • -ddump-prep — dump prepared core. prep in progress. 🧼
  • -ddump-rn — dump renamer output. rename everything. 📛
  • -ddump-rn-ast — dump renamer output as a syntax tree. 🌳
  • -ddump-rn-stats — renamer stats. numbers don't lie. 📊
  • -ddump-rn-trace — trace renamer. follow the renames. 🐾
  • -ddump-rtti — trace runtime type inference. runtime type tea. ☕
  • -ddump-rule-firings — dump rule firing info. rules go bang. 💥
  • -ddump-rule-rewrites — dump detailed rule firing info. extra detailed. 🔍
  • -ddump-rules — dump rewrite rules. rewrite the stars. ⭐
  • -ddump-simpl — dump final simplifier output. simple? never. 💅
  • -ddump-simpl-iterations — dump output from each simplifier iteration. every single pass. 🔁
  • -ddump-simpl-stats — dump simplifier stats. stats slay. 📈
  • -ddump-spec — dump specialiser output. you're so special. 💖
  • -ddump-splices — dump TH spliced expressions, and what they evaluate to. template haskell, no cap. 🧬
  • -ddump-stg — show CoreToStg output. STG = spineless tagless G-machine, iykyk. 🌀
  • -ddump-stg-final — show output of last STG pass. the final countdown. 🎶
  • -ddump-stg-unarised — show unarised STG. unarised? iconic. ✨
  • -ddump-str-signatures — dump strictness signatures. strict, not mean. 😤
  • -ddump-stranal — dump strictness analyser output. 📝
  • -ddump-tc — dump typechecker output. typechecker said what? 🗣️
  • -ddump-tc-ast — dump typechecker output as a syntax tree. 🌲
  • -ddump-tc-trace — trace typechecker. follow the types. 🐾
  • -ddump-ticked — dump the code instrumented by HPC (Observing Code Coverage). tick tock, coverage o'clock. ⏰
  • -ddump-timings — dump per-pass timing and allocation statistics. time and space, bestie. ⏳
  • -ddump-to-file — dump to files instead of stdout. save it for later. 💾
  • -ddump-types — dump type signatures. types on types. 🔠
  • -ddump-verbose-inlinings — dump all considered inlinings. every single one. 👀
  • -ddump-worker-wrapper — dump worker-wrapper output. worker and wrapper, a dynamic duo. 🦸
  • -dfaststring-stats — show statistics for fast string usage when finished. fast strings, fast stats. 💨
  • -dhex-word-literals — prints values of type Word# in hexadecimal. hex girlies stay winning 💅
  • -dinitial-unique=⟨s⟩ — starts UniqSupply allocation from ⟨s⟩.
  • -dinline-check=⟨str⟩ — dumps info about inlining decisions, bestie. receipts on every inline.
  • -dlinear-core-lint — turns on internal sanity checking. yes we're checking our own vibes 🔍
  • -dno-debug-output — suppresses unsolicited debugging output. not me, not today 🙈
  • -dno-typeable-binds — doesn't generate bindings for Typeable methods.
  • -dppr-case-as-let — prints single alternative case expressions as strict lets. lowkey a glow-up for your dump.
  • -dppr-cols=⟨n⟩ — sets the width of debugging output. like for example -dppr-cols200. know your column budget fr fr 📏
  • -dppr-debug — turns on debug printing (more verbose). more words, more chaos, more fun.
  • -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. a little parade of passes, iconic 🎀
  • -dstg-lint — STG pass sanity checking.
  • -dsuppress-all — in dumps, suppresses everything (except for uniques) that is suppressible. minimalism era ✨
  • -dsuppress-coercions — suppresses the printing of coercions in Core dumps to make them shorter.
  • -dsuppress-idinfo — suppresses extended information about identifiers where they are bound.
  • -dsuppress-module-prefixes — suppresses the printing of module qualification prefixes.
  • -dsuppress-stg-free-vars — suppresses the printing of closure free variable lists in STG output.
  • -dsuppress-ticks — suppresses "ticks" in the pretty-printer output.
  • -dsuppress-timestamps — suppresses timestamps in dumps. no clock, just vibes ⏰🚫
  • -dsuppress-type-applications — suppresses type applications.
  • -dsuppress-type-signatures — suppresses type signatures.
  • -dsuppress-unfoldings — suppresses the printing of the stable unfolding of a variable at its binding site.
  • -dsuppress-uniques — suppresses the printing of uniques in debug output (easier to use diff). diff girlies this one's for you 🫶
  • -dsuppress-var-kinds — suppresses the printing of variable kinds.
  • -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-bottoms — adds a default error alternative to case expressions without a default alternative. catching bottoms so you don't have to 😭
  • -fllvm-fill-undef-with-garbage — instructs LLVM to fill dead STG registers with garbage. (yes the typo'd "Intruct" energy, but the flag itself is real) 🗑️
  • -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. debug lore, choose your level 🔥

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. poof, gone ✨
  • -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.
  • -flocal-ghci-history — uses the 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. declutter queen 💅

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

okay bestie this is the big one, the main character section 👑 every -X flag is a little switch that flips a language extension on. here we go, no skips, all of them:

  • -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.
  • -XDefaultSignatures — enables default signatures.
  • -XDeriveAnyClass — enables deriving for any class.
  • -XDeriveDataTypeable — enables deriving for the Data class. Implied by (deprecated) AutoDeriveTypeable.
  • -XDeriveFoldable — enables deriving for the Foldable class. Implied by DeriveTraversable.
  • -XDeriveFunctor — enables deriving for the Functor class. Implied by DeriveTraversable.
  • -XDeriveGeneric — enables deriving for the Generic class.
  • -XDeriveLift — enables deriving for the Lift class.
  • -XDeriveTraversable — enables deriving for the Traversable class. Implies DeriveFunctor and DeriveFoldable.
  • -XDerivingStrategies — enables deriving strategies.
  • -XDerivingVia — enables deriving instances via types of the same runtime representation. Implies DerivingStrategies.
  • -XDisambiguateRecordFields — enables record field disambiguation. Implied by RecordWildCards.
  • -XDuplicateRecordFields — allows definition of record types with identically-named fields. same name? slay, no conflict 🎀
  • -XEmptyCase — allows empty case alternatives.
  • -XEmptyDataDecls — allows definition of empty data types.
  • -XEmptyDataDeriving — allows deriving instances of standard type classes for empty data types.
  • -XExistentialQuantification — enables liberalised type synonyms.
  • -XExplicitForAll — enables explicit universal quantification. Implied by ScopedTypeVariables, LiberalTypeSynonyms, RankNTypes and ExistentialQuantification.
  • -XExplicitNamespaces — enables using the keyword type to specify the namespace of entries in imports and exports (Explicit namespaces in import/export). Implied by TypeOperators and TypeFamilies.
  • -XExtendedDefaultRules — uses GHCi's extended default rules in a normal module.
  • -XFlexibleContexts — enables flexible contexts.
  • -XFlexibleInstances — enables flexible instances. Implies TypeSynonymInstances.
  • -XForeignFunctionInterface — enables foreign function interface.
  • -XFunctionalDependencies — enables functional dependencies. Implies MultiParamTypeClasses.
  • -XGADTs — enables generalised algebraic data types. Implies GADTSyntax and MonoLocalBinds.
  • -XGADTSyntax — enables generalised algebraic data type syntax.
  • -XGeneralisedNewtypeDeriving — enables newtype deriving.
  • -XGeneralizedNewtypeDeriving — enables newtype deriving. (same energy, different spelling, both iconic ✨)
  • -XGHCForeignImportPrim — enables prim calling convention. Intended for internal use only.
  • -XHaskell2010 — uses the Haskell 2010 language variant.
  • -XHaskell98 — uses the Haskell 98 language variant.
  • -XHexFloatLiterals — enables support for hexadecimal floating point literals.
  • -XImplicitParams — enables Implicit Parameters.
  • -XImportQualifiedPost — ImportQualifiedPost allows the syntax import M qualified.
  • -XImpredicativeTypes — enables impredicative types. Implies RankNTypes.
  • -XIncoherentInstances — enables incoherent instances. Implies OverlappingInstances.
  • -XInstanceSigs — enables instance signatures.
  • -XInterruptibleFFI — enables interruptible FFI.
  • -XKindSignatures — enables kind signatures. Implied by TypeFamilies and PolyKinds.
  • -XLambdaCase — enables lambda-case expressions.
  • -XLexicalNegation — uses whitespace to determine whether the minus sign stands for negation or subtraction.
  • -XLiberalTypeSynonyms — enables liberalised type synonyms.
  • -XLinearTypes — enables linear types.
  • -XMagicHash — allows # as a postfix modifier on identifiers. ✨magic✨ hash, literally in the name.
  • -XMonadComprehensions — enables monad comprehensions.
  • -XMonadFailDesugaring — enables monadfail desugaring.
  • -XMonoLocalBinds — enables "do not generalise local bindings". Implied by TypeFamilies and GADTs.
  • -XMultiParamTypeClasses — enables multi parameter type classes. Implied by FunctionalDependencies.
  • -XMultiWayIf — enables multi-way if-expressions.
  • -XNamedFieldPuns — enables record puns.
  • -XNamedWildCards — enables named wildcards.
  • -XNegativeLiterals — enables support for negative literals.
  • -XNoImplicitPrelude — doesn't implicitly import Prelude. Implied by RebindableSyntax.

bestie we're only partway through the language options, there's a whole other pile of -X flags coming, don't go anywhere 💖
  • -XNoMonomorphismRestriction — turns the monomorphism restriction off. yeah. it's gone. bye 💅
  • -XNondecreasingIndentation — lets nested contexts sit at the same indentation level as the context wrapping them, no extra indent required 🫶
  • -XNoPatternGuards — turns pattern guards off. psst, Haskell98 implies this one, so if you're in Haskell98 mode it's already handled ✨
  • -XNoTraditionalRecordSyntax — turns off support for the classic record syntax (the kind Haskell 98 supports), i.e. C {f = x} 🎀
  • -XNPlusKPatterns — enables support for n+k patterns. also implied by Haskell98, iconic behaviour honestly 💖
  • -XNullaryTypeClasses — deprecated, does literally nothing 😭 nullary (no parameter) type classes are enabled via MultiParamTypeClasses now, so go use that instead, bestie
  • -XNumDecimals — enables support for 'fractional' integer literals 🔥
  • -XNumericUnderscores — enables support for numeric underscores 🍓
  • -XOverlappingInstances — enables overlapping instances 👑
  • -XOverloadedLabels — enables overloaded labels ✨
  • -XOverloadedLists — enables overloaded lists 🌸
  • -XOverloadedStrings — enables overloaded string literals 💜
  • -XPackageImports — enables package-qualified imports 📦
  • -XParallelListComp — enables parallel list comprehensions 🌈
  • -XPartialTypeSignatures — enables partial type signatures 🎀
  • -XPatternSynonyms — enables pattern synonyms 🦋
  • -XPolyKinds — enables kind polymorphism. it implies KindSignatures ✨
  • -XPostfixOperators — enables postfix operators 💅
  • -XQualifiedDo — enables qualified do-notation desugaring 🫶
  • -XQuantifiedConstraints — allows forall quantifiers in constraints 🔥
  • -XQuasiQuotes — enables quasiquotation ✨
  • -XRank2Types — enables rank-2 types. it's a straight-up synonym for RankNTypes, same energy 👑
  • -XRankNTypes — enables rank-N types. implied by ImpredicativeTypes 🌟
  • -XRebindableSyntax — employs rebindable syntax. implies NoImplicitPrelude 💜
  • -XRecordWildCards — enables record wildcards. implies DisambiguateRecordFields 🎀
  • -XRecursiveDo — enables recursive do (mdo) notation 🌸
  • -XRoleAnnotations — enables role annotations 👑
  • -XSafe — enables the Safe Haskell Safe mode 🛡️
  • -XScopedTypeVariables — enables lexically-scoped type variables ✨
  • -XStandaloneDeriving — enables standalone deriving 💖
  • -XStandaloneKindSignatures — allows the use of standalone kind signatures 🦋
  • -XStarIsType — treats * as Data.Kind.Type ⭐
  • -XStaticPointers — enables static pointers 📌
  • -XStrict — makes bindings in the current module strict by default. bold. decisive. main character energy 👑
  • -XStrictData — enables default strict datatype fields 🔥
  • -XTemplateHaskell — enables Template Haskell 🪄
  • -XTemplateHaskellQuotes — enables the quotation subset of Template Haskell ✨
  • -XTransformListComp — enables generalised list comprehensions 🌈
  • -XTrustworthy — enables the Safe Haskell Trustworthy mode 🫶
  • -XTupleSections — enables tuple sections 🎀
  • -XTypeApplications — enables type application syntax in terms and types 💅
  • -XTypeFamilies — enables type families. implies ExplicitNamespaces, KindSignatures, and MonoLocalBinds 👑
  • -XTypeFamilyDependencies — enables injective type families. implies TypeFamilies 🔥
  • -XTypeInType — deprecated. enables kind polymorphism and datatype promotion 😭
  • -XTypeOperators — enables type operators. implies ExplicitNamespaces ⚡
  • -XTypeSynonymInstances — enables type synonyms in instance heads. implied by FlexibleInstances 💜
  • -XUnboxedSums — enables unboxed sums 📦
  • -XUnboxedTuples — enables the use of unboxed tuple syntax 📦
  • -XUndecidableInstances — enables undecidable instances 🌀
  • -XUndecidableSuperClasses — allows all superclass constraints, including the ones that might make the typechecker never terminate 😳 yeah, that's the trade, bestie
  • -XUnicodeSyntax — enables unicode syntax 🌸
  • -XUnliftedFFITypes — enables unlifted FFI types 🫶
  • -XUnliftedNewtypes — enables unlifted newtypes ✨
  • -XUnsafe — enables Safe Haskell Unsafe mode 💀
  • -XViewPatterns — enables view patterns 🦋

🔗 Linking options 🔗

  • -c — stop after generating the object (.o) file 🛑
  • -debug — use the debugging runtime 🐛
  • -dylib-install-name ⟨path⟩ — sets the install name (via -install_name, passed through to Apple's linker), specifying the full install path of the library file. any libraries or executables that link with it later will pick that path up 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 📊
  • -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 🍎
  • -fuse-rpaths — set the rpath based on -L flags 🛤️
  • -fwhole-archive-hs-libs — when linking a binary executable, this inserts the flag -Wl,--whole-archive before any -l flags for Haskell libraries, and -Wl,--no-whole-archive afterwards 📦
  • -L ⟨dir⟩ — add ⟨dir⟩ to the list of directories searched for libraries 🔍
  • -l ⟨lib⟩ — link in library ⟨lib⟩ 🔗
  • -main-is ⟨thing⟩ — set main module and function 👑
  • -no-hs-main — don't assume this program contains main 🙈
  • -no-rtsopts-suggestions — don't print RTS suggestions about linking with -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩] 🤫
  • -package ⟨name⟩ — expose package ⟨pkg⟩ 📦
  • -pie — instruct the linker to produce a position-independent executable 🎯
  • -rdynamic — instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. currently Linux and Windows/MinGW32 only. this is equivalent to using -optl -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 whole menu, no skips:
    • none — no RTS flags can be given 🚫
    • some — only a minimum of safe options can be given (this is the default) 🫶
    • all (or no argument at all) — all RTS flags are permitted 🔥
    • ignore — RTS flags can be given, but they're treated as regular arguments and passed to the Haskell program as arguments 🙈
    • ignoreAll — same as ignore, but GHCRTS is also ignored 💀
    • and btw: -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) 📚
  • -split-sections — split sections for link-time dead-code stripping ✂️
  • -static — use static Haskell libraries 🗿
  • -staticlib — generate a standalone static library (as opposed to an executable). this is useful when cross compiling. the library, together with all its dependencies, ends up in a single static library that can be linked against 📦
  • -threaded — use the threaded runtime 🧵
  • -with-rtsopts=⟨opts⟩ — set the default RTS options to ⟨opts⟩ ⚙️

🎀 Miscellaneous options 🎀

  • -fexternal-interpreter — run interpreted code in a separate process 🌀
  • -fglasgow-exts — deprecated. enables most language extensions; see Controlling extensions for exactly which ones 😭
  • -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⟩ 🧠
  • -j[⟨n⟩] — when compiling with --make, compile ⟨n⟩ modules in parallel ⚡

🚀 Modes of operation 🚀

  • --frontend ⟨module⟩ — run GHC with the given frontend plugin; see Frontend plugins for details 🔌
  • --help — display help 🆘
  • --info — display information about the compiler ℹ️
  • --interactive — interactive mode — normally used by just 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 🏗️
  • --mk-dll — DLL-creation mode (Windows only) 🪟
  • --numeric-version — display GHC version (numeric only) 🔢
  • --print-libdir — display GHC library directory 📁
  • --show-iface ⟨file⟩ — display the contents of an interface file 👀
  • --show-options — display the supported command line options 📋
  • --supported-extensions — display the supported language extensions ✨
  • --version — display GHC version 🏷️
  • -e ⟨expr⟩ — evaluate expr; see Expression evaluation mode for details 🧮
  • -M — generate dependency information suitable for use in a Makefile; see Dependency generation for details 📝

⚡ Individual optimizations ⚡

  • -fasm-shortcutting — enable shortcutting on assembly. implied by -O2 🔥
  • -fbinary-blob-threshold=⟨n⟩ — default: 500K. tweak assembly generator for binary blobs 📦
  • -fblock-layout-cfg — use the new cfg based block layout algorithm 🧩
  • -fblock-layout-weightless — ignore cfg weights for code layout ⚖️
  • -fblock-layout-weights — sets edge weights used by the new code layout algorithm 🎛️
  • -fcall-arity — enable call-arity optimisation. implied by -O 📞
  • -fcase-folding — enable constant folding in case expressions. implied by -O 🎁
  • -fcase-merge — enable case-merging. implied by -O 🧬
  • -fcmm-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 🔮
  • -fcpr-anal — turns on CPR analysis inside the demand analyser 💅 implied by -O.
  • -fcross-module-specialise — turns on specialisation of overloaded functions that got imported from other modules 🦋.
  • -fcse — enables common sub-expression elimination ✨ implied by -O.
  • -fdicts-cheap — makes dictionary-valued expressions seem cheap to the optimiser 👑
  • -fdicts-strict — makes dictionaries strict, periodt.
  • -fdmd-tx-dict-sel — uses a special demand transformer for dictionary selectors 💖 always enabled by default.
  • -fdo-eta-reduction — enables eta-reduction 🌸 implied by -O.
  • -fdo-lambda-eta-expansion — enables lambda eta-expansion ✨ always enabled by default.
  • -feager-blackholing — turns on eager blackholing 🫶
  • -fenable-rewrite-rules — switches on all the rewrite rules, including the ones generated by automatic specialisation of overloaded functions 💅 implied by -O.
  • -fexcess-precision — enables excess intermediate precision 🔥
  • -fexitification — enables the exitification optimisation 🦋 implied by -O.
  • -fexpose-all-unfoldings — exposes all the unfoldings, even for the very large or recursive functions 🙈.
  • -ffloat-in — turns on the float-in transformation ✨ implied by -O.
  • -ffull-laziness — turns on full laziness, aka floating bindings outwards 🌈 implied by -O.
  • -ffun-to-thunk — lets worker-wrapper convert a function closure into a thunk when the function doesn't use any of its arguments 💀 off by default.
  • -fignore-asserts — ignores assertions in the source 🙈 implied by -O.
  • -fignore-interface-pragmas — ignores pragmas in interface files 👀 implied by -O0 only.
  • -flate-dmd-anal — runs demand analysis again, at the end of the simplification pipeline 🔁
  • -flate-specialise — runs a late specialisation pass 🕐
  • -fliberate-case — turns on the liberate-case transformation 💖 implied by -O2.
  • -fliberate-case-threshold=⟨n⟩ — default: 2000. sets the size threshold for the liberate-case transformation to ⟨n⟩ 🎀
  • -fllvm-pass-vectors-in-regs — passes vector values in vector registers for function calls 🌈
  • -floopification — turns saturated self-recursive tail-calls into local jumps in the generated assembly 🔥 implied by -O.
  • -fmax-inline-alloc-size=⟨n⟩ — default: 128. sets the maximum size of inline array allocations to ⟨n⟩ bytes (default: 128) 💅
  • -fmax-inline-memcpy-insns=⟨n⟩ — default: 32. inlines memcpy calls if they'd generate no more than ⟨n⟩ pseudo instructions ✨
  • -fmax-inline-memset-insns=⟨n⟩ — default: 32. inlines memset calls if they'd generate no more than ⟨n⟩ pseudo instructions 🦋
  • -fmax-simplifier-iterations=⟨n⟩ — default: 4. sets the max iterations for the simplifier 🔁
  • -fmax-uncovered-patterns=⟨n⟩ — default: 4. sets the maximum number of patterns to display in warnings about non-exhaustive ones 👀
  • -fmax-worker-args=⟨n⟩ — default: 10. maximum number of value arguments for a worker 👑
  • -fno-opt-coercion — turns off the coercion optimiser 🚫
  • -fno-pre-inlining — turns off pre-inlining 🚫
  • -fno-state-hack — turns off the state hack, where any lambda with a real-world state token as argument is considered to be single-entry, and hence it's OK to inline things inside it 💀
  • -fomit-interface-pragmas — don't generate interface pragmas 🙈 implied by -O0 only.
  • -fomit-yields — omits heap checks when no allocation is being performed ✨
  • -foptimal-applicative-do — uses a slower but better algorithm for ApplicativeDo 💅 bestie it's worth it
  • -fpedantic-bottoms — makes GHC way more precise about how it treats bottom 🕳️ (but see also -fno-state-hack). in particular, GHC will not eta-expand through a case expression.
  • -fregs-graph — uses the graph colouring register allocator for register allocation in the native code generator 🎨 implied by -O2.
  • -fregs-iterative — uses the iterative coalescing graph colouring register allocator in the native code generator 🔁
  • -fsimpl-tick-factor=⟨n⟩ — default: 100. sets the percentage factor for simplifier ticks ⏱️
  • -fsimplifier-phases=⟨n⟩ — default: 2. sets the number of phases for the simplifier 🌙 ignored with -O0.
  • -fsolve-constant-dicts — when solving constraints, tries to eagerly solve super classes using available dictionaries 📚
  • -fspec-constr — turns on the SpecConstr transformation 🔥 implied by -O2.
  • -fspec-constr-count=⟨n⟩ — default: 3.*. sets to ⟨n⟩ the maximum number of specialisations that will be created for any one function by the SpecConstr transformation ✨
  • -fspec-constr-keen — specialises a call with an explicit constructor argument, even if the argument isn't scrutinised in the body of the function 👀
  • -fspec-constr-threshold=⟨n⟩ — default: 2000. sets the size threshold for the SpecConstr transformation to ⟨n⟩ 🎀
  • -fspecialise — turns on specialisation of overloaded functions 💖 implied by -O.
  • -fspecialise-aggressively — turns on specialisation of overloaded functions regardless of size, if an unfolding is available 🔥 no size gate, no chill
  • -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 into unknown calls while performing late lambda lifting 👀
  • -fstg-lift-lams-non-rec-args — creates top-level non-recursive functions with at most <n> parameters while performing late lambda lifting 🎀
  • -fstg-lift-lams-rec-args — creates top-level recursive functions with at most <n> parameters while performing late lambda lifting 🔁
  • -fstrictness — turns on strictness analysis 💪 implied by -O. implies -fworker-wrapper.
  • -fstrictness-before=⟨n⟩ — runs an additional strictness analysis before simplifier phase ⟨n⟩ ⏱️
  • -funbox-small-strict-fields — flattens strict constructor fields with a pointer-sized representation 📦 implied by -O.
  • -funbox-strict-fields — flattens strict constructor fields 📦
  • -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 💀 (yes, that spelling is exactly how it's written, don't come for me)
  • -funfolding-use-threshold=⟨n⟩ — default: 80. tweaks unfolding settings 🔧
  • -fworker-wrapper — enables the worker-wrapper transformation 👑

✨ Optimization levels ✨

  • -O — enables level 1 optimisations 🔥
  • -O0 — disables optimisations (this is the default) 🌙
  • -O2 — enables level 2 optimisations 💅
  • -O⟨n⟩ — any -On where n > 2 is the same as -O2 🤷♀️

🎀 Package options 🎀

  • -clear-package-db — clears the package db stack 🧹
  • -distrust ⟨pkg⟩ — exposes package ⟨pkg⟩ and sets it to be distrusted 😤 see Safe Haskell.
  • -distrust-all-packages — distrusts all packages by default 😤 see Safe Haskell.
  • -fpackage-trust — enables the Safe Haskell trusted package requirement for trustworthy modules 🛡️
  • -global-package-db — adds the global package db to the stack 🌍
  • -hide-all-packages — hides all packages by default 🙈
  • -hide-package ⟨pkg⟩ — hides package ⟨pkg⟩ 🙈
  • -ignore-package ⟨pkg⟩ — ignores package ⟨pkg⟩ 💀
  • -no-auto-link-packages — 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⟩ — compiles to be part of unit (i.e. package) ⟨unit-id⟩ 🫶
  • -trust ⟨pkg⟩ — exposes package ⟨pkg⟩ and sets it to be trusted 💖 see Safe Haskell.
  • -user-package-db — adds the user's package db to the stack 🏠

🦋 Phases of compilation 🦋

  • -C — stop after generating the C file (.hc file) 🛑
  • -c — stop after generating the object file (.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 the default behaviour for source files 🙃

💅 Overriding external programs 💅

  • -pgma ⟨cmd⟩ — use ⟨cmd⟩ as the assembler 🔧
  • -pgmc ⟨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 🔧
  • -pgmlibtool ⟨cmd⟩ — use ⟨cmd⟩ as the command for libtool (with -staticlib only) 🔧
  • -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⟩ — yeets ⟨option⟩ straight at the interpreter sub-process 💅
  • -optL ⟨option⟩ — passes ⟨option⟩ to the literate pre-processor ✨
  • -optl ⟨option⟩ — passes ⟨option⟩ to the linker 🎀
  • -optlc ⟨option⟩ — passes ⟨option⟩ to the LLVM compiler 🦋
  • -optlm ⟨option⟩ — passes ⟨option⟩ to the linker when merging object files 🌸
  • -optlo ⟨option⟩ — passes ⟨option⟩ to the LLVM optimiser 🔥
  • -optP ⟨option⟩ — passes ⟨option⟩ to cpp (only when you've got -cpp on, bestie) 💖
  • -optwindres ⟨option⟩ — passes ⟨option⟩ to windres 🌈
  • -pgmc-supports-no-pie — declares that your C compiler supports -no-pie ⭐

🖥️ Platform-specific options 🖥️

  • -mbmi2 — (x86 only) use BMI2 for bit manipulation operations 👑
  • -msse2 — (x86 only) use SSE2 for floating-point operations ✨
  • -msse4.2 — (x86 only) use SSE4.2 for floating-point operations 🔥

🧩 Compiler plugins 🧩

  • -fclear-plugins — wipes the list of active plugins clean, no cap 💅
  • *-fplugin-opt=⟨module⟩*:⟨args⟩ — gives arguments to a plugin module; the module has to be specified with -fplugin=⟨module⟩ 🫶
  • -fplugin-trustworthy — trusts the plugins you're using, so GHC stops marking the compiled module as unsafe 🙈
  • *-fplugin=⟨module⟩* — loads a plugin exported by a given module 🎀
  • -hide-all-plugin-packages — hides every package for plugins by default 🦋
  • -plugin-package ⟨pkg⟩ — exposes ⟨pkg⟩ for plugins 💖
  • -plugin-package-id ⟨pkg-id⟩ — exposes ⟨pkg-id⟩ for plugins 🌸

📊 Profiling 📊

  • -fno-prof-auto — disables any previous -fprof-auto, -fprof-auto-top, or -fprof-auto-exported options 😭
  • -fno-prof-cafs — disables any previous -fprof-cafs option 💀
  • -fno-prof-count-entries — do not collect entry counts 🚫
  • -fprof-auto — auto-adds SCC\ s to all bindings not marked INLINE ✨
  • -fprof-auto-calls — auto-adds SCC\ s to all call sites 📞
  • -fprof-auto-exported — auto-adds SCC\ s to all exported bindings not marked INLINE 👑
  • -fprof-auto-top — auto-adds SCC\ s to all top-level bindings not marked INLINE 🌟
  • -fprof-cafs — auto-adds SCC\ s to all CAFs ☕
  • -prof — turn on profiling, periodt 📈
  • -ticky — turn on ticky-ticky profiling 🎯

🎯 Program coverage 🎯

  • -fhpc — turn on Haskell program coverage instrumentation 🔍

🔁 Recompilation checking 🔁

  • -fforce-recomp — turns off recompilation checking. This is implied by any -ddump-X option when compiling a single file (like, when you're using -c) 💅
  • -fignore-hpc-changes — don't recompile modules just to match changes to HPC flags. This is especially useful for dodging recompilation when using GHCi, and it's enabled by default for GHCi 🫶
  • -fignore-optim-changes — don't recompile modules just to match changes to optimisation flags. Super useful for avoiding recompilation in GHCi, and it's on by default for GHCi ✨

📤 Redirecting output 📤

  • *--exclude-module=⟨file⟩* — treats ⟨file⟩ as "stable"; i.e. excludes it from having dependencies on it 🧘
  • -ddump-mod-cycles — dumps module cycles 🔄
  • -dep-makefile ⟨file⟩ — uses ⟨file⟩ as the makefile 📝
  • -dep-suffix ⟨suffix⟩ — makes dependencies that declare that files with suffix .<suf><osuf> depend on interface files with suffix .<suf>hi 🔗
  • -dumpdir ⟨dir⟩ — redirects dump files 📁
  • -hcsuf ⟨suffix⟩ — sets the suffix to use for intermediate C files 🅲
  • -hidir ⟨dir⟩ — sets the directory for interface files 📂
  • -hiedir ⟨dir⟩ — sets the directory for extended interface files 📂
  • -hiesuf ⟨suffix⟩ — sets the suffix to use for extended interface files 🏷️
  • -hisuf ⟨suffix⟩ — sets the suffix to use for interface files 🏷️
  • -include-cpp-deps — includes preprocessor dependencies 🧵
  • -include-pkg-deps — regards modules imported from packages as unstable 🎢
  • -o ⟨file⟩ — sets the output filename 📛
  • -odir ⟨dir⟩ — sets the directory for object files 📦
  • -ohi ⟨file⟩ — sets the filename in which to put the interface 📄
  • -osuf ⟨suffix⟩ — sets the output file suffix 🔖
  • -outputdir ⟨dir⟩ — sets the output directory 🗂️
  • -stubdir ⟨dir⟩ — redirects FFI stub files 🌉

🗑️ Temporary files 🗑️

  • -tmpdir ⟨dir⟩ — sets the directory for temporary files ⏳

🗣️ Verbosity options 🗣️

  • -fabstract-refinement-hole-fits — default: off. Toggles whether refinements where one or more of the holes are abstract get reported 🕳️
  • -fdefer-diagnostics — defers and groups diagnostic messages by severity 📬
  • *-fdiagnostics-color=⟨always|auto|never⟩* — uses colors in error messages 🌈
  • -fdiagnostics-show-caret — whether to show snippets of the original source code 🔍
  • -ferror-spans — outputs the full span in error messages 📏
  • -fhide-source-paths — hides module source and object paths 🙈
  • -fkeep-going — keeps compiling as far as possible even when errors show up 💪
  • *-fmax-refinement-hole-fits=⟨n⟩* — default: 6. Sets the maximum number of refinement hole fits for typed holes to display in type error messages 🔢
  • *-fmax-relevant-binds=⟨n⟩* — default: 6. Sets the maximum number of bindings to display in type error messages 🔢
  • *-fmax-valid-hole-fits=⟨n⟩* — default: 6. Sets the maximum number of valid hole fits for typed holes to display in type error messages 🔢
  • -fno-show-valid-hole-fits — disables showing a list of valid hole fits for typed holes in type error messages 🚫
  • -fno-sort-valid-hole-fits — disables the sorting of the list of valid hole fits for typed holes in type error messages 🚫
  • -fprint-axiom-incomps — displays equation incompatibilities in closed type families 📜
  • -fprint-equality-relations — distinguishes between equality relations when printing 🟰
  • -fprint-expanded-synonyms — in type errors, also prints type-synonym-expanded types 🪄
  • -fprint-explicit-coercions — prints coercions in types 🔗
  • -fprint-explicit-foralls — prints explicit forall quantification in types. See also ExplicitForAll 👀
  • -fprint-explicit-kinds — prints explicit kind foralls and kind arguments in types. See also KindSignatures 👀
  • -fprint-explicit-runtime-reps — prints RuntimeRep variables in types which are runtime-representation polymorphic 🧬
  • -fprint-potential-instances — displays all available instances in type error messages 📋
  • -fprint-typechecker-elaboration — prints extra information from the typechecker 🔬
  • -fprint-unicode-syntax — uses unicode syntax when printing expressions, types and kinds. See 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 — outputs errors in reverse order 🔃
  • -fshow-docs-of-hole-fits — toggles whether to show the documentation of the valid hole fits in the output 📚
  • -fshow-hole-constraints — shows constraints when reporting typed holes ⛓️
  • -fshow-hole-matches-of-hole-fits — toggles whether to show the type of the additional holes in refinement hole fits 🕳️
  • -fshow-provenance-of-hole-fits — toggles whether to show the provenance of the valid hole fits in the output 🧾
  • -fshow-type-app-of-hole-fits — toggles whether to show the type application of the valid hole fits in the output 🧩
  • -fshow-type-app-vars-of-hole-fits — toggles whether to show what type each quantified variable takes in a valid hole fit 🔤
  • -fshow-type-of-hole-fits — toggles whether to show the type of the valid hole fits in the output 🏷️
  • -fsort-by-size-hole-fits — sorts valid hole fits by size 📐
  • -fsort-by-subsumption-hole-fits — sorts valid hole fits by subsumption 🧠
  • -funclutter-valid-hole-fits — unclutters the list of valid hole fits by not showing provenance nor type applications of suggestions 🧹
  • -Rghc-timing — summarises timing stats for GHC (same as +RTS -tstderr) ⏱️
  • -v — verbose mode (equivalent to -v3) 🗣️
  • -v ⟨n⟩ — sets verbosity level 🎚️

⚠️ Warnings ⚠️

  • -fdefer-out-of-scope-variables — converts variable out of scope variables errors into warnings. Implied by -fdefer-type-errors. See also -Wdeferred-out-of-scope-variables 🫣
  • -fdefer-type-errors — turns type errors into warnings, deferring the error until runtime. Implies -fdefer-typed-holes and -fdefer-out-of-scope-variables. See also -Wdeferred-type-errors 😴
  • -fdefer-typed-holes — converts typed hole errors into warnings, deferring the error until runtime. Implied by -fdefer-type-errors. See also -Wtyped-holes 🕳️
  • -fenable-th-splice-warnings — generates warnings for Template Haskell splices 🧙
  • -fhelpful-errors — makes suggestions for mis-spelled names 🫶
  • *-fmax-pmcheck-models=⟨n⟩* — soft limit on the number of parallel models the pattern match checker should check a pattern match clause against 🧮
  • -fshow-warning-groups — shows which group an emitted warning belongs to 🏷️
  • -fvia-C — 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 — warns when specialisation of any overloaded function fails 😿
  • -Wauto-orphans — (deprecated) does nothing 🫥
  • -Wcompat — enables future compatibility warnings (details in Warnings and sanity-checking) 🔮
  • -Wcompat-unqualified-imports — reports unqualified imports of core libraries which are expected to cause compatibility problems in future releases 📆
  • -Wcpp-undef — warns on uses of the #if directive on undefined identifiers ❓
  • -Wdefault — enables default flags ✅
  • -Wdeferred-out-of-scope-variables — reports warnings when variable out-of-scope errors are deferred until runtime. See -fdefer-out-of-scope-variables 📢
  • -Wdeferred-type-errors — reports warnings when deferred type errors are enabled. This option is enabled by default. See -fdefer-type-errors 📢
  • -Wdeprecated-flags — warns about uses of commandline flags that are deprecated 🪦
  • -Wdeprecations — warns about uses of functions & types that have warnings or deprecated pragmas. Alias for -Wwarnings-deprecations 🪦
  • -Wderiving-defaults — okay so this one warns about default deriving when you're using both DeriveAnyClass and GeneralizedNewtypeDeriving. Both at once? It's giving "pick a lane" energy. 💅
  • -Wderiving-typeable — warns when Typeable is derived. That's it, bestie. ✨
  • -Wdodgy-exports — warns about dodgy exports. We don't make the rules, we just report them. 👑
  • -Wdodgy-foreign-imports — warns about dodgy foreign imports. 🛂
  • -Wdodgy-imports — warns about dodgy imports. The import police are here. 🚨
  • -Wduplicate-constraints — warns when a constraint appears duplicated in a type signature. Not me seeing the same constraint twice. 😭
  • -Wduplicate-exports — warns when an entity is exported multiple times. We get it, you're popular. 💖
  • -Wempty-enumerations — warns about enumerations that are empty. Empty. Void. Nothing. 💀
  • -Werror — makes warnings fatal. Bestie, do not ignore this one. It's the final boss. 🔥
  • -Weverything — enables all warnings supported by GHC. Yes, all of them. Main character warning energy. 👑
  • -Whi-shadowing — (deprecated) warns when a .hi file in the current directory shadows a library. Deprecated, so it's giving legacy drama. 🙈
  • -Widentities — warns about uses of Prelude numeric conversions that are probably the identity (and hence could be omitted). Like, why are you doing all that? 😭
  • -Wimplicit-kind-vars — warns when kind variables are implicitly quantified over. No cap. 🎀
  • -Wimplicit-prelude — warns when the Prelude is implicitly imported. The Prelude just showed up uninvited. 🎀
  • -Winaccessible-code — warns about inaccessible code. It's behind the velvet rope. 🚫
  • -Wincomplete-patterns — warns when a pattern match could fail. Pattern match said "what if I just don't?" 💀
  • -Wincomplete-record-updates — warns when a record update could fail. Record update said "trust me bestie". 🫶
  • -Wincomplete-uni-patterns — warns when a pattern match in a lambda expression or pattern binding could fail. Lambda said "I'm built different". ✨
  • -Winferred-safe-imports — warns when an explicitly Safe Haskell module imports a Safe-Inferred one. Safe Haskell said "we need to talk". 💅
  • -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 rule was ready but the inline said "not today". 😭
  • -Winvalid-haddock — warns when a Haddock comment occurs in an invalid position. Haddock comment, read the room. 🙈
  • -Wmissed-extra-shared-lib — Warns when GHCi can't load a shared lib. GHCi said "I can't find it". 😭
  • -Wmissed-specialisations — warns when specialisation of an imported, overloaded function fails. Specialisation didn't specialise. 💀
  • -Wmissing-deriving-strategies — warns when a deriving clause is missing a deriving strategy. Deriving clause showed up without a strategy. Not the vibe. 💅
  • -Wmissing-export-lists — warns when a module declaration does not explicitly list all exports. Module declaration said "you'll see". 🙈
  • -Wmissing-exported-signatures — warns about top-level functions without signatures, only if they are exported. Takes precedence over -Wmissing-signatures. Exported and unsigned? Not on this watch. 👑
  • -Wmissing-exported-sigs — (deprecated) warns about top-level functions without signatures, only if they are exported. Takes precedence over -Wmissing-signatures. Deprecated but still clocking in. ⏰
  • -Wmissing-fields — warns when fields of a record are uninitialised. Record fields said "left on read". 😭
  • -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 "where is that module? Not on the list, not in exposed-modules, not in other-modules." 💅
  • -Wmissing-import-lists — warns when an import declaration does not explicitly list all the names brought into scope. Import declaration said "everyone's invited". 🎀
  • -Wmissing-local-signatures — warns about polymorphic local bindings without signatures. Local bindings said "I'm mysterious". ✨
  • -Wmissing-local-sigs — (deprecated) warns about polymorphic local bindings without signatures. The deprecated twin. 🙈
  • -Wmissing-methods — warns when class methods are undefined. Class methods said "define me? No." 💀
  • -Wmissing-monadfail-instances — Warns when a failable pattern is used in a do-block that does not have a MonadFail instance. Do-block said "I can't fail like this". 😭
  • -Wmissing-pattern-synonym-signatures — warns when pattern synonyms do not have type signatures. Pattern synonyms said "types? optional." 🙈
  • -Wmissing-safe-haskell-mode — warns when the Safe Haskell mode is not explicitly specified. Safe Haskell mode said "you didn't ask, so..." 💅
  • -Wmissing-signatures — warns about top-level functions without signatures. Top-level functions said "who needs a type signature?" 😭
  • -Wmissing-space-after-bang — (deprecated) Does nothing. Literally nothing. It's just here. 💀
  • -Wmonomorphism-restriction — warns when the Monomorphism Restriction is applied. The Monomorphism Restriction said "surprise". 🎀
  • -Wname-shadowing — warns when names are shadowed. Name shadowing said "there can only be one". 👑
  • -Wno-compat — Disables all warnings enabled by -Wcompat. Compat warnings? Cancelled. 🚫
  • -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. Canon? Not found. 💅
  • -Wnoncanonical-monadfail-instances — warns when Monad or MonadFail instances have noncanonical definitions of fail. See flag description in Warnings and sanity-checking for more details. fail said "I'll do it my way". 😭
  • -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. Monoid said "canonical? Never heard of her." 💅
  • -Worphans — warns when the module contains orphan instance declarations or rewrite rules. Orphans? In this economy? 😭
  • -Woverflowed-literals — warns about literals that will overflow their type. Literal said "I'm too much". 💅
  • -Woverlapping-patterns — warns about overlapping patterns. Patterns said "same". 👯
  • -Wpartial-fields — warns when defining a partial record field. Partial record field said "I might not be there". 🙈
  • -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. Holes in type signatures? Only if PartialTypeSignatures is on; otherwise those holes become errors. 💀
  • -Wredundant-constraints — Have the compiler warn about redundant constraints in type signatures. Redundant constraints said "I'm still here". 😭
  • -Wredundant-record-wildcards — Warns about record wildcard matches when the wildcard binds no patterns. Wildcard said "I bind nothing". 💀
  • -Wsafe — warn if the module being compiled is regarded to be safe. Safe module? We love a safe module. 🫶
  • -Wsemigroup — warns when a Monoid is not Semigroup, and on non- Semigroup definitions of (<>)? Yes, the question mark is part of the drama. 💅
  • -Wsimplifiable-class-constraints — Warns about class constraints in a type signature that can be simplified using a top-level instance declaration. Class constraint said "you could simplify me". ✨
  • -Wstar-binder — warns about binding the (*) type operator despite StarIsType. Star binder said "I'm the type operator now". 💅
  • -Wstar-is-type — warns when * is used to mean Data.Kind.Type. * said "I'm a type". ⭐
  • -Wtabs — warn if there are tabs in the source file. Tabs? In the source file? Not the vibe. 🚫
  • -Wtrustworthy-safe — warns if the module being compiled is marked as Trustworthy but it could instead be marked as Safe, a more informative bound. Trustworthy but could be Safe? It's giving upgrade. 👑
  • -Wtype-defaults — warns when defaulting happens. Defaulting said "I'll pick for you". 🎀
  • -Wtyped-holes — Reports warnings when typed hole errors are deferred until runtime. See -fdefer-typed-holes. Typed holes said "later". ⏰
  • -Wunbanged-strict-patterns — warns on pattern bind of unlifted variable that is neither bare nor banged. Neither bare nor banged? Pick a struggle. 💀
  • -Wunicode-bidirectional-format-characters — warns about the usage of unicode bidirectional layout override characters. Unicode bidi override said "surprise, I reversed the text". 🙈
  • -Wunrecognised-pragmas — warns about uses of pragmas that GHC doesn't recognise. GHC said "I don't know her". 💅
  • -Wunrecognised-warning-flags — throws a warning when an unrecognised -W... flag is encountered on the command line. Unrecognised -W... flag? GHC said "warning about your warning". 😭
  • -Wunsafe — warns if the module being compiled is regarded to be unsafe. See Safe Haskell. Unsafe module said "danger is my brand". 🔥
  • -Wunsupported-calling-conventions — warns about use of an unsupported calling convention. Calling convention said "not supported, bestie". 🚫
  • -Wunsupported-llvm-version — Warns when using -fllvm with an unsupported version of LLVM. LLVM version said "we're not compatible". 💔
  • -Wunticked-promoted-constructors — warns if promoted constructors are not ticked. Promoted constructors said "tick? Never heard of her". ✅
  • -Wunused-binds — warns about bindings that are unused. Alias for -Wunused-top-binds, -Wunused-local-binds and -Wunused-pattern-binds. Unused bindings? The multitool alias. 🛠️
  • -Wunused-do-bind — warns about do bindings that appear to throw away values of types other than (). Do bindings said "I'm just gonna drop this". 😭
  • -Wunused-foralls — warns about type variables in user-written forall\s that are unused. forall\s said "I'm just here for the vibes". 💅
  • -Wunused-imports — warns about unnecessary imports. Imports said "I'm not even used". 🙈
  • -Wunused-local-binds — warns about local bindings that are unused. Local bindings said "I'm local and unemployed". 💀
  • -Wunused-matches — warns about variables in patterns that aren't used. Pattern variables said "I'm just decoration". 🎀
  • -Wunused-packages — warns when package is requested on command line, but was never loaded. Package said "I was requested but never loaded". 😭
  • -Wunused-pattern-binds — warns about pattern match bindings that are unused. Pattern match bindings said "I'm unused too". 💅
  • -Wunused-record-wildcards — Warns about record wildcard matches when none of the bound variables are used. Record wildcard said "none of these variables are used". 🫶
  • -Wunused-top-binds — warns about top-level bindings that are unused. Top-level bindings said "I'm at the top and still unused". 👑
  • -Wunused-type-patterns — warns about unused type variables which arise from patterns in in type family and data family instances. Yes, "in in" — we keep the typo, no cap. 💀
  • -Wwarn — makes warnings non-fatal. Warnings said "we're not fatal anymore". 🫶
  • -Wwarnings-deprecations — warns about uses of functions & types that have warnings or deprecated pragmas. Deprecated pragmas said "I'm warning you". ⚠️
  • -Wwrong-do-bind — warns about do bindings that appear to throw away monadic values that you should have bound instead. Do-bind said "you should have bound me". 😭

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


👀 SEE ALSO 👀


💅 AUTHOR 💅

The GHC Team


2022, GHC Team


Okay bestie, that's the whole page. This GHC(1) manual was for GHC 9.0.2, dated Sep 24, 2022. Love you, bye! 💖✨🦋

📦 where this page comes from