GHC(1)

📦
version 9.0.2 · 4 versions
, in fedora 43, fedora 44

✨ NAME ✨

bestie, this is the GHC(1) manual page, and it's literally all about ghc — the Glasgow Haskell Compiler 💅


✨ SYNOPSIS ✨

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

✨ DESCRIPTION ✨

okay so this manual page documents briefly the ghc and ghci commands. lowkey important: ghci is not yet available on all architectures. Extensive documentation is available in various other formats including PDF (https://downloads.haskell.org/ghc/latest/docs/users_guide.pdf) and HTML (https://downloads.haskell.org/ghc/latest/docs/html/).

Each of GHC's command line options is classified as either static or dynamic. A static flag may only be specified on the command line, whereas a dynamic flag may also be given in an OPTIONS pragma in a source file or set from the GHCi command-line with :set.

As a rule of thumb, all the language options are dynamic, as are the warning options and the debugging options.

The rest are static, with the notable exceptions of -v, -cpp, -fasm, -fvia-C, -fllvm, and -#include. The OPTIONS sections lists the status of each flag.

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 ✨

⚙️ Code generation ⚙️

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

🐛 Debugging the compiler 🐛

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

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

🦋 Individual optimizations 🦋

okay bestie, deep breath, because this is the flag wall. it's giving "i contain multitudes." every one of these is a single little optimiser switch, and almost all of them come in a matched pair — the plain -f... flips it on, the -fno-... flips it off. the ones with =⟨n⟩ are asking you for a number. that's the whole shape of it, no cap. 💅

  • -fasm-shortcutting / -fno-asm-shortcutting
  • -fbinary-blob-threshold=⟨n⟩
  • -fblock-layout-cfg / -fno-block-layout-cfg
  • -fblock-layout-weightless / -fno-block-layout-weightless
  • -fblock-layout-weights
  • -fcall-arity / -fno-call-arity
  • -fcase-folding / -fno-case-folding
  • -fcase-merge / -fno-case-merge
  • -fcmm-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 — no -fno twin here, she stands alone 👑
  • -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

✨ Optimization levels ✨

the big vibes dial. one flag, whole personality shift. here's every form she comes in:

  • -O
  • -O1
  • -O0
  • -O0
  • -O2
  • -O0
  • -O⟨n⟩
  • -O0
bestie i need you to know that -O0 really does show up four separate times in the source list. i did not typo, i did not get lazy, i am simply not about to edit a manpage. that's literally not my job 💅

🎀 Package options 🎀

the whole "where do my packages even come from" situation. trust issues, database drama, hiding and unhiding — it's giving group chat after someone leaves the server. 🌸

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

where do you want the pipeline to stop, bestie. pick your stopping point and she'll hand you the goods right there. 🫶

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

🌈 Overriding external programs 🌈

not feeling the default toolchain? say less. every one of these swaps out an external program for a command of your choosing. your pipeline, your rules.

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

these are the "pass this straight through to that one specific phase" girlies. extremely targeted, extremely useful, lowkey iconic. 💖

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

tiny section, big energy. these are the "your CPU can do a fun trick and we should let it" flags. ✨

  • -mbmi2
  • -msse2
  • -msse4.2

🔥 Compiler plugins 🔥

extending the compiler with your own little guys. plug them in, take them out, decide how much you trust them. it's giving main character energy for your build. 👑

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

🧚 Profiling 🧚

so you want to know where the time went. valid. relatable. every one of these is about which bits get annotated for profiling, plus the two big switches at the end. note that a few of these names show up more than once in the list — again, i'm not editing the manpage, i'm just reporting the tea. 😭

  • -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 job. she's simple, she's effective, she's literally just:

  • -fhpc

🎀 Recompilation checking 🎀

the "did anything actually change, or are we just being dramatic" section. force a rebuild, or tell her to chill about certain kinds of changes. both are valid moods. 💅

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

🌸 Redirecting output 🌸

where do the artifacts go, bestie. every one of these is about directing some file somewhere specific — object files here, interface files there, dep files over yonder. very "everything in its place" of her. 🎀

  • --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 single flag. she picks where the temporary stuff lives. that's it, that's the section. 🫶

  • -tmpdir ⟨dir⟩

🌈 Verbosity options 🌈

okay this is the big finale of this part and it is A LOT, bestie. this section is everything about what GHC tells you and how pretty she makes it — error formatting, colour, hole fits, printing extra type info, timing reports, and the two -v dials at the very end. buckle up. 💖

  • -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⟩
real talk: the hole-fit flags are a whole personality. if you're staring at a _ wondering what on earth belongs there, this is your girlies. 🙈

✨ Warnings ✨

okay bestie, deep breath, hydrate, sit down 💖 this is the warnings section and it is a lot. it's giving "the compiler has opinions and every single one of them has a flag." every single one below is real, exact, and listed in order — i'm not summarising, i'm not skipping, i'm not merging. the whole buffet 🍓

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

okay phew 😭 that's the whole list, nothing left out, you're welcome, i love you, drink water. 💜


🛠️ Code generation

this is where you tell the compiler how to make the actual machine stuff happen. pick your fighter 💅

  • -dynamic-too — build dynamic object files as well as static object files during compilation. both. at once. multitasking icon 👑
  • -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 bestie, it just... doesn't make code. vibe.)
  • -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

okay so this is the deep-lore section 🌈 these are all the <cyan>-d</cyan> dump flags — they make the compiler spill its entire diary about what it's doing internally. extremely main character behaviour, ngl. buckle up, there are so many.

  • -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-opt — dump the results of C-- to C-- optimising passes.
  • -ddump-cmm-proc — dump the results of proc-point analysis.
  • -ddump-cmm-procmap — dump the results of the C-- proc-point map pass.
  • -ddump-cmm-raw — dump raw C--.
  • -ddump-cmm-sink — dump the results of the C-- sinking pass.
  • -ddump-cmm-sp — dump the results of the C-- stack layout pass.
  • -ddump-cmm-split — dump the results of the C-- proc-point splitting pass.
  • -ddump-cmm-switch — dump the results of switch lowering passes.
  • -ddump-cmm-verbose — write output from main C-- pipeline passes to files.
  • -ddump-cmm-verbose-by-proc — show output from main C-- pipeline passes (grouped by proc).
  • -ddump-core-stats — print a one-line summary of the size of the Core program at the end of the optimisation pipeline.
  • -ddump-cpr-signatures — dump CPR signatures.
  • -ddump-cpranal — dump CPR analysis output.
  • -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-hie — dump the hie file syntax tree.
  • -ddump-hpc — an alias for -ddump-ticked.
  • -ddump-if-trace — trace interface files.
  • -ddump-inlinings — dump inlinings performed by the simplifier.
  • -ddump-json — dump error messages as JSON documents.
  • -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-verbose-inlinings — dump all considered inlinings.
  • -ddump-worker-wrapper — dump worker-wrapper output.
  • -dfaststring-stats — show statistics for fast string usage when finished.
heads up bestie 🫶 a lot of these will absolutely flood your terminal. if you're the type to panic at 40k lines of Core, maybe pair them with -ddump-to-file and go touch some grass while it works. 🌸
  • -dhex-word-literals — bestie, this makes values of type Word# print out in hexadecimal instead of boring decimal ✨
  • -dinitial-unique=⟨s⟩ — kicks off UniqSupply allocation from ⟨s⟩, so the uniques start where you tell them to 🎀
  • -dinline-check=⟨str⟩ — spills all the tea about inlining decisions (dumps info about them) 💅
  • -dlinear-core-lint — flips on internal sanity checking, aka GHC checking its own vibe 🫶
  • -dno-debug-output — no more unsolicited debugging output, we're muting those notifications fr 🔇
  • -dno-typeable-binds — refuses to generate bindings for Typeable methods 🚫
  • -dppr-case-as-let — prints single-alternative case expressions as strict lets. so quirky of them 💜
  • -dppr-cols=⟨n⟩ — sets the width of debugging output. like, for example -dppr-cols200 📏
  • -dppr-debug — debug printing turned on, and it's more verbose (so, a lot of yapping) 😭
  • -dppr-user-length — sets the depth for printing expressions in error msgs 🐛
  • -drule-check=⟨str⟩ — dumps info about potential rule application, very niche, very cunty 🌸
  • -dshow-passes — prints out each pass name as it happens, like a little progress livestream 🔥
  • -dstg-lint — STG pass sanity checking, the vibe check of the STG world ⭐
  • -dsuppress-all — in dumps, suppresses everything that's suppressible (except for uniques). the maximalist declutter 🧹
  • -dsuppress-coercions — stops printing coercions in Core dumps so they're shorter, you're welcome 💅
  • -dsuppress-idinfo — suppresses the extended info about identifiers right where they're bound 🙈
  • -dsuppress-module-prefixes — no more module qualification prefixes when printing 🎀
  • -dsuppress-stg-free-vars — suppresses closure free variable lists in STG output 🌈
  • -dsuppress-ticks — suppresses "ticks" in the pretty-printer output ⏱️
  • -dsuppress-timestamps — suppresses timestamps in dumps, time is fake anyway 🕰️
  • -dsuppress-type-applications — suppresses type applications ✨
  • -dsuppress-type-signatures — suppresses type signatures (iconic, unhinged, love that for you) 💖
  • -dsuppress-unfoldings — suppresses printing the stable unfolding of a variable at its binding site 📖
  • -dsuppress-uniques — suppresses uniques in debug output, which makes it easier to use diff 👑
  • -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, front row seats 🔥
  • -dverbose-stg2stg — shows output from each STG-to-STG pass, same energy, different pass 💅
  • -falignment-sanitisation — compiles with alignment checks for all info table dereferences 🛡️
  • -fcatch-bottoms — adds a default error alternative to case expressions that don't have a default alternative 🕳️
  • -fllvm-fill-undef-with-garbage — instructs LLVM to fill dead STG registers with garbage 🗑️ (yes, on purpose, no cap)
  • -fproc-alignment — aligns functions at the given boundary 📐
  • -g — produces DWARF debug information in compiled object files. ⟨n⟩ can be 0, 1, or 2, and higher numbers produce richer output. if ⟨n⟩ is omitted, level 2 is assumed 🐛

✨ C pre-processor ✨

  • -cpp — runs the C pre-processor on your Haskell source files, slay crossover episode 💅
  • -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, clean slate energy 🧹
  • -i⟨dir⟩[:⟨dir⟩]* — adds ⟨dir⟩, ⟨dir2⟩, etc. to the import path 🌈

👑 Interactive mode 👑

  • -fbreak-on-error — breaks on uncaught exceptions and errors, dramatic pause ⏸️
  • -fbreak-on-exception — breaks on any exception thrown 😭
  • -fghci-hist-size=⟨n⟩ — sets the number of entries GHCi keeps for :history. go check out 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, so it is just gone bestie 💀
  • -fprint-bind-result — turns on printing of binding results in GHCi 🖨️
  • -fprint-evld-with-show — tells :print to use Show instances where possible ✨
  • -fshow-loaded-modules — shows the names of modules GHCi loaded after a :load command 📦
  • -ghci-script — reads additional .ghci files 📜
  • -ignore-dot-ghci — disables reading of .ghci files, going rogue 🙈
  • -interactive-print ⟨name⟩ — picks the function to use for printing evaluated expressions in GHCi 💅

🎀 Interface files 🎀

  • --show-iface ⟨file⟩ — see Modes of operation for this one 👀
  • -ddump-hi — dumps the new interface to stdout 📤
  • -ddump-hi-diffs — shows the differences vs. the old interface, glow-up comparison 🔍
  • -ddump-minimal-imports — dumps a minimal set of imports, capsule wardrobe edition 🧳

🧚 Keeping intermediate files 🧚

  • -keep-hc-file — retains intermediate .hc files 💾
  • -keep-hi-files — retains intermediate .hi files (this is 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 (this is the default) ✅
  • -keep-s-file — retains intermediate .s files 📝
  • -keep-tmp-files — retains all intermediate temporary files, maximal hoarding 🗂️

💜 Language options 💜

  • -XAllowAmbiguousTypes — lets you write ambiguous types, and lets the type inference engine 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 the (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 (see 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 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 🪄
  • -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 🚫
  • -XNoMonomorphismRestriction — Disable the monomorphism restriction. Bye bestie, the restriction is gone.
  • -XNondecreasingIndentation — Allow nested contexts to be at the same indentation level as its enclosing context. Indentation? Let them be free.
  • -XNoPatternGuards — Disable pattern guards. Implied by Haskell98. So Haskell98 said no.
  • -XNoTraditionalRecordSyntax — Disable support for traditional record syntax (as supported by Haskell 98) C {f = x} Old school record syntax? Not today.
  • -XNPlusKPatterns — Enable support for n+k patterns. Implied by Haskell98. Retro vibes.
  • -XNullaryTypeClasses — Deprecated, does nothing. nullary (no parameter) type classes are now enabled using MultiParamTypeClasses. Literally a ghost flag.
  • -XNumDecimals — Enable support for 'fractional' integer literals. Decimals but make it int.
  • -XNumericUnderscores — Enable support for numeric underscores. Underscores, bestie.
  • -XOverlappingInstances — Enable overlapping instances. Overlap? We love a little chaos.
  • -XOverloadedLabels — Enable overloaded labels. Labels but extra.
  • -XOverloadedLists — Enable overloaded lists. Lists, but make them do more.
  • -XOverloadedStrings — Enable overloaded string literals. Strings? Overloaded. Iconic.
  • -XPackageImports — Enable package-qualified imports. Import with the package name, periodt.
  • -XParallelListComp — Enable parallel list comprehensions. Parallel? We're multitasking.
  • -XPartialTypeSignatures — Enable partial type signatures. Type signatures, but leave some blanks.
  • -XPatternSynonyms — Enable pattern synonyms. Patterns with nicknames? Cute.
  • -XPolyKinds — Enable kind polymorphism. Implies KindSignatures. Kinds can be poly, slay.
  • -XPostfixOperators — Enable postfix operators. Operators after? We love a plot twist.
  • -XQualifiedDo — Enable qualified do-notation desugaring. Do-notation but qualified.
  • -XQuantifiedConstraints — Allow forall quantifiers in constraints. Forall in constraints? Iconic.
  • -XQuasiQuotes — Enable quasiquotation. Quasi quotes, bestie.
  • -XRank2Types — Enable rank-2 types. Synonym for RankNTypes. Basically the same vibe.
  • -XRankNTypes — Enable rank-N types. Implied by ImpredicativeTypes. Rank-N, no cap.
  • -XRebindableSyntax — Employ rebindable syntax. Implies NoImplicitPrelude. Syntax? Rebindable. Periodt.
  • -XRecordWildCards — Enable record wildcards. Implies DisambiguateRecordFields. Wildcards in records? So fetch.
  • -XRecursiveDo — Enable recursive do (mdo) notation. mdo, bestie.
  • -XRoleAnnotations — Enable role annotations. Roles? Annotated.
  • -XSafe — Enable the Safe Haskell Safe mode. Safe mode, we love a safe queen.
  • -XScopedTypeVariables — Enable lexically-scoped type variables. Scoped type variables, slay.
  • -XStandaloneDeriving — Enable standalone deriving. Deriving but standing alone, main character.
  • -XStandaloneKindSignatures — Allow the use of standalone kind signatures. Kind signatures, solo.
  • -XStarIsType — Treat * as Data.Kind.Type. Star is type, periodt.
  • -XStaticPointers — Enable static pointers. Static pointers, no cap.
  • -XStrict — Make bindings in the current module strict by default. Strict by default? Highkey intense.
  • -XStrictData — Enable default strict datatype fields. Strict data fields, we love efficiency.
  • -XTemplateHaskell — Enable Template Haskell. Template Haskell, iconic.
  • -XTemplateHaskellQuotes — Enable quotation subset of Template Haskell. Just the quotes, bestie.
  • -XTransformListComp — Enable generalised list comprehensions. Generalised list comps, slay.
  • -XTrustworthy — Enable the Safe Haskell Trustworthy mode. Trustworthy mode, we trust.
  • -XTupleSections — Enable tuple sections. Tuple sections, cute.
  • -XTypeApplications — Enable type application syntax in terms and types. Apply types in terms and types, periodt.
  • -XTypeFamilies — Enable type families. Implies ExplicitNamespaces, KindSignatures, and MonoLocalBinds. Type families, the whole squad.
  • -XTypeFamilyDependencies — Enable injective type families. Implies TypeFamilies. Injective type families, highkey.
  • -XTypeInType — Deprecated. Enable kind polymorphism and datatype promotion. Old flag, bye.
  • -XTypeOperators — Enable type operators. Implies ExplicitNamespaces. Type operators, slay.
  • -XTypeSynonymInstances — Enable type synonyms in instance heads. Implied by FlexibleInstances. Type synonyms in instance heads, periodt.
  • -XUnboxedSums — Enable unboxed sums. Unboxed sums, no cap.
  • -XUnboxedTuples — Enable the use of unboxed tuple syntax. Unboxed tuples, iconic.
  • -XUndecidableInstances — Enable undecidable instances. Undecidable? We love a little risk.
  • -XUndecidableSuperClasses — Allow all superclass constraints, including those that may result in non-termination of the typechecker. Typechecker might not terminate? Bestie, be careful.
  • -XUnicodeSyntax — Enable unicode syntax. Unicode syntax, pretty.
  • -XUnliftedFFITypes — Enable unlifted FFI types Unlifted FFI types, periodt.
  • -XUnliftedNewtypes — Enable unlifted newtypes. Unlifted newtypes, slay.
  • -XUnsafe — Enable Safe Haskell Unsafe mode. Unsafe mode? We love danger.
  • -XViewPatterns — Enable view patterns. View patterns, iconic.

🔗 Linking options 💖

  • -c — Stop after generating object (.o) file Just the object file, periodt.
  • -debug — Use the debugging runtime Debug runtime, bestie.
  • -dylib-install-name ⟨path⟩ — Set the install name (via -install_name passed to Apple's linker), specifying the full install path of the library file. Any libraries or executables that link with it later will pick up that path as their runtime search location for it. (Darwin/OS X only) Darwin/OS X only, iykyk.
  • -dynamic — Build dynamically-linked object files and executables Dynamic, we move.
  • -dynload — Selects one of a number of modes for finding shared libraries at runtime. Runtime shared library hunting, periodt.
  • -eventlog — Enable runtime event tracing Event tracing, slay.
  • -fkeep-cafs — Do not garbage-collect CAFs (top-level expressions) at runtime Keep those CAFs, bestie.
  • -flink-rts — Link the runtime when generating a shared or static library Link the runtime, no cap.
  • -fno-embed-manifest — Do not embed the manifest in the executable (Windows only) Windows only, periodt.
  • -fno-gen-manifest — Do not generate a manifest file (Windows only) No manifest, Windows only.
  • -fno-shared-implib — Don't generate an import library for a DLL (Windows only) DLL import library? Not today, 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. Apple linker vibes.
  • -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. Framework search path, iykyk.
  • -fuse-rpaths — Set the rpath based on -L flags rpath from -L, slay.
  • -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 Whole archive, periodt.
  • -L ⟨dir⟩ — Add ⟨dir⟩ to the list of directories searched for libraries Library search path, bestie.
  • -l ⟨lib⟩ — Link in library ⟨lib⟩ Link that lib.
  • -main-is ⟨thing⟩ — Set main module and function Main character module and function.
  • -no-hs-main — Don't assume this program contains main No main? Not assumed.
  • -no-rtsopts-suggestions — Don't print RTS suggestions about linking with ‐ -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩]. No suggestions, periodt.
  • -package ⟨name⟩ — Expose package ⟨pkg⟩ Expose that package.
  • -pie — Instruct the linker to produce a position-independent executable. PIE, position-independent, slay.
  • -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. Dynamic symbols, iykyk.
  • -rtsopts[=⟨none|some|all|ignore|ignoreAll⟩] — Control whether the RTS behaviour can be tweaked via command-line flags and the GHCRTS environment variable. Using 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. -rtsopts does not affect -with-rtsopts behavior; flags passed via -with-rtsopts are used regardless of -rtsopts. RTS opts, so many modes.
  • -shared — Generate a shared library (as opposed to an executable) Shared library, not executable.
  • -split-sections — Split sections for link-time dead-code stripping Dead-code stripping at link time, periodt.
  • -static — Use static Haskell libraries Static libs, bestie.
  • -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. Standalone static lib, cross compiling vibes.
  • -threaded — Use the threaded runtime Threaded runtime, slay.
  • -with-rtsopts= ⟨opts⟩ — Set the default RTS options to ⟨opts⟩. Default RTS options, periodt.

🧩 Miscellaneous options ✨

  • -fexternal-interpreter — Run interpreted code in a separate process Separate process, iykyk.
  • -fglasgow-exts — Deprecated. Enable most language extensions; see Controlling extensions for exactly which ones. Deprecated, but it's giving legacy.
  • -fno-safe-haskell — Disable Safe Haskell Safe Haskell off, periodt.
  • -ghcversion-file ⟨path to ghcversion.h⟩ — (GHC as a C compiler only) Use this ghcversion.h file Only when GHC is a C compiler, bestie.
  • -H ⟨size⟩ — Set the minimum size of the heap to ⟨size⟩ Heap minimum size, slay.
  • -j[⟨n⟩] — When compiling with --make, compile ⟨n⟩ modules in parallel. Parallel modules, we love multitasking.

🎛️ Modes of operation 👑

  • --frontend ⟨module⟩ — run GHC with the given frontend plugin; see Frontend plugins for details. Frontend plugin, iykyk.
  • --help — Display help Help, bestie.
  • --info — display information about the compiler Compiler info, periodt.
  • --interactive — Interactive mode - normally used by just running ghci; see Using GHCi for details. Interactive mode, ghci vibes.
  • --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. Multi-module build, dependencies auto, slay.
  • --mk-dll — DLL-creation mode (Windows only) Windows DLL mode, iykyk.
  • --numeric-version — display GHC version (numeric only) Numeric version, periodt.
  • --print-libdir — display GHC library directory Library directory, bestie.
  • --show-iface ⟨file⟩ — display the contents of an interface file. Interface file contents, slay.
  • --show-options — display the supported command line options Show options, iconic.
  • --supported-extensions — display the supported language extensions Supported extensions, no cap.
  • --version — display GHC version Version, periodt.
  • -e ⟨expr⟩ — Evaluate expr; see Expression evaluation mode for details. Evaluate that expr.
  • -M — generate dependency information suitable for use in a Makefile; see Dependency generation for details. Makefile deps, slay.

⚡ Individual optimizations 🔥

  • -fasm-shortcutting — Enable shortcutting on assembly. Implied by -O2. Assembly shortcutting, periodt.
  • -fbinary-blob-threshold=⟨n⟩ — default: 500K. Tweak assembly generator for binary blobs. Binary blobs, tweak it.
  • -fblock-layout-cfg — Use the new cfg based block layout algorithm. New cfg block layout, iykyk.
  • -fblock-layout-weightless — Ignore cfg weights for code layout. Weightless layout, slay.
  • -fblock-layout-weights — Sets edge weights used by the new code layout algorithm. Edge weights, periodt.
  • -fcall-arity — Enable call-arity optimisation. Implied by -O. Call arity, bestie.
  • -fcase-folding — Enable constant folding in case expressions. Implied by -O. Case folding, iconic.
  • -fcase-merge — Enable case-merging. Implied by -O. Case merging, slay.
  • -fcmm-elim-common-blocks — Enable Cmm common block elimination. Implied by -O. Cmm common block elimination, no cap.
  • -fcmm-sink — Enable Cmm sinking. Implied by -O. Cmm sinking, periodt.
  • -fcmm-static-pred — Enable static control flow prediction. Implied by -O. Static control flow prediction, iykyk.
  • -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. no cap ✨
  • -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 — Enable eta-reduction. Implied by -O. 🦋
  • -fdo-lambda-eta-expansion — Enable lambda eta-expansion. Always enabled by default. 🌸
  • -feager-blackholing — Turn on eager blackholing 💀
  • -fenable-rewrite-rules — Switch on all rewrite rules (including rules generated by automatic specialisation of overloaded functions). Implied by -O. ✨
  • -fexcess-precision — Enable excess intermediate precision 🔥
  • -fexitification — Enables exitification optimisation. Implied by -O. 👑
  • -fexpose-all-unfoldings — Expose all unfoldings, even for very large or recursive functions. 🫶
  • -ffloat-in — Turn on the float-in transformation. Implied by -O. 💖
  • -ffull-laziness — Turn on full laziness (floating bindings outwards). Implied by -O. 🌈
  • -ffun-to-thunk — Allow worker-wrapper to convert a function closure into a thunk if the function does not use any of its arguments. Off by default. 🙈
  • -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 🔥
  • -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. 💀
  • -fmax-worker-args=⟨n⟩ — default: 10. Maximum number of value arguments for a worker. 👑
  • -fno-opt-coercion — Turn off the coercion optimiser 🙈
  • -fno-pre-inlining — Turn off pre-inlining 💅
  • -fno-state-hack — Turn off the state hack whereby any lambda with a real-world state token as argument is considered to be single-entry. Hence OK to inline things inside it. 💀
  • -fomit-interface-pragmas — Don't generate interface pragmas. Implied by -O0 only. ✨
  • -fomit-yields — Omit heap checks when no allocation is being performed. 🔥
  • -foptimal-applicative-do — Use a slower but better algorithm for ApplicativeDo 🌈
  • -fpedantic-bottoms — Make GHC be more precise about its treatment of bottom (but see also -fno-state-hack). In particular, GHC will not eta-expand through a case expression. 🎀
  • -fregs-graph — Use the graph colouring register allocator for register allocation in the native code generator. 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. 🧚
  • -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 ✨
  • -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 🔥
  • -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⟩ — This has been deprecated in GHC 9.0.1. 💀
  • -funfolding-use-threshold=⟨n⟩ — default: 80. Tweak unfolding settings. 🧚
  • -fworker-wrapper — Enable the worker-wrapper transformation. 💅

✨ Optimization levels ✨

  • -O — Enable level 1 optimisations 🔥
  • -O0 — Disable optimisations (default) 💀
  • -O2 — Enable level 2 optimisations 👑
  • -O⟨n⟩ — Any -On where n > 2 is the same as -O2. periodt

🎀 Package options 🎀

  • -clear-package-db — Clear the package db stack. 💖
  • -distrust ⟨pkg⟩ — Expose package ⟨pkg⟩ and set it to be distrusted. See Safe Haskell. 🫶
  • -distrust-all-packages — Distrust all packages by default. See Safe Haskell. 💅
  • -fpackage-trust — Enable Safe Haskell trusted package requirement for trustworthy modules. 🔥
  • -global-package-db — Add the global package db to the stack. 🌈
  • -hide-all-packages — Hide all packages by default 🙈
  • -hide-package ⟨pkg⟩ — Hide package ⟨pkg⟩ 💀
  • -ignore-package ⟨pkg⟩ — Ignore package ⟨pkg⟩ ✨
  • -no-auto-link-packages — Don't automatically link in 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⟩ — yeet ⟨option⟩ straight at the interpreter sub-process. 🫶
  • -optL ⟨option⟩ — hand ⟨option⟩ over to the literate pre-processor.
  • -optl ⟨option⟩ — give ⟨option⟩ to the linker.
  • -optlc ⟨option⟩ — ⟨option⟩ goes to the LLVM compiler, bestie.
  • -optlm ⟨option⟩ — pass ⟨option⟩ to the linker when it's merging object files.
  • -optlo ⟨option⟩ — ⟨option⟩ to the LLVM optimiser. slay.
  • -optP ⟨option⟩ — pass ⟨option⟩ to cpp (only a thing when you've got -cpp on).
  • -optwindres ⟨option⟩ — pass ⟨option⟩ to windres.
  • -pgmc-supports-no-pie — signals that the C compiler supports -no-pie. iconic of it honestly.

🌸 Platform-specific options 🌸

  • -mbmi2 — (x86 only) Use BMI2 for bit manipulation operations. tiny little bit-flipping queen 👑
  • -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. poof, gone, no thoughts head empty ✨
  • *-fplugin-opt=⟨module⟩*:⟨args⟩ — Give arguments to a plugin module. lowkey important: the module has to be specified with -fplugin=⟨module⟩ first, or it's giving nothing.
  • -fplugin-trustworthy — Trust the used plugins and no longer mark the compiled module as unsafe. bestie said "I know them personally" 🫶
  • *-fplugin=⟨module⟩* — Load a plugin exported by a given module.
  • -hide-all-plugin-packages — Hide all packages for plugins by default. so dramatic, so effective.
  • -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. the undo button fr fr.
  • -fno-prof-cafs — Disables any previous -fprof-cafs option.
  • -fno-prof-count-entries — Do not collect entry counts.
  • -fprof-auto — Auto-add SCC\ s to all bindings not marked INLINE.
  • -fprof-auto-calls — Auto-add SCC\ s to all call sites. every single one. no crumbs.
  • -fprof-auto-exported — Auto-add SCC\ s to all exported bindings not marked INLINE.
  • -fprof-auto-top — Auto-add SCC\ s to all top-level bindings not marked INLINE.
  • -fprof-cafs — Auto-add 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 — Turn off recompilation checking. Heads up bestie: this is implied by any -ddump-X option when you're compiling a single file (i.e. when you're using -c).
  • -fignore-hpc-changes — Do not recompile modules just to match changes to HPC flags. This is especially useful for avoiding recompilation when using GHCi, and it's enabled by default for GHCi. living her best lazy life 💖
  • -fignore-optim-changes — Do not recompile modules just to match changes to optimisation flags. Also especially useful for avoiding recompilation when using GHCi, and also enabled by default for GHCi.

🌈 Redirecting output 🌈

  • *--exclude-module=⟨file⟩* — Regard ⟨file⟩ as "stable"; i.e., exclude it from having dependencies on it. she's stable, she's unbothered 💅
  • -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. your lil workspace 🫶

⭐ 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. yes queen, make the errors pretty 🌈
  • -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. she does not give up 💪
  • *-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. aesthetic ✨
  • *-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.
  • -fsort-by-size-hole-fits — Sort valid hole fits by size.
  • -fsort-by-subsumption-hole-fits — Sort valid hole fits by subsumption.
  • -funclutter-valid-hole-fits — Unclutter the list of valid hole fits by not showing provenance nor type applications of suggestions. minimalism era 🎀
  • -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. this is the "we'll deal with it later" of flags 😭
  • -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. she's just trying to help 🫶
  • *-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. no thoughts, head empty, no 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. literally nothing. she's just vibing 😭
  • -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. (yes, the flag that warns about deprecated flags. she contains multitudes ✨)
  • -Wdeprecations — warn about uses of functions & types that have warnings or deprecated pragmas. Alias for -Wwarnings-deprecations.
  • -Wderiving-defaults — warns about default deriving when you're using both DeriveAnyClass and GeneralizedNewtypeDeriving 🫶
  • -Wderiving-typeable — warns when Typeable is derived ✨
  • -Wdodgy-exports — warns about dodgy exports 💀
  • -Wdodgy-foreign-imports — warns about dodgy foreign imports 🙈
  • -Wdodgy-imports — warns about dodgy imports 🍓
  • -Wduplicate-constraints — warns when a constraint appears duplicated in a type signature 😭
  • -Wduplicate-exports — warns when an entity is exported multiple times 👑
  • -Wempty-enumerations — warns about enumerations that are empty 🕳️
  • -Werror — makes warnings fatal — like, no more "just kidding", bestie. 🔥
  • -Weverything — enables all warnings supported by GHC — the whole menu, no cap. 👑
  • -Whi-shadowing — (deprecated) warns when a .hi file in the current directory shadows a library
  • -Widentities — warns about uses of Prelude numeric conversions that are probably the identity (and hence could be omitted)
  • -Wimplicit-kind-vars — warns when kind variables are implicitly quantified over.
  • -Wimplicit-prelude — warns when the Prelude is implicitly imported
  • -Winaccessible-code — warns about inaccessible code
  • -Wincomplete-patterns — warns when a pattern match could fail 😬
  • -Wincomplete-record-updates — warns when a record update could fail
  • -Wincomplete-uni-patterns — warns when a pattern match in a lambda expression or pattern binding could fail
  • -Winferred-safe-imports — warns when an explicitly Safe Haskell module imports a Safe-Inferred one
  • -Winline-rule-shadowing — Warns if a rewrite RULE might fail to fire because the function might be inlined before the rule has a chance to fire. See How rules interact with INLINE/NOINLINE pragmas.
  • -Winvalid-haddock — warns when a Haddock comment occurs in an invalid position
  • -Wmissed-extra-shared-lib — Warns when GHCi can't load a shared lib.
  • -Wmissed-specialisations — warns when specialisation of an imported, overloaded function fails.
  • -Wmissing-deriving-strategies — warns when a deriving clause is missing a deriving strategy
  • -Wmissing-export-lists — warns when a module declaration does not explicitly list all exports
  • -Wmissing-exported-signatures — warns about top-level functions without signatures, only if they are exported. takes precedence over -Wmissing-signatures
  • -Wmissing-exported-sigs — (deprecated) warns about top-level functions without signatures, only if they are exported. takes precedence over -Wmissing-signatures
  • -Wmissing-fields — warns when fields of a record are uninitialised
  • -Wmissing-home-modules — warns when encountering a home module imported, but not listed on the command line. Useful for cabal to ensure GHC won't pick up modules, not listed neither in exposed-modules, nor in other-modules.
  • -Wmissing-import-lists — warns when an import declaration does not explicitly list all the names brought into scope
  • -Wmissing-local-signatures — warns about polymorphic local bindings without signatures
  • -Wmissing-local-sigs — (deprecated) warns about polymorphic local bindings without signatures
  • -Wmissing-methods — warns when class methods are undefined
  • -Wmissing-monadfail-instances — Warns when a failable pattern is used in a do-block that does not have a MonadFail instance.
  • -Wmissing-pattern-synonym-signatures — warns when pattern synonyms do not have type signatures
  • -Wmissing-safe-haskell-mode — warns when the Safe Haskell mode is not explicitly specified.
  • -Wmissing-signatures — warns about top-level functions without signatures
  • -Wmissing-space-after-bang — (deprecated) Does nothing — literally giving nothing, bestie. 💀
  • -Wmonomorphism-restriction — warns when the Monomorphism Restriction is applied
  • -Wname-shadowing — warns when names are shadowed
  • -Wno-compat — Disables all warnings enabled by -Wcompat.
  • -Wnoncanonical-monad-instances — warns 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 — warns when Monad or MonadFail instances have noncanonical definitions of fail. See flag description in Warnings and sanity-checking for more details.
  • -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.
  • -Worphans — warns when the module contains orphan instance declarations or rewrite rules
  • -Woverflowed-literals — warns about literals that will overflow their type
  • -Woverlapping-patterns — warns about overlapping patterns
  • -Wpartial-fields — warns when defining a partial record field.
  • -Wpartial-type-signatures — warns about holes in partial type signatures 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 — Warns about record wildcard matches when the wildcard binds no patterns.
  • -Wsafe — warn if the module being compiled is regarded to be safe.
  • -Wsemigroup — warns when a Monoid is not Semigroup, and on non- Semigroup definitions of (<>)?
  • -Wsimplifiable-class-constraints — Warns about class constraints in a type signature that can be simplified using a top-level instance declaration.
  • -Wstar-binder — warns about binding the (*) type operator despite StarIsType
  • -Wstar-is-type — warns when * is used to mean Data.Kind.Type
  • -Wtabs — warn if there are tabs in the source file
  • -Wtrustworthy-safe — warns if the module being compiled is marked as Trustworthy but it could instead be marked as Safe, a more informative bound.
  • -Wtype-defaults — warns when defaulting happens
  • -Wtyped-holes — Reports warnings when typed hole errors are deferred until runtime. See -fdefer-typed-holes.
  • -Wunbanged-strict-patterns — warns on pattern bind of unlifted variable that is neither bare nor banged
  • -Wunicode-bidirectional-format-characters — warns about the usage of unicode bidirectional layout override characters
  • -Wunrecognised-pragmas — warns about uses of pragmas that GHC doesn't recognise
  • -Wunrecognised-warning-flags — throws a warning when an unrecognised -W... flag is encountered on the command line.
  • -Wunsafe — warns if the module being compiled is regarded to be unsafe. See Safe Haskell
  • -Wunsupported-calling-conventions — warns about use of an unsupported calling convention
  • -Wunsupported-llvm-version — Warns when using -fllvm with an unsupported version of LLVM.
  • -Wunticked-promoted-constructors — warns if promoted constructors are not ticked
  • -Wunused-binds — warns about bindings that are unused. Alias for -Wunused-top-binds, -Wunused-local-binds and -Wunused-pattern-binds
  • -Wunused-do-bind — warns about do bindings that appear to throw away values of types other than ()
  • -Wunused-foralls — warns about type variables in user-written forall\s that are unused
  • -Wunused-imports — warns about unnecessary imports
  • -Wunused-local-binds — warns about local bindings that are unused
  • -Wunused-matches — warns about variables in patterns that aren't used
  • -Wunused-packages — warns when package is requested on command line, but was never loaded.
  • -Wunused-pattern-binds — warns about pattern match bindings that are unused
  • -Wunused-record-wildcards — Warns about record wildcard matches when none of the bound variables are used.
  • -Wunused-top-binds — warns about top-level bindings that are unused
  • -Wunused-type-patterns — warns about unused type variables which arise from patterns in in type family and data family instances
  • -Wwarn — make warnings non-fatal
  • -Wwarnings-deprecations — warns about uses of functions & types that have warnings or deprecated pragmas
  • -Wwrong-do-bind — warns about do bindings that appear to throw away monadic values that you should have bound instead

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


✨ SEE ALSO ✨


💜 AUTHOR 💜

The GHC Team 👑


2024, GHC Team ✨


okay bestie, that's a wrap on the whole page 💖 this little masterpiece is from GHC 9.0.2, dated Jul 18, 2024, and it's the GHC(1) manual page. now go forth and compile something iconic. periodt. 💅🦋🌸

📦 where this page comes from