GHC(1)

📦
version 8.10.7 · 3 versions
, in fedora 43, fedora 44

🦋 NAME 🦋

ghc — the Glasgow Haskell Compiler. That's the whole name, bestie. And this right here is the GHC(1) manual page, so buckle up. 💖


✨ SYNOPSIS ✨

okay so here's the shape of it, no notes:

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

🌸 DESCRIPTION 🌸

So this manual page documents, briefly, the ghc and ghci commands. Quick heads up tho: ghci is not yet available on all architectures. So if you can't find it, that's not a you problem, that's an architecture problem. 🙈

Extensive documentation is available in various other formats including PDF and HTML, so if you want the full novel-length version, it's out there waiting for you. 💅

Now the part that actually matters. Every single one of GHC's command line options is classified as either static or dynamic, and this distinction is so important:

  • 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. Like, all of them. ✨

The rest are static — with the notable exceptions of -v, -cpp, -fasm, -fvia-C, -fllvm, and -#include. (Those six are the main characters, they get to be special. 👑)

The OPTIONS sections lists the status of each flag.

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 💅

This is the big one, bestie. Every flag, sorted into lil groups by vibe. Sit down, hydrate, we're doing this. 🍓

🔥 Code generation

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

💀 Debugging the compiler

(no I will not be explaining all of these, they are simply here, living their lives)

  • -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-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-cse
  • -ddump-deriv
  • -ddump-ds
  • -ddump-ds-preopt
  • -ddump-ec-trace
  • -ddump-file-prefix=⟨str⟩
  • -ddump-foreign
  • -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-worker-wrapper
  • -dfaststring-stats
  • -dhex-word-literals
  • -dinitial-unique=⟨s⟩
  • -dinline-check=⟨str⟩
  • -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

(the -X girlies, all of them, every single one, iconic)

  • -fno-safe-haskell
  • -fsort-by-size-hole-fits
  • -fno-sort-by-size-hole-fits
  • -fsort-by-subsumption-hole-fits
  • -fno-sort-by-subsumption-hole-fits
  • -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
  • -XLiberalTypeSynonyms
  • -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
  • -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
  • -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
  • -keep-cafs
  • -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
  • -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

✨ Individual optimizations ✨

Okay bestie, deep breath. 💖 This is the big list — every single individual optimization toggle GHC ships, and the page just... hands them to you with zero explanation, like a girl dropping her whole playlist and walking away. So here they all are, in order, nothing skipped, nothing merged, ⟨n⟩ placeholders and all. Notice how almost every one has a -fno- twin chilling right next to it? That's the pattern. The -fno- version is how you turn the thing off. 🌸

  • -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, -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, a few of these are spelled exactly like this and you cannot "fix" them. Yes, it's -funfolding-keeness-factor with that extra e. Yes, it's -fstg-lift-lams-non-rec-args and then -fno-stg-lift-lams-non-rec-args-any — the -any shows up on the -fno- side only. Type them like the page says. No autocorrect. 💅

🎚️ Optimization levels 🎚️

The big vibe dial. The page lists them in this order, and yes, the duplicates are literally on the page — I'm not gonna edit the queen's handwriting. 💀

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

Turning the dial up and turning the dial down, and the page just says all of it, periodt.


📦 Package options 📦

Where your build gets its whole social circle from. Packages, package databases, who's trusted, who's hidden. ✨

  • -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
🫶 keep that ⟨file⟩|⟨name⟩ pipe exactly as-is in -package-env. It's giving "either one", and it's not a typo, it's the syntax.

🧭 Phases of compilation 🧭

Short king section. Pick how far down the pipeline you wanna ride. 🦋

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

🛠️ Overriding external programs 🛠️

Every -pgm flag here lets you point at a different external program, and each one takes a ⟨cmd⟩. Look at them, all lined up like little ducklings. 🎀

  • -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⟩
💀 note the case, bestie. -pgmL and -pgml are two different flags. Same with -pgmP. Case sensitivity is not playing around here.

🎯 Phase-specific options 🎯

Hand a raw option straight to one specific phase. Each one eats an ⟨option⟩, except the last little guy. 💜

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

CPU go brrr. Three of them, take them or leave them. 🔥

  • -mbmi2
  • -msse2
  • -msse4.2

🔌 Compiler plugins 🔌

Plug in your little extensions, bestie. One of these takes the fancy ⟨module⟩:⟨args⟩ shape, so watch the colon. ✨

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

📊 Profiling 📊

Profiling toggles! And once again, the page repeats a couple of these, so I'm repeating them too. Matching energy. 💖

  • -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 (1) flag. She's alone but she's thriving. 🌸

  • -fhpc

🔁 Recompilation checking 🔁

Deciding whether to bother rebuilding. All the on/off twins, present and accounted for. 🦋

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

📁 Redirecting output 📁

Where do the files go? Where do the suffixes go? Where does the -o go? All here. 👑

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

🗑️ Temporary files 🗑️

One flag, one directory, one vibe. 🌈

  • -tmpdir ⟨dir⟩

🗣️ Verbosity options 🗣️

The yapper section. 💅 This is the biggest sub-list in the whole page, and honestly? Iconic. Every hole-fit tweak, every -fprint-*, every -fno-print-*, all of it, in order, untouched. The -fno- twins are everywhere here too — sometimes -fno-show-... and sometimes -fno-... without the show, so read each one carefully, bestie. 🫶

  • -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
  • -funclutter-valid-hole-fits, -Rghc-timing, -v, -v⟨n⟩
😭 okay so look at the last stretch of the -fshow-type-* family — the "off" version is -fno-type-of-hole-fits, not -fno-show-type-of-hole-fits. That's genuinely how it's written on the page. Do not "correct" it, I am begging. 🌸

And that's the whole flag soup for this chunk — every -f, -O, -pgm, -opt, -package, -plugin, -prof, -hcsuf-style and -v toggle exactly where the page put them. 💖

⚠️ Warnings 🚨

okay bestie, deep breath, because this is the list. every single warning switch GHC has, plus all their little off-switches, all vibing in one place. the -Wno- versions are the "actually no, mute that" twins. go crazy ✨

  • -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
  • -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
  • -Wspace-after-bang / -Wno-missing-space-after-bang
  • -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
  • -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
heads up babes — you clocked the doubles right? -w shows up three times, and a few pairs like -Wno-compat / -Wcompat and -Wno-monomorphism-restriction roll around twice. that's just how the original list is, so I'm keeping it verbatim, no editing, no fixing, no notes. 💅

⚙️ Code generation 🔧

the part where your actual code gets turned into stuff the machine runs. pick your generator, pick your flavour 🦋

  • -dynamic-too — builds the dynamic object files as well as the static object files while you're compiling. both. at the same time. iconic.
  • -fasm — use the native code generator ✨
  • -fbyte-code — generate byte-code
  • -fexternal-dynamic-refs — generate code for linking against dynamic libraries
  • -fllvm — compile using the LLVM code generator 🔥
  • -fno-code — omit code generation. yes literally, no code gets generated 🙈
  • -fobject-code — generate object code
  • -fPIC — generate position-independent code (where available)
  • -fPIE — generate code for a position-independent executable (where available)
  • -fwrite-interface — always write interface files

🕵️ Debugging the compiler 🐛

for when you want to see every single thing happening inside GHC. it's giving "open the hood and stare". very main character energy for compiler nerds, no cap 👑

  • -dcmm-lint — C-- pass sanity checking
  • -dcore-lint — turn on internal sanity checking
  • -ddump-asm — dump final assembly
  • -ddump-asm-expanded — dump the result of the synthetic instruction expansion pass.
  • -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-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-proc — dump the results of proc-point analysis
  • -ddump-cmm-procmap — dump the results of the C-- proc-point map pass.
  • -ddump-cmm-raw — dump raw C--
  • -ddump-cmm-sink — dump the results of the C-- sinking pass.
  • -ddump-cmm-sp — dump the results of the C-- stack layout pass.
  • -ddump-cmm-split — dump the results of the C-- proc-point splitting pass.
  • -ddump-cmm-switch — dump the results of switch lowering passes
  • -ddump-cmm-verbose — write output from main C-- pipeline passes to files
  • -ddump-cmm-verbose-by-proc — show output from main C-- pipeline passes (grouped by proc)
  • -ddump-core-stats — print a one-line summary of the size of the Core program at the end of the optimisation pipeline
  • -ddump-cse — dump CSE output
  • -ddump-deriv — dump deriving output
  • -ddump-ds — dump desugarer output.
  • -ddump-ec-trace — trace exhaustiveness checker
  • -ddump-file-prefix=⟨str⟩ — set the prefix of the filenames used for debugging output.
  • -ddump-foreign — dump foreign export stubs
  • -ddump-hpc — an alias for -ddump-ticked.
  • -ddump-if-trace — trace interface files
  • -ddump-inlinings — dump inlining info
  • -ddump-json — dump error messages as JSON documents
  • -ddump-llvm — dump LLVM intermediate code.
  • -ddump-mod-map — dump the state of the module mapping database.
  • -ddump-occur-anal — dump occurrence analysis output
  • -ddump-opt-cmm — dump the results of C-- to C-- optimising passes
  • -ddump-parsed — dump parse tree
  • -ddump-parsed-ast — dump parser output as a syntax tree
  • -ddump-prep — dump prepared core
  • -ddump-rn — dump renamer output
  • -ddump-rn-ast — dump renamer output as a syntax tree
  • -ddump-rn-stats — renamer stats
  • -ddump-rn-trace — trace renamer
  • -ddump-rtti — trace runtime type inference
  • -ddump-rule-firings — dump rule firing info
  • -ddump-rule-rewrites — dump detailed rule firing info
  • -ddump-rules — dump rewrite rules
  • -ddump-simpl — dump final simplifier output
  • -ddump-simpl-iterations — dump output from each simplifier iteration
  • -ddump-simpl-stats — dump simplifier stats
  • -ddump-spec — dump specialiser output
  • -ddump-splices — dump TH spliced expressions, and what they evaluate to
  • -ddump-stg — show CoreToStg output
  • -ddump-stg-final — show output of last STG pass.
  • -ddump-stg-unarised — show unarised STG
  • -ddump-str-signatures — dump strictness signatures
  • -ddump-stranal — dump strictness analyser output
  • -ddump-tc — dump typechecker output
  • -ddump-tc-ast — dump typechecker output as a syntax tree
  • -ddump-tc-trace — trace typechecker
  • -ddump-ticked — dump the code instrumented by HPC (Observing Code Coverage).
  • -ddump-timings — dump per-pass timing and allocation statistics
  • -ddump-to-file — dump to files instead of stdout
  • -ddump-types — dump type signatures
  • -ddump-worker-wrapper — dump worker-wrapper output
  • -dfaststring-stats — show statistics for fast string usage when finished
  • -dhex-word-literals — print values of type Word# in hexadecimal.
  • -dinitial-unique=⟨s⟩ — start UniqSupply allocation from ⟨s⟩.
  • -dinline-check=⟨str⟩ — dump information about inlining decisions
  • -dno-debug-output — suppress unsolicited debugging output
  • -dno-typeable-binds — bestie, this one just says don't generate bindings for Typeable methods. that's it, that's the whole vibe 💅
  • -dppr-case-as-let — prints single alternative case expressions as strict lets. glow up your dumps ✨
  • -dppr-cols=⟨n⟩ — sets the width of debugging output. like for example, -dppr-cols200. keep those dumps from being one cursed long line 📏
  • -dppr-debug — turns on debug printing (aka more verbose). not me making the output even louder 🙈
  • -dppr-user-length — sets the depth for printing expressions in error msgs. so your errors don't go infinitely deep on you 😭
  • -drule-check=⟨str⟩ — dumps information about potential rule application. detective mode activated 🕵️
  • -dshow-passes — prints out each pass name as it happens. literally narrating the compiler's journey ✨
  • -dstg-lint — STG pass sanity checking. a lil vibe check for the STG pass 🫶
  • -dsuppress-all — in dumps, suppresses everything (except for uniques) that is suppressible. silent mode: engaged 🤫
  • -dsuppress-coercions — suppresses the printing of coercions in Core dumps to make them shorter. shorter dumps = happier bestie 💖
  • -dsuppress-idinfo — suppresses extended information about identifiers where they are bound.
  • -dsuppress-module-prefixes — suppresses the printing of module qualification prefixes. no more Foo.Bar.Baz. everywhere, we're free 🌈
  • -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. goodbye noisy numbers 👋
  • -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). lowkey this one is a lifesaver for diffing 🔥
  • -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 — inserts error expressions after bottoming expressions; super useful when debugging the compiler.
  • -fllvm-fill-undef-with-garbage — instructs LLVM to fill dead STG registers with garbage. yes really, we're feeding it trash on purpose 💀
  • -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. it's giving main character debug info 👑

💖 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 the import path. stack 'em up 🧚

🎀 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.

💜 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. hoarder mode, no judgement 🫶

✨ Language options ✨

  • -fno-safe-haskell — disables Safe Haskell.
  • -fsort-by-size-hole-fits — sorts valid hole fits by size.
  • -fsort-by-subsumption-hole-fits — sorts valid hole fits by subsumption.
  • -XAllowAmbiguousTypes — allows the user to write ambiguous types, and the type inference engine to infer them.
  • -XApplicativeDo — enables Applicative do-notation desugaring.
  • -XArrows — enables the arrow notation extension.
  • -XBangPatterns — enables bang patterns.
  • -XBinaryLiterals — enables support for binary literals.
  • -XBlockArguments — allows do blocks and other constructs as function arguments.
  • -XCApiFFI — enables 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.
  • -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 the 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.
  • -XGHCForeignImportPrim — enables the prim calling convention. intended for internal use only.
  • -XHaskell2010 — uses the Haskell 2010 language variant.
  • -XHaskell98 — uses the Haskell 2010 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.
  • -XLiberalTypeSynonyms — enables liberalised type synonyms.
  • -XMagicHash — allows # as a postfix modifier on identifiers.
  • -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 — don't implicitly import Prelude. implied by RebindableSyntax.
  • -XNoMonomorphismRestriction — disables the monomorphism restriction.
  • -XNondecreasingIndentation — allows nested contexts to be at the same indentation level as its enclosing context.
  • -XNoPatternGuards — disables pattern guards. implied by Haskell98.
  • -XNoTraditionalRecordSyntax — turns OFF the classic record syntax that Haskell 98 loves so much, the whole C {f = x} situation. bye bestie 👋
  • -XNPlusKPatterns — enables n+k patterns. Implied by Haskell98.
  • -XNullaryTypeClasses — deprecated, does literally nothing. nullary (no parameter) type classes are now switched on via MultiParamTypeClasses instead. it's giving ghost of extensions past 👻
  • -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. Implies KindSignatures.
  • -XPostfixOperators — enables postfix operators.
  • -XQuantifiedConstraints — lets you have forall quantifiers up in constraints. iconic behavior fr 💅
  • -XQuasiQuotes — enables quasiquotation.
  • -XRank2Types — enables rank-2 types. it's a synonym for RankNTypes.
  • -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.
  • -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 legitimately make the typechecker never terminate. yes bestie, that means the typechecker can just spin forever 😭
  • -XUnicodeSyntax — enables unicode syntax. ✨ pretty code ✨
  • -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. we out here, no further 💅
  • -debug — use the debugging runtime.
  • -dylib-install-name ⟨path⟩ — sets 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.
  • -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.
  • -keep-cafs — do not garbage-collect CAFs (top-level expressions) at runtime. keep those top-level vibes alive 🫶
  • -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 — this instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. currently Linux and Windows/MinGW32 only. this is equivalent to using -optl -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. buckle up, here's the whole breakdown:
    • none means no RTS flags can be given.
    • some means only a minimum of safe options can be given (the default).
    • all (or no argument at all) means that all RTS flags are permitted.
    • ignore means RTS flags can be given, but are treated as regular arguments and passed to the Haskell program as arguments.
    • ignoreAll is the same as ignore, but GHCRTS is also ignored.
heads up bestie: -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 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. enable most language extensions; see Language options for exactly which ones.
  • -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. multitasking era fr ⚡

🎛️ 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.
  • -fcpr-anal — turn on CPR analysis in the demand analyser. 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.
  • -fdmd-tx-dict-sel — use a special demand transformer for dictionary selectors. always enabled by default.
  • -fdo-eta-reduction — bestie we're turning ON eta-reduction, she's getting slimmed down ✨ (implied by -O)
  • -fdo-lambda-eta-expansion — turn on lambda eta-expansion. she's literally always on by default, no notes 💅
  • -feager-blackholing — turn on eager blackholing 🕳️
  • -fenable-rewrite-rules — switch on ALL the rewrite rules (yes, even the ones auto-generated by specialisation of overloaded functions, she's thorough like that). implied by -O 🔥
  • -fexcess-precision — enable excess intermediate precision 🎀
  • -fexitification — enables the exitification optimisation. implied by -O 👑
  • -fexpose-all-unfoldings — expose all the unfoldings, even for the very large or recursive functions. no hiding, periodt 💖
  • -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 — allow worker-wrapper to convert a function closure into a thunk if the function doesn't use any of its arguments. off by default, so she's opt-in only 🙈
  • -fignore-asserts — ignore assertions in the source. implied by -O 💀
  • -fignore-interface-pragmas — ignore pragmas in interface files. implied by -O0 only
  • -flate-dmd-anal — run demand analysis AGAIN, at the end of the simplification pipeline. double-checking the vibes ✨
  • -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 — pass vector value in vector registers for function calls ⭐
  • -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. set the max iterations for the simplifier 💖
  • *-fmax-uncovered-patterns=⟨n⟩* — default: 4. set the maximum number of patterns to display in warnings about non-exhaustive ones. (non-exhaustive pattern warnings could never be me but okay 😭)
  • *-fmax-worker-args=⟨n⟩* — default: 10. if a worker has that many arguments, none will be unpacked anymore 👑
  • -fno-opt-coercion — turn OFF the coercion optimiser 🙅
  • -fno-pre-inlining — turn OFF pre-inlining
  • -fno-state-hack — turn off the state hack whereby any lambda with a real-world state token as argument is considered to be single-entry. hence OK to inline things inside it 🧚
  • -fomit-interface-pragmas — don't generate interface pragmas. implied by -O0 only 💜
  • -fomit-yields — omit heap checks when no allocation is being performed ⭐
  • -foptimal-applicative-do — use a slower but better algorithm for ApplicativeDo. slow and steady wins the race fr fr 🐢
  • -fpedantic-bottoms — make GHC be more precise about its treatment of bottom (but see also -fno-state-hack). in particular, GHC will not eta-expand through a case expression. she's being picky and honestly? valid 💅
  • -fregs-graph — use the graph colouring register allocator for register allocation in the native code generator. implied by -O2 🌈
  • -fregs-iterative — use the iterative coalescing graph colouring register allocator in the native code generator 🔥
  • *-fsimpl-tick-factor=⟨n⟩* — default: 100. set the percentage factor for simplifier ticks 🎀
  • *-fsimplifier-phases=⟨n⟩* — default: 2. set the number of phases for the simplifier. ignored with -O0 🦋
  • -fsolve-constant-dicts — when solving constraints, try to eagerly solve super classes using available dictionaries. get it done EARLY, no procrastination 💖
  • -fspec-constr — turn on the SpecConstr transformation. implied by -O2 ✨
  • *-fspec-constr-count=⟨n⟩* — default: 3.*. set to ⟨n⟩ the maximum number of specialisations that will be created for any one function by the SpecConstr transformation 🌸
  • -fspec-constr-keen — specialize a call with an explicit constructor argument, even if the argument is not scrutinised in the body of the function. she's keen and she's not sorry about it 🫶
  • *-fspec-constr-threshold=⟨n⟩* — default: 2000. set the size threshold for the SpecConstr transformation to ⟨n⟩ 💜
  • -fspecialise — turn on specialisation of overloaded functions. implied by -O ⭐
  • -fspecialise-aggressively — turn on specialisation of overloaded functions regardless of size, if unfolding is available. no size limit, she's going feral 🔥
  • -fstatic-argument-transformation — turn on the static argument transformation 👑
  • -fstg-cse — enable common sub-expression elimination on the STG intermediate language 🎀
  • -fstg-lift-lams — enable late lambda lifting on the STG intermediate language. implied by -O2 🦋
  • -fstg-lift-lams-known — allow turning known into unknown calls while performing late lambda lifting 🌸
  • -fstg-lift-lams-non-rec-args — create top-level non-recursive functions with at most <n> parameters while performing late lambda lifting 💖
  • -fstg-lift-lams-rec-args — create top-level recursive functions with at most <n> parameters while performing late lambda lifting ✨
  • -fstrictness — turn on strictness analysis. implied by -O. implies -fworker-wrapper 🔥
  • *-fstrictness-before=⟨n⟩* — run an additional strictness analysis before simplifier phase ⟨n⟩ 💅
  • -funbox-small-strict-fields — flatten strict constructor fields with a pointer-sized representation. implied by -O 🫶
  • -funbox-strict-fields — flatten strict constructor fields 🌈
  • *-funfolding-creation-threshold=⟨n⟩* — default: 750. tweak unfolding settings 🎀
  • *-funfolding-dict-discount=⟨n⟩* — default: 30. tweak unfolding settings 🦋
  • *-funfolding-fun-discount=⟨n⟩* — default: 60. tweak unfolding settings 🌸
  • *-funfolding-keeness-factor=⟨n⟩* — default: 1.5. tweak unfolding settings 💖
  • *-funfolding-use-threshold=⟨n⟩* — default: 60. tweak unfolding settings ⭐
  • -fworker-wrapper — enable the worker-wrapper transformation 💜

👑 Optimization levels 👑

  • -O — enable level 1 optimisations ✨
  • -O0 — disable optimisations (this is the default, bestie) 💀
  • -O2 — enable level 2 optimisations 🔥
  • -O⟨n⟩ — any -On where n > 2 is the same as -O2. girl, don't overthink it, it caps at 2 💅

🎀 Package options 🎀

  • -clear-package-db — clear the package db stack 🧹
  • -distrust ⟨pkg⟩ — expose package ⟨pkg⟩ and set it to be distrusted. see Safe Haskell 👀
  • -distrust-all-packages — distrust ALL packages by default. see Safe Haskell. nobody's safe 🙈
  • -fpackage-trust — enable Safe Haskell trusted package requirement for trustworthy modules 🫶
  • -global-package-db — add the global package db to the stack 🌈
  • -hide-all-packages — hide all packages by default, shy girl era 💜
  • -hide-package ⟨pkg⟩ — hide package ⟨pkg⟩ 🙈
  • -ignore-package ⟨pkg⟩ — ignore package ⟨pkg⟩ 💀
  • -no-auto-link-packages — don't automatically link in the base and rts packages ✋
  • -no-global-package-db — remove the global package db from the stack 🚫
  • -no-user-package-db — remove the user's package db from the stack 🚫
  • -package ⟨pkg⟩ — expose package ⟨pkg⟩ ✨
  • -package-db ⟨file⟩ — add ⟨file⟩ to the package db stack 📚
  • -package-env ⟨file⟩|⟨name⟩ — use the specified package environment 🌸
  • -package-id ⟨unit-id⟩ — expose package by id ⟨unit-id⟩ 🎀
  • -this-unit-id ⟨unit-id⟩ — compile to be part of unit (i.e. package) ⟨unit-id⟩ 👑
  • -trust ⟨pkg⟩ — expose package ⟨pkg⟩ and set it to be trusted. see Safe Haskell 🤝
  • -user-package-db — add the user's package db to the stack 🌟

🦋 Phases of compilation 🦋

  • -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 ⚙️
  • -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⟩ — 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⟩ — bestie, this just passes ⟨option⟩ straight to windres. That's it. ✨
  • -pgmc-supports-no-pie — tells GHC the C compiler is cool with -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 — clear the list of active plugins. 🧹
  • -fplugin-opt=⟨module⟩:⟨args⟩ — give arguments to a plugin module; the module has to be specified with -fplugin=⟨module⟩. 💬
  • -fplugin-trustworthy — trust the plugins you're using and stop marking the compiled module as unsafe. 🫶
  • -fplugin=⟨module⟩ — load a plugin exported by the given module. 🔌
  • -hide-all-plugin-packages — hide all packages for plugins by default. 🙈
  • -plugin-package ⟨pkg⟩ — expose ⟨pkg⟩ for plugins. 📦
  • -plugin-package-id ⟨pkg-id⟩ — expose ⟨pkg-id⟩ for plugins. 🆔

💜 Profiling 💜

  • -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-add SCCs to all bindings not marked INLINE. ✨
  • -fprof-auto-calls — auto-add SCCs to all call sites. 📞
  • -fprof-auto-exported — auto-add SCCs to all exported bindings not marked INLINE. 📤
  • -fprof-auto-top — auto-add SCCs to all top-level bindings not marked INLINE. 🏔️
  • -fprof-cafs — auto-add SCCs to all CAFs. ☕
  • -prof — turn on profiling. 📈
  • -ticky — turn on ticky-ticky profiling. ⏱️

🍓 Program coverage 🍓

  • -fhpc — turn on Haskell program coverage instrumentation. 🧪

🌈 Recompilation checking 🌈

  • -fforce-recomp — turn off recompilation checking. This is implied by any -ddump-X option when compiling a single file (i.e. when using -c). 🔁
  • -fignore-hpc-changes — do not recompile modules just to match changes to HPC flags. This is especially useful for avoiding recompilation when using GHCi, and is enabled by default for GHCi. 🧘
  • -fignore-optim-changes — do not recompile modules just to match changes to optimisation flags. This is especially useful for avoiding recompilation when using GHCi, and is enabled by default for GHCi. 🧘

🎀 Redirecting output 🎀

  • --exclude-module=⟨file⟩ — regard ⟨file⟩ as "stable"; i.e., exclude it from having dependencies on it. 🚫
  • -ddump-mod-cycles — dump module cycles. 🔄
  • -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. 📂
  • -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. 🏷️
  • -include-cpp-deps — include preprocessor dependencies. 🧩
  • -include-pkg-deps — regard modules imported from packages as unstable. 📦
  • -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 ⭐

  • -fabstract-refinement-hole-fits — default: off. Toggles whether refinements where one or more of the holes are abstract are reported. 🔍
  • -fdefer-diagnostics — defer and group diagnostic messages by severity. 📊
  • -fdiagnostics-color=⟨always|auto|never⟩ — use colors in error messages. 🌈
  • -fdiagnostics-show-caret — whether to show snippets of original source code. 🔍
  • -ferror-spans — output full span in error messages. 📏
  • -fhide-source-paths — hide module source and object paths. 🙈
  • -fkeep-going — continue compilation as far as possible on errors. 🚀
  • -fmax-refinement-hole-fits=⟨n⟩ — default: 6. Set the maximum number of refinement hole fits for typed holes to display in type error messages. 🔢
  • -fmax-relevant-binds=⟨n⟩ — default: 6. Set the maximum number of bindings to display in type error messages. 🔢
  • -fmax-valid-hole-fits=⟨n⟩ — default: 6. Set the maximum number of valid hole fits for typed holes to display in type error messages. 🔢
  • -fno-show-valid-hole-fits — disables showing a list of valid hole fits for typed holes in type error messages. 🚫
  • -fno-sort-valid-hole-fits — disables the sorting of the list of valid hole fits for typed holes in type error messages. 🚫
  • -fprint-axiom-incomps — display equation incompatibilities in closed type families. 🧩
  • -fprint-equality-relations — distinguish between equality relations when printing. ⚖️
  • -fprint-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 variables in types which are runtime-representation polymorphic. 🧵
  • -fprint-potential-instances — display all available instances in type error messages. 🗂️
  • -fprint-typechecker-elaboration — print extra information from 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-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. 🏷️
  • -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. 🚨
  • -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. ⏳
  • -Wdeprecated-flags — warn about uses of commandline flags that are deprecated. 🚫
  • -Wdeprecations — warn about uses of functions & types that have warnings or deprecated pragmas. Alias for -Wwarnings-deprecations. ⚠️
  • -Wderiving-defaults — warn about default deriving when using both DeriveAnyClass and GeneralizedNewtypeDeriving. 🧬
  • -Wderiving-typeable — warn when Typeable is derived. 🧬
  • -Wdodgy-exports — warn about dodgy exports. 👀
  • -Wdodgy-foreign-imports — warn about dodgy foreign imports. 👀
  • -Wdodgy-imports — warn about dodgy imports. 👀
  • -Wduplicate-constraints — warn when a constraint appears duplicated in a type signature. 🔁
  • -Wduplicate-exports — warn when an entity is exported multiple times. 🔁
  • -Wempty-enumerations — warn about enumerations that are empty. 🕳️
  • -Werror — make warnings fatal. 💀
  • -Weverything — enable all warnings supported by GHC. every single one, bestie. no warning left behind.
  • -Whi-shadowing — (deprecated) warn when a .hi file in the current directory shadows a library.
  • -Widentities — warn about uses of Prelude numeric conversions that are probably the identity (and hence could be omitted).
  • -Wimplicit-kind-vars — (deprecated) warn when kind variables are implicitly quantified over.
  • -Wimplicit-prelude — warn when the Prelude is implicitly imported.
  • -Winaccessible-code — warn about inaccessible code.
  • -Wincomplete-patterns — warn when a pattern match could fail.
  • -Wincomplete-record-updates — warn when a record update could fail.
  • -Wincomplete-uni-patterns — warn when a pattern match in a lambda expression or pattern binding could fail.
  • -Winferred-safe-imports — warn when an explicitly Safe Haskell module imports a Safe-Inferred one.
  • -Winline-rule-shadowing — Warn 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.
  • -Wmissed-extra-shared-lib — Warn when GHCi can't load a shared lib.
  • -Wmissed-specialisations — warn when specialisation of an imported, overloaded function fails.
  • -Wmissing-deriving-strategies — warn when a deriving clause is missing a deriving strategy.
  • -Wmissing-export-lists — warn when a module declaration does not explicitly list all exports.
  • -Wmissing-exported-signatures — warn about top-level functions without signatures, only if they are exported. takes precedence over -Wmissing-signatures.
  • -Wmissing-exported-sigs — (deprecated) warn about top-level functions without signatures, only if they are exported. takes precedence over -Wmissing-signatures.
  • -Wmissing-fields — warn when fields of a record are uninitialised.
  • -Wmissing-home-modules — warn when encountering a home module imported, but not listed on the command line. Useful for cabal to ensure GHC won't pick up modules, not listed neither in exposed-modules, nor in other-modules.
  • -Wmissing-import-lists — warn when an import declaration does not explicitly list all the names brought into scope.
  • -Wmissing-local-signatures — warn about polymorphic local bindings without signatures.
  • -Wmissing-local-sigs — (deprecated) warn about polymorphic local bindings without signatures.
  • -Wmissing-methods — warn when class methods are undefined.
  • -Wmissing-monadfail-instances — (deprecated) Warn when a failable pattern is used in a do-block that does not have a MonadFail instance.
  • -Wmissing-pattern-synonym-signatures — warn when pattern synonyms do not have type signatures.
  • -Wmissing-safe-haskell-mode — warn when the Safe Haskell mode is not explicitly specified.
  • -Wmissing-signatures — warn about top-level functions without signatures.
  • -Wmissing-space-after-bang — (deprecated) Does nothing.
  • -Wmonomorphism-restriction — warn when the Monomorphism Restriction is applied.
  • -Wname-shadowing — warn when names are shadowed.
  • -Wno-compat — Disables all warnings enabled by -Wcompat.
  • -Wnoncanonical-monad-instances — warn 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) warn when Monad or MonadFail instances have noncanonical definitions of fail. See flag description in Warnings and sanity-checking for more details.
  • -Wnoncanonical-monoid-instances — warn when Semigroup or Monoid instances have noncanonical definitions of (<>) or mappend. See flag description in Warnings and sanity-checking for more details.
  • -Worphans — warn when the module contains orphan instance declarations or rewrite rules.
  • -Woverflowed-literals — warn about literals that will overflow their type.
  • -Woverlapping-patterns — warn about overlapping patterns.
  • -Wpartial-fields — warn when defining a partial record field.
  • -Wpartial-type-signatures — warn 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.
  • -Wredundant-constraints — Have the compiler warn about redundant constraints in type signatures.
  • -Wredundant-record-wildcards — Warn about record wildcard matches when the wildcard binds no patterns.
  • -Wsafe — warn if the module being compiled is regarded to be safe.
  • -Wsemigroup — warn when a Monoid is not Semigroup, and on non-Semigroup definitions of (<>)?
  • -Wsimplifiable-class-constraints — Warn about class constraints in a type signature that can be simplified using a top-level instance declaration.
  • -Wspace-after-bang — warn for missing space before the second argument of an infix definition of (!) when BangPatterns are not enabled.
  • -Wstar-binder — warn about binding the (*) type operator despite StarIsType.
  • -Wstar-is-type — warn when * is used to mean Data.Kind.Type.
  • -Wtabs — warn if there are tabs in the source file.
  • -Wtrustworthy-safe — warn if the module being compiled is marked as Trustworthy but it could instead be marked as Safe, a more informative bound.
  • -Wtype-defaults — warn when defaulting happens.
  • -Wtyped-holes — Report warnings when typed hole errors are deferred until runtime. See -fdefer-typed-holes.
  • -Wunbanged-strict-patterns — warn on pattern bind of unlifted variable that is neither bare nor banged.
  • -Wunrecognised-pragmas — warn about uses of pragmas that GHC doesn't recognise.
  • -Wunrecognised-warning-flags — throw a warning when an unrecognised -W... flag is encountered on the command line.
  • -Wunsafe — warn if the module being compiled is regarded to be unsafe. See Safe Haskell.
  • -Wunsupported-calling-conventions — warn about use of an unsupported calling convention.
  • -Wunsupported-llvm-version — Warn when using -fllvm with an unsupported version of LLVM.
  • -Wunticked-promoted-constructors — warn if promoted constructors are not ticked.
  • -Wunused-binds — warn about bindings that are unused. Alias for -Wunused-top-binds, -Wunused-local-binds and -Wunused-pattern-binds.
  • -Wunused-do-bind — warn about do bindings that appear to throw away values of types other than ().
  • -Wunused-foralls — warn about type variables in user-written foralls that are unused.
  • -Wunused-imports — warn about unnecessary imports.
  • -Wunused-local-binds — warn about local bindings that are unused.
  • -Wunused-matches — warn about variables in patterns that aren't used.
  • -Wunused-packages — warn when package is requested on command line, but was never loaded.
  • -Wunused-pattern-binds — warn about pattern match bindings that are unused.
  • -Wunused-record-wildcards — Warn about record wildcard matches when none of the bound variables are used.
  • -Wunused-top-binds — warn about top-level bindings that are unused.
  • -Wunused-type-patterns — warn about unused type variables which arise from patterns in in type family and data family instances.
  • -Wwarn — make warnings non-fatal.
  • -Wwarnings-deprecations — warn about uses of functions & types that have warnings or deprecated pragmas.
  • -Wwrong-do-bind — warn about do bindings that appear to throw away monadic values that you should have bound instead.

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

like, all rights reserved, bestie — respect the Glasgow glow-up.

👑 AUTHOR 👑

The GHC Team

yes, literally the whole team. main character energy.

2024, GHC Team

and that's the whole page! This was GHC(1), version 8.10.7, dated Jul 18, 2024. go forth and compile something iconic. 💅✨

📦 where this page comes from