GHC(1)
okay so like, hi bestie!! 🫶 this is the GHC(1) page from the Glasgow Haskell Compiler manual, and honestly?? it's a LOT, but we're gonna get through it together, no cap. grab a snack 🍓 and let's go.
🌸 NAME 🌸
ghc — the Glasgow Haskell Compiler. that's the name, she's iconic, she contains multitudes 👑
🦋 SYNOPSIS 🦋
ghc [option|filename]
ghci [option|filename]
✨ DESCRIPTION ✨
so this manual page gives you the quick rundown of the ghc and ghci commands. lowkey important note tho: ghci is not yet available on all architectures, so if it's not showing up for you, that's why bestie 😭
and if you want the FULL tea, there's extensive documentation in other formats too, including PDF and HTML:
- PDF:
https://downloads.haskell.org/ghc/latest/docs/users_guide.pdf - HTML:
https://downloads.haskell.org/ghc/latest/docs/html/
okay so every single one of GHC's command line options is classified as either static or dynamic, and this matters, fr fr:
- a static flag can only be given on the command line.
- a dynamic flag can also be given in an
OPTIONSpragma in a source file, or set from the GHCi command line with:set. 💅
as a rule of thumb: all the language options are dynamic, and so are the warning options and the debugging options. ✨
everything else is static, with these notable exceptions that are dynamic: -v, -cpp, -fasm, -fvia-C, -fllvm, and -#include. the OPTIONS section lists the status of each flag, iykyk.
so 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-linkedp— built with profiling
.⟨way⟩_hi— interface files for "way" ⟨way⟩; common ways are:
(the last one just kinda trails off in the original, so I'm keeping it exactly like that, no editing 🙈)
🔥 OPTIONS 🔥
okay bestie, this is the big one. every single flag GHC has, sorted into lil groups. buckle up 💖
💻 Code generation 💻
the "make it go brrr" flags 🔥
-dynamic-too -fasm -fllvm -fbyte-code -fexpose-internal-symbols
-fexternal-dynamic-refs -fllvm -fasm -fno-code -fobject-code
-fPIC -fPIE -fwrite-interface -split-objs
🐛 Debugging the compiler 🐛
when you wanna see everything the compiler is thinking. it's giving "let me peer into your soul" 💀
-dasm-lint -dcmm-lint -dcore-lint -ddump-asm -ddump-asm-conflicts
-ddump-asm-liveness -ddump-asm-native -ddump-asm-regalloc
-ddump-asm-regalloc-stages -ddump-asm-stats -ddump-bcos
-ddump-c-backend -ddump-call-arity -ddump-cfg-weights -ddump-cmm
-ddump-cmm-caf -ddump-cmm-cbe -ddump-cmm-cfg -ddump-cmm-cps
-ddump-cmm-from-stg -ddump-cmm-info -ddump-cmm-opt
-ddump-cmm-proc -ddump-cmm-procmap -ddump-cmm-raw -ddump-cmm-sink
-ddump-cmm-sp -ddump-cmm-split -ddump-cmm-switch
-ddump-cmm-verbose -ddump-cmm-verbose-by-proc -ddump-core-stats
-ddump-cpr-signatures -ddump-cpranal -ddump-cs-trace -ddump-cse
-ddump-debug -ddump-deriv -ddump-ds -ddump-ds-preopt
-ddump-ec-trace -ddump-exitify -ddump-faststrings
-ddump-file-prefix=⟨str⟩ -ddump-foreign -ddump-hie -ddump-hpc
-ddump-if-trace -ddump-inlinings -ddump-json -ddump-late-cc
-ddump-llvm -ddump-mod-map -ddump-occur-anal -ddump-opt-cmm
-ddump-parsed -ddump-parsed-ast -ddump-prep -ddump-rn
-ddump-rn-ast -ddump-rn-stats -ddump-rn-trace -ddump-rtti
-ddump-rule-firings -ddump-rule-rewrites -ddump-rules
-ddump-simpl -ddump-simpl-iterations -ddump-simpl-stats
-ddump-simpl-trace -ddump-spec -ddump-splices -ddump-stg
-ddump-stg-cg -ddump-stg-final -ddump-stg-from-core
-ddump-stg-tags -ddump-stg-unarised -ddump-str-signatures
-ddump-stranal -ddump-tc -ddump-tc-ast -ddump-tc-trace
-ddump-ticked -ddump-timings -ddump-to-file -ddump-types
-ddump-verbose-inlinings -ddump-view-pattern-commoning
-ddump-worker-wrapper -dfaststring-stats -dhex-word-literals
-dinitial-unique=⟨s⟩ -dinline-check=⟨str⟩ -dkeep-comments
-dlinear-core-lint -dlint -dno-debug-output -ddebug-output
-dno-typeable-binds -dppr-case-as-let -dppr-cols=⟨n⟩ -dppr-debug
-dppr-user-length -drule-check=⟨str⟩ -dshow-passes -dstg-lint
-dsuppress-all -dsuppress-coercion-types -dsuppress-coercions
-dsuppress-core-sizes -dsuppress-idinfo
-dsuppress-module-prefixes -dsuppress-stg-free-vars
-dsuppress-stg-reps -dsuppress-ticks -dsuppress-timestamps
-dsuppress-type-applications -dsuppress-type-signatures
-dsuppress-unfoldings -dsuppress-uniques -dsuppress-var-kinds
-dtag-inference-checks -dth-dec-file -dunique-increment=⟨i⟩
-dverbose-core2core -dverbose-stg2stg -falignment-sanitisation
-fcatch-nonexhaustive-cases -fcheck-prim-bounds
-fdistinct-constructor-tables -finfo-table-map
-fllvm-fill-undef-with-garbage -fproc-alignment -g -g⟨n⟩
🧚 C pre-processor 🧚
the C pre-processor vibes, slay ✨
-cpp -D⟨symbol⟩[=⟨value⟩] -U⟨symbol⟩ -I⟨dir⟩ -U⟨symbol⟩
🔍 Finding imports 🔍
where do the imports come from?? here's where 🌈
-i -i⟨dir⟩[:⟨dir⟩]*
💬 Interactive mode 💬
GHCi time, bestie!! the REPL is the moment 👑
-fbreak-on-error -fno-break-on-error -fbreak-on-exception
-fno-break-on-exception -fghci-hist-size=⟨n⟩ -fghci-leak-check
-fno-ghci-leak-check -fimplicit-import-qualified
-fno-implicit-import-qualified -flocal-ghci-history
-fno-local-ghci-history -fno-it -fno-no-it -fprint-bind-result
-fno-print-bind-result -fprint-evld-with-show
-fshow-loaded-modules -ghci-script -ignore-dot-ghci
-no-ignore-dot-ghci -interactive-print ⟨name⟩
🎀 Interface files 🎀
peeking at the .hi files, iconic behaviour 🦋
--show-iface ⟨file⟩ -ddump-hi -ddump-hi-diffs
-ddump-minimal-imports
📦 Keeping intermediate files 📦
keep those lil in-between files around, no cap 💖
-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 big one!! every -X extension under the sun, and yes there are SO many, we're listing all of them because we don't gatekeep 💅
-XAllowAmbiguousTypes -XApplicativeDo -XArrows -XBangPatterns
-XBinaryLiterals -XBlockArguments -XCApiFFI
-XConstrainedClassMethods -XConstraintKinds -XCPP -XCUSKs
-XDataKinds -XDatatypeContexts -XDeepSubsumption
-XDefaultSignatures -XDeriveAnyClass -XDeriveDataTypeable
-XDeriveFoldable -XDeriveFunctor -XDeriveGeneric -XDeriveLift
-XDeriveTraversable -XDerivingStrategies -XDerivingVia
-XDisambiguateRecordFields -XDuplicateRecordFields -XEmptyCase
-XEmptyDataDecls -XEmptyDataDeriving -XExistentialQuantification
-XExplicitForAll -XExplicitNamespaces -XExtendedDefaultRules
-XFieldSelectors -XFlexibleContexts -XFlexibleInstances
-XForeignFunctionInterface -XFunctionalDependencies -XGADTs
-XGADTSyntax -XGeneralisedNewtypeDeriving
-XGeneralizedNewtypeDeriving -XGHC2021 -XGHCForeignImportPrim
-XHaskell2010 -XHaskell98 -XHexFloatLiterals -XImplicitParams
-XImportQualifiedPost -XImpredicativeTypes -XIncoherentInstances
-XInstanceSigs -XInterruptibleFFI -XKindSignatures -XLambdaCase
-XLexicalNegation -XLiberalTypeSynonyms -XLinearTypes -XMagicHash
-XMonadComprehensions -XMonoLocalBinds -XMultiParamTypeClasses
-XMultiWayIf -XNamedFieldPuns -XNamedWildCards -XNegativeLiterals
-XNoImplicitPrelude -XNoMonomorphismRestriction
-XNondecreasingIndentation -XNoPatternGuards
-XNoTraditionalRecordSyntax -XNPlusKPatterns -XNullaryTypeClasses
-XNumDecimals -XNumericUnderscores -XOverlappingInstances
-XOverloadedLabels -XOverloadedLists -XOverloadedRecordDot
-XOverloadedRecordUpdate -XOverloadedStrings -XPackageImports
-XParallelListComp -XPartialTypeSignatures -XPatternSynonyms
-XPolyKinds -XPostfixOperators -XQualifiedDo
-XQuantifiedConstraints -XQuasiQuotes -XRank2Types -XRankNTypes
-XRebindableSyntax -XRecordWildCards -XRecursiveDo
-XRoleAnnotations -XSafe -XScopedTypeVariables
-XStandaloneDeriving -XStandaloneKindSignatures -XStarIsType
-XStaticPointers -XStrict -XStrictData -XTemplateHaskell
-XTemplateHaskellQuotes -XTransformListComp -XTrustworthy
-XTupleSections -XTypeApplications -XTypeFamilies
-XTypeFamilyDependencies -XTypeInType -XTypeOperators
-XTypeSynonymInstances -XUnboxedSums -XUnboxedTuples
-XUndecidableInstances -XUndecidableSuperClasses -XUnicodeSyntax
-XUnliftedDatatypes -XUnliftedFFITypes -XUnliftedNewtypes
-XUnsafe -XViewPatterns
🔗 Linking options 🔗
linking and building, the moment where it all comes together fr 🔥
-c -debug -dylib-install-name ⟨path⟩ -dynamic -dynload -eventlog
-fcompact-unwind -fkeep-cafs -flink-rts -fno-embed-manifest
-fno-gen-manifest -fno-shared-implib -framework ⟨name⟩
-framework-path ⟨dir⟩ -fuse-rpaths -fwhole-archive-hs-libs -L
⟨dir⟩ -l ⟨lib⟩ -main-is ⟨thing⟩ -no-hs-main -no-link -no-pie -pie
-no-rtsopts-suggestions -package ⟨name⟩ -pie -no-pie -rdynamic
-rtsopts[=⟨none|some|all|ignore|ignoreAll⟩] -shared
-split-sections -static -staticlib -threaded -with-rtsopts=⟨opts⟩
🌈 Miscellaneous options 🌈
the odds and ends, the lil extras, we love a grab bag 💜
-fexternal-interpreter -ffamily-application-cache
-fno-family-application-cache -fglasgow-exts -fno-glasgow-exts
-fno-safe-haskell -ghcversion-file ⟨path to ghcversion.h⟩ -H
⟨size⟩ -hidden-module ⟨module name⟩ -j[⟨n⟩] -reexported-module
⟨module name⟩ -this-package-name ⟨unit-id⟩ -unit @⟨filename⟩
-working-dir ⟨dir⟩
⭐ Modes of operation ⭐
what mode are we in today bestie?? pick your adventure 🎀
--frontend ⟨module⟩ --help -? --info --interactive --make
--numeric-version --print-booter-version --print-build-platform
--print-c-compiler-flags --print-c-compiler-link-flags
--print-debug-on --print-global-package-db
--print-have-interpreter --print-have-native-code-generator
--print-host-platform --print-ld-flags --print-leading-underscore
--print-libdir --print-object-splitting-supported
--print-project-git-commit-id --print-project-version
--print-rts-ways --print-stage --print-support-smp
--print-tables-next-to-code --print-target-platform
--print-unregisterised --run ⟨file⟩ --show-iface ⟨file⟩
--show-options --supported-extensions --supported-languages
--version -V -e ⟨expr⟩ -M -shared
and that's part 1 bestie!! there's more coming so don't go anywhere, the rest of the flags are on their way 💖✨
✨ Individual optimizations ✨
okay bestie, this is the big one. GHC has SO many little switches that tweak how it optimizes your code. like, it's giving "I have 99 problems and they're all flags". here's the entire list, no skips, 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-control-flow
-fno-cmm-control-flow
-fcmm-elim-common-blocks
-fno-cmm-elim-common-blocks
-fcmm-sink
-fno-cmm-sink
-fcmm-static-pred
-fno-cmm-static-pred
-fcore-constant-folding
-fno-core-constant-folding
-fcpr-anal
-fno-cpr-anal
-fcross-module-specialise
-fno-cross-module-specialise
-fcse
-fno-cse
-fdicts-cheap
-fno-dicts-cheap
-fdicts-strict
-fno-dicts-strict
-fdmd-tx-dict-sel
-fno-dmd-tx-dict-sel
-fdmd-unbox-width=⟨n⟩
-fdo-eta-reduction
-fno-do-eta-reduction
-fdo-lambda-eta-expansion
-fno-do-lambda-eta-expansion
-feager-blackholing
-fenable-rewrite-rules
-fno-enable-rewrite-rules
-fexcess-precision
-fno-excess-precision
-fexitification
-fno-exitification
-fexpose-all-unfoldings
-fno-expose-all-unfoldings
-ffloat-in
-fno-float-in
-ffull-laziness
-fno-full-laziness
-ffun-to-thunk
-fno-fun-to-thunk
-fignore-asserts
-fno-ignore-asserts
-fignore-interface-pragmas
-fno-ignore-interface-pragmas
-finline-generics
-fno-inline-generics
-finline-generics-aggressively
-fno-inline-generics-aggressively
-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
-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
-fstg-lift-lams-non-rec-args-any
-fstg-lift-lams-rec-args
-fstg-lift-lams-rec-args-any
-fstrictness
-fno-strictness
-fstrictness-before=⟨n⟩
-funbox-small-strict-fields
-fno-unbox-small-strict-fields
-funbox-strict-fields
-fno-unbox-strict-fields
-funfolding-case-scaling=⟨n⟩
-funfolding-case-threshold=⟨n⟩
-funfolding-creation-threshold=⟨n⟩
-funfolding-dict-discount=⟨n⟩
-funfolding-fun-discount=⟨n⟩
-funfolding-keeness-factor=⟨n⟩
-funfolding-use-threshold=⟨n⟩
-fworker-wrapper
-fworker-wrapper-cbv
fr fr, that's a lot. but every single one is here, exactly as written. don't @ me. 💅
🌈 Optimization levels 🌈
these are the classic -O levels. yes, the original lists -O0 twice (and again later), which is giving typo energy but we're not fixing it, periodt.
-O
-O1
-O0
-O0
-O2
-O0
-O⟨n⟩
-O0
🎀 Package options 🎀
all about packages, package databases, trust, and hiding stuff. if you're juggling multiple package environments, these are your besties.
-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 🦋
when you want to stop at a certain phase of compilation, these flags let you do exactly that. like hitting pause on a movie but for your code.
--merge-objs
-C
-c
-E
-F
-S
-x ⟨suffix⟩
💅 Overriding external programs 💅
if you have a specific tool you want GHC to use instead of the default, these -pgm* flags are your main character moment. go off.
-pgma ⟨cmd⟩
-pgmc ⟨cmd⟩
-pgmcxx ⟨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 ✨
pass options directly to specific phases. it's giving "I know exactly what I'm doing" energy.
-opta ⟨option⟩
-optc ⟨option⟩
-optcxx ⟨option⟩
-optdll ⟨option⟩
-optF ⟨option⟩
-opti ⟨option⟩
-optL ⟨option⟩
-optl ⟨option⟩
-optlc ⟨option⟩
-optlm ⟨option⟩
-optlo ⟨option⟩
-optP ⟨option⟩
-optwindres ⟨option⟩
-pgmc-supports-no-pie
-pgml-supports-no-pie
🔥 Platform-specific options 🔥
for when you want to use specific CPU instructions. no cap, these are the AVX/SSE/BMI flags.
-mavx
-mavx2
-mavx512cd
-mavx512er
-mavx512f
-mavx512pf
-mbmi
-mbmi2
-msse
-msse2
-msse3
-msse4
-msse4.2
🧚 Compiler plugins 🧚
plugins! because GHC is extensible like that. these let you load custom plugins and control their trust level. iconic.
-fclear-plugins
-fplugin-opt=⟨module⟩:⟨args⟩
-fplugin-trustworthy
-fplugin=⟨module⟩
-hide-all-plugin-packages
-plugin-package ⟨pkg⟩
-plugin-package-id ⟨pkg-id⟩
👑 Profiling 👑
want to know where your code is spending time? these flags are iconic for profiling. also ticky-ticky stuff, which is a whole vibe.
-auto
-auto-all
-caf-all
-fno-prof-count-entries
-fprof-count-entries
-fprof-auto
-fno-prof-auto
-fprof-auto-calls
-fno-prof-auto
-fprof-auto-exported
-fno-prof-auto
-fprof-auto-top
-fno-prof-auto
-fprof-cafs
-fno-prof-cafs
-fprof-callers=⟨name⟩
-fprof-late
-fno-prof-late
-fprof-late-inline
-fno-prof-late-inline
-fprof-manual
-fno-prof-manual
-no-auto
-no-auto-all
-no-caf-all
-prof
-ticky
-ticky-allocd
-ticky-ap-thunk
-ticky-dyn-thunk
-ticky-LNE
-ticky-tag-checks
🌸 Program coverage 🌸
HPC coverage, we love to see it. just two flags, but they're important.
-fhpc
-hpcdir⟨dir⟩
💜 Recompilation checking 💜
these control when GHC decides to recompile stuff. sometimes you want to force it, sometimes you want to ignore changes. it's a whole thing.
-fforce-recomp
-fno-force-recomp
-fignore-hpc-changes
-fno-ignore-hpc-changes
-fignore-optim-changes
-fno-ignore-optim-changes
🍓 Redirecting output 🍓
where do you want your files to go? these flags tell GHC. so many suffixes and directories, it's giving organizational queen.
--exclude-module=⟨file⟩
-ddump-mod-cycles
-dep-makefile ⟨file⟩
-dep-suffix ⟨suffix⟩
-dumpdir ⟨dir⟩
-dynhisuf ⟨suffix⟩
-dyno ⟨file⟩
-dynohi ⟨file⟩
-dynosuf ⟨suffix⟩
-hcsuf ⟨suffix⟩
-hidir ⟨dir⟩
-hiedir ⟨dir⟩
-hiesuf ⟨suffix⟩
-hisuf ⟨suffix⟩
-include-cpp-deps
-include-pkg-deps
-o ⟨file⟩
-odir ⟨dir⟩
-ohi ⟨file⟩
-osuf ⟨suffix⟩
-outputdir ⟨dir⟩
-stubdir ⟨dir⟩
🫶 Temporary files 🫶
just one flag, but it's important. where do your temp files go? bestie, you decide.
-tmpdir ⟨dir⟩
💖 Verbosity options 💖
so many flags about how much GHC talks to you, and how it formats errors, hole fits, and all that jazz. this is the motherlode. 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-show-type-of-hole-fits
-fsort-by-size-hole-fits
-fno-sort-by-size-hole-fits
-fsort-by-subsumption-hole-fits
-fno-sort-by-subsumption-hole-fits
-funclutter-valid-hole-fits
-Rghc-timing
-v
-v⟨n⟩
bestie, we're not done yet. more parts incoming. stay tuned. 💖
⚠️ WARNINGS ⚠️
okay bestie. sit down. hydrate. this is the warning-flag MOTHERLODE and it is LONG 💀 GHC has opinions about ur code and it will share ALL of them, and each opinion has a flag. here's every single one, in order, no skips, no cap.
-fdefer-out-of-scope-variables,-fno-defer-out-of-scope-variables— the out-of-scope-variables duo, on / off 💫-fdefer-type-errors,-fno-defer-type-errors— type errors but make it ✨deferred✨ (or don't, ur call)-fdefer-typed-holes,-fno-defer-typed-holes— same energy, but for typed holes 🕳️-fenable-th-splice-warnings,-fno-enable-th-splice-warnings— TH splice warnings: enabled, or not, bestie-fhelpful-errors,-fno-helpful-errors— helpful errors?? groundbreaking 🫶 (or turn 'em off, live dangerously)-fmax-pmcheck-models=⟨n⟩— cap the pmcheck models at n ⭐-fshow-warning-groups,-fno-show-warning-groups— show the warning groups, or keep them lowkey-fvia-C— the classic C route 🛣️-W— just-W, she's minimal-w— just-w, lowercase, tiny, powerful-w— yes she's back, she's listed again 💅-Wall— the icon, the moment, the legend 👑-w— third time's the charm, no cap, she's here again
-Wall-missed-specialisations,-Wno-all-missed-specialisations— missed specialisations, the whole set ✨-Wall-missed-specializations,-Wno-all-missed-specializations— same thing, American spelling, because of course 🇺🇸-Wambiguous-fields— ambiguous fields getting called OUT-Wauto-orphans— orphans!! automatic ones!! 😭-Wcompat,-Wno-compat— the compat duo-Wcompat-unqualified-imports,-Wno-compat-unqualified-imports— compat, but specifically for unqualified imports-Wcpp-undef— cpp undef vibes-Wdefault— the default set 🎀-Wdeferred-out-of-scope-variables,-Wno-deferred-out-of-scope-variables— deferred out-of-scope variables, on / off-Wdeferred-type-errors,-Wno-deferred-type-errors— deferred type errors, on / off-Wdeprecated-flags,-Wno-deprecated-flags— deprecated flags get flagged 🚩-Wdeprecations,-Wno-deprecations— deprecations in general-Wderiving-defaults,-Wno-deriving-defaults— deriving defaults-Wderiving-typeable,-Wno-deriving-typeable— derivingTypeable-Wdodgy-exports,-Wno-dodgy-exports— dodgy exports 👀-Wdodgy-foreign-imports,-Wno-dodgy-foreign-imports— dodgy foreign imports 👀-Wdodgy-imports,-Wno-dodgy-imports— dodgy imports 👀-Wduplicate-constraints,-Wno-duplicate-constraints— duplicate constraints, caught-Wduplicate-exports,-Wno-duplicate-exports— duplicate exports, caught-Wempty-enumerations,-Wno-empty-enumerations— empty enumerations-Werror— everything's an error now, good luck bestie 💀-Wwarn— everything's a warning instead-Weverything— LITERALLY EVERYTHING 🔥-Wextra— the extra ones-w— her again ✨
-Wforall-identifier,-Wno-forall-identifier— theforallidentifier pair-Wgadt-mono-local-binds,-Wno-gadt-mono-local-binds— GADT mono local binds-Whi-shadowing,-Wno-hi-shadowing—.hishadowing, scandalous-Widentities,-Wno-identities— identities-Wimplicit-kind-vars,-Wno-implicit-kind-vars— implicit kind vars-Wimplicit-lift,-Wno-implicit-lift— implicit lift-Wimplicit-prelude,-Wno-implicit-prelude— implicitPrelude-Winaccessible-code,-Wno-inaccessible-code— inaccessible code-Wincomplete-patterns,-Wno-incomplete-patterns— incomplete patterns 😭-Wincomplete-record-updates,-Wno-incomplete-record-updates— incomplete record updates-Wincomplete-uni-patterns,-Wno-incomplete-uni-patterns— incomplete uni-patterns-Winferred-safe-imports,-Wno-inferred-safe-imports— inferred safe imports-Winline-rule-shadowing,-Wno-inline-rule-shadowing— inline rule shadowing-Winvalid-haddock,-Wno-invalid-haddock— invalid Haddock 📝-Wmisplaced-pragmas,-Wno-misplaced-pragmas— pragmas in the wrong spot-Wmissed-extra-shared-lib,-Wno-missed-extra-shared-lib— missed extra shared lib-Wmissed-specialisations,-Wno-missed-specialisations— missed specialisations-Wmissed-specializations,-Wno-missed-specializations— missed specializations (the other spelling 💅)
-Wmissing-deriving-strategies,-Wno-missing-deriving-strategies— missing deriving strategies-Wmissing-export-lists,-Wno-missing-export-lists— missing export lists-Wmissing-exported-pattern-synonym-signatures,-Wno-missing-exported-pattern-synonym-signatures— the long one. say it with ur chest 🗣️-Wmissing-exported-signatures,-Wno-missing-exported-signatures— missing exported signatures-Wmissing-exported-sigs,-Wno-missing-exported-sigs— same vibe, shorter name-Wmissing-fields,-Wno-missing-fields— missing fields-Wmissing-home-modules,-Wno-missing-home-modules— missing home modules 🏠-Wmissing-import-lists,-Wno-missing-import-lists— missing import lists-Wmissing-kind-signatures,-Wno-missing-kind-signatures— missing kind signatures-Wmissing-local-signatures,-Wno-missing-local-signatures— missing local signatures-Wmissing-local-sigs,-Wno-missing-local-sigs— the short version of that-Wmissing-methods,-Wno-missing-methods— missing methods-Wmissing-monadfail-instances,-Wno-missing-monadfail-instances— missingMonadFailinstances-Wmissing-pattern-synonym-signatures,-Wno-missing-pattern-synonym-signatures— missing pattern synonym signatures-Wmissing-safe-haskell-mode,-Wno-missing-safe-haskell-mode— missing Safe Haskell mode-Wmissing-signatures,-Wno-missing-signatures— missing signatures-Wmissing-space-after-bang— missing space after a bang ❗-Wmonomorphism-restriction,-Wno-monomorphism-restriction— the monomorphism restriction, always a topic-Wname-shadowing,-Wno-name-shadowing— name shadowing, the classic
-Wno-compat,-Wcompat— here they are again, in the other order, because why not 🤡-Wnoncanonical-monad-instances,-Wno-noncanonical-monad-instances— noncanonicalMonadinstances-Wnoncanonical-monadfail-instances,-Wno-noncanonical-monadfail-instances— noncanonicalMonadFailinstances-Wnoncanonical-monoid-instances,-Wno-noncanonical-monoid-instances— noncanonicalMonoidinstances-Wnot— not. that's it. that's the flag.-Woperator-whitespace,-Wno-operator-whitespace— operator whitespace 💅-Woperator-whitespace-ext-conflict,-Wno-operator-whitespace-ext-conflict— same but for extension conflicts-Worphans,-Wno-orphans— orphans 🥺-Woverflowed-literals,-Wno-overflowed-literals— overflowed literals-Woverlapping-patterns,-Wno-overlapping-patterns— overlapping patterns-Wpartial-fields,-Wno-partial-fields— partial fields-Wpartial-type-signatures,-Wno-partial-type-signatures— partial type signatures-Wprepositive-qualified-module,-Wno-prepositive-qualified-module— prepositive qualified module-Wredundant-bang-patterns,-Wno-redundant-bang-patterns— redundant bang patterns-Wredundant-constraints,-Wno-redundant-constraints— redundant constraints-Wredundant-record-wildcards,-Wno-redundant-record-wildcards— redundant record wildcards-Wredundant-strictness-flags,-Wno-redundant-strictness-flags— redundant strictness flags
-Wsafe,-Wno-safe— the safe pair-Wsemigroup,-Wno-semigroup— semigroup stuff-Wsimplifiable-class-constraints,-Wno-simplifiable-class-constraints— simplifiable class constraints-Wstar-binder,-Wno-star-binder— star binder ⭐-Wstar-is-type,-Wno-star-is-type— star is type ⭐-Wtabs,-Wno-tabs— TABS. in ur source. she WILL notice 😤-Wtrustworthy-safe,-Wno-safe— trustworthy safe, plus-Wno-safeshowing up AGAIN (we been knew)-Wtype-defaults,-Wno-type-defaults— type defaults-Wtype-equality-out-of-scope,-Wno-type-equality-out-of-scope— type equality, out of scope-Wtype-equality-requires-operators,-Wno-type-equality-requires-operators— type equality requires operators-Wtyped-holes,-Wno-typed-holes— typed holes 🕳️-Wunbanged-strict-patterns,-Wno-unbanged-strict-patterns— unbanged strict patterns-Wunicode-bidirectional-format-characters— unicode bidirectional format characters, the sneaky ones 👻-Wunrecognised-pragmas,-Wno-unrecognised-pragmas— unrecognised pragmas-Wunrecognised-warning-flags,-Wno-unrecognised-warning-flags— unrecognised warning flags, very meta of her-Wunsafe,-Wno-unsafe— unsafe-Wunsupported-calling-conventions,-Wno-unsupported-calling-conventions— unsupported calling conventions-Wunsupported-llvm-version— unsupported LLVM version-Wno-monomorphism-restriction— and-Wno-monomorphism-restrictionis back for round two 🥊-Wunticked-promoted-constructors,-Wno-unticked-promoted-constructors— unticked promoted constructors
-Wunused-binds,-Wno-unused-binds— unused binds-Wunused-do-bind,-Wno-unused-do-bind— unused do-bind-Wunused-foralls,-Wno-unused-foralls— unused foralls-Wunused-imports,-Wno-unused-imports— unused imports, the most relatable warning fr fr-Wunused-local-binds,-Wno-unused-local-binds— unused local binds-Wunused-matches,-Wno-unused-matches— unused matches-Wunused-packages,-Wno-unused-packages— unused packages-Wunused-pattern-binds,-Wno-unused-pattern-binds— unused pattern binds-Wunused-record-wildcards,-Wno-unused-record-wildcards— unused record wildcards-Wunused-top-binds,-Wno-unused-top-binds— unused top binds-Wunused-type-patterns,-Wno-unused-type-patterns— unused type patterns-Wwarn—-Wwarn, back again 💫-Werror—-Werror, also back again 💀-Wwarnings-deprecations,-Wno-warnings-deprecations— warnings-deprecations-Wwrong-do-bind,-Wno-wrong-do-bind— wrong do-bind, the ✨wrong✨ one
🛠️ CODE GENERATION 🛠️
how do we turn this beautiful Haskell into something a computer actually runs?? pick ur fighter, bestie 👑
-dynamic-too— Build dynamic object files as well as static object files during compilation ✨ two for the price of one-fasm— Use the native code generator-fbyte-code— Generate byte-code-fexpose-internal-symbols— Produce symbols for all functions, including internal functions.-fexternal-dynamic-refs— Generate code for linking against dynamic libraries-fllvm— Compile using the LLVM code generator-fno-code— Omit code generation (no code?? she said no code 💅)-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-split-objs— Split generated object files into smaller files
🔍 DEBUGGING THE COMPILER 🔍
when the compiler is doing too much and u need to see EVERYTHING. this is the backstage pass, the all-access tour, the unhinged levels of detail 🫶
-dasm-lint— ASM pass sanity checking-dcmm-lint— C-- pass sanity checking-dcore-lint— Turn on internal sanity checking-ddump-asm— Dump final assembly-ddump-asm-conflicts— Dump register conflicts from the register allocator.-ddump-asm-liveness— Dump assembly augmented with register liveness-ddump-asm-native— Dump initial assembly-ddump-asm-regalloc— Dump the result of register allocation-ddump-asm-regalloc-stages— Dump the build/spill stages of the-fregs-graphregister allocator.-ddump-asm-stats— Dump statistics from the register allocator.-ddump-bcos— Dump interpreter byte code-ddump-c-backend— Dump C code produced by the C (unregisterised) backend.-ddump-call-arity— Dump output of the call arity analysis pass.-ddump-cfg-weights— Dump the assumed weights of the CFG.-ddump-cmm— Dump the final C-- output-ddump-cmm-caf— Dump the results of the C-- CAF analysis pass.-ddump-cmm-cbe— Dump the results of common block elimination-ddump-cmm-cfg— Dump the results of the C-- control flow optimisation pass.-ddump-cmm-cps— Dump the results of the CPS pass-ddump-cmm-from-stg— Dump STG-to-C-- output-ddump-cmm-info— Dump the results of the C-- info table augmentation pass.-ddump-cmm-opt— Dump the results of C-- to C-- optimising passes-ddump-cmm-proc— Dump the results of proc-point analysis-ddump-cmm-procmap— Dump the results of the C-- proc-point map pass.-ddump-cmm-raw— 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-cs-trace— Trace constraint solver-ddump-cse— Dump CSE output-ddump-debug— Dump generated DWARF debug information-ddump-deriv— Dump deriving output-ddump-ds— Dump desugarer output.-ddump-ec-trace— Trace exhaustiveness checker-ddump-exitify— Dump output of the exitification pass.-ddump-faststrings— Dump the whole FastString table when finished-ddump-file-prefix=⟨str⟩— Set the prefix of the filenames used for debugging output.-ddump-foreign— Dump foreign export stubs-ddump-hie— Dump the hie file syntax tree-ddump-hpc— An alias for-ddump-ticked.-ddump-if-trace— Trace interface files-ddump-inlinings— Dump inlinings performed by the simplifier.-ddump-json— Dump error messages as JSON documents-ddump-late-cc— Dump core with late cost centres added-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— dumps what the parser spat out, as a whole syntax tree 🌳-ddump-prep— dumps prepared core-ddump-rn— dumps the renamer's output-ddump-rn-ast— dumps the renamer's output, but as a syntax tree-ddump-rn-stats— renamer stats, bestie 📊-ddump-rn-trace— traces the renamer, step by step-ddump-rtti— traces runtime type inference-ddump-rule-firings— dumps info on rule firings-ddump-rule-rewrites— dumps detailed rule firing info (the deluxe version 💅)-ddump-rules— dumps your rewrite rules-ddump-simpl— dumps the final simplifier output-ddump-simpl-iterations— dumps output from each simplifier iteration, one by one-ddump-simpl-stats— simplifier stats-ddump-simpl-trace— dumps the trace messages inside the simplifier-ddump-spec— dumps the specialiser's output-ddump-splices— dumps the TH spliced expressions and what they evaluate to 🪄-ddump-stg— (deprecated ⚠️) it's just an alias for-ddump-stg-from-core-ddump-stg-cg— shows the output after Stg2Stg-ddump-stg-final— shows the output of the very last STG pass-ddump-stg-from-core— shows the CoreToStg output-ddump-stg-tags— shows the output of the tag inference pass-ddump-stg-unarised— shows unarised STG-ddump-str-signatures— dumps top-level demand signatures-ddump-stranal— dumps demand analysis output-ddump-tc— dumps typechecker output-ddump-tc-ast— dumps typechecker output as a syntax tree-ddump-tc-trace— traces the typechecker-ddump-ticked— dumps the code that's been instrumented by HPC (Observing Code Coverage) 👀-ddump-timings— dumps per-pass timing and allocation statistics-ddump-to-file— dumps go to files instead of stdout-ddump-types— dumps type signatures-ddump-verbose-inlinings— dumps all the inlinings that got considered-ddump-view-pattern-commoning— dumps the commoned view patterns-ddump-worker-wrapper— dumps worker-wrapper output-dfaststring-stats— shows stats for fast string usage once it's done-dhex-word-literals— prints values of typeWord#in hexadecimal-dinitial-unique=⟨s⟩— starts UniqSupply allocation from⟨s⟩-dinline-check=⟨str⟩— dumps info about inlining decisions-dkeep-comments— keeps comments in the parser. super handy in combination with-ddump-parsed-ast💬-dlinear-core-lint— turns on internal sanity checking-dlint— enables several common internal sanity checkers-dno-debug-output— suppresses unsolicited debugging output-dno-typeable-binds— doesn't generate bindings for Typeable methods-dppr-case-as-let— prints single-alternative case expressions as strict lets-dppr-cols=⟨n⟩— sets the width of debugging output. like, for example-dppr-cols200📏-dppr-debug— turns on debug printing (aka more verbose, hold onto your wig)-dppr-user-length— sets the depth for printing expressions in error messages-drule-check=⟨str⟩— dumps info about potential rule application-dshow-passes— prints out each pass name as it happens-dstg-lint— STG pass sanity checking-dsuppress-all— in dumps, suppresses everything that's suppressible (except for uniques) 🫣-dsuppress-coercion-types— suppresses printing coercion types in Core dumps to keep them shorter-dsuppress-coercions— suppresses printing coercions in Core dumps to keep them shorter-dsuppress-core-sizes— suppresses printing core size stats per binding (since9.4)-dsuppress-idinfo— suppresses the extended info about identifiers where they're bound-dsuppress-module-prefixes— suppresses printing the module qualification prefixes-dsuppress-stg-free-vars— suppresses printing the closure free variable lists in STG output-dsuppress-stg-reps— suppresses rep annotations on STG args-dsuppress-ticks— suppresses "ticks" in the pretty-printer output-dsuppress-timestamps— suppresses timestamps in dumps-dsuppress-type-applications— suppresses type applications-dsuppress-type-signatures— suppresses type signatures-dsuppress-unfoldings— suppresses printing the stable unfolding of a variable at its binding site-dsuppress-uniques— suppresses printing uniques in debug output (makesdiffway easier, iykyk)-dsuppress-var-kinds— suppresses printing variable kinds-dtag-inference-checks— affirms that tag inference results are correct at runtime-dth-dec-file— dumps evaluated TH declarations into*.th.hsfiles-dunique-increment=⟨i⟩— sets the increment for the generated Unique's to⟨i⟩-dverbose-core2core— shows output from each core-to-core pass-dverbose-stg2stg— shows output from each STG-to-STG pass-falignment-sanitisation— compiles with alignment checks for all info table dereferences-fcatch-nonexhaustive-cases— adds a default error alternative to case expressions that don't have a default alternative-fcheck-prim-bounds— instruments array primops with bounds checks-fdistinct-constructor-tables— generates a fresh info table for each usage of a data constructor-finfo-table-map— embeds a lookup table in the generated binary that maps the address of an info table to the source position the closure originated from 🗺️-fllvm-fill-undef-with-garbage— tells LLVM to fill dead STG registers with garbage-fproc-alignment— aligns functions at the given boundary-g— produces DWARF debug information in compiled object files.⟨n⟩can be0,1, or2, and higher numbers produce richer output. If⟨n⟩is omitted, level2is assumed
✨ C pre-processor ✨
-cpp— runs the C pre-processor on Haskell source files-D⟨symbol⟩[=⟨value⟩]— defines a symbol in the C pre-processor-I⟨dir⟩— adds⟨dir⟩to the directory search list for#includefiles-U⟨symbol⟩— undefines a symbol in the C pre-processor
✨ Finding imports ✨
-i— empties the import directory list-i⟨dir⟩[:⟨dir⟩]*— adds⟨dir⟩,⟨dir2⟩, etc. to the import path
✨ Interactive mode ✨
-fbreak-on-error— breaks on uncaught exceptions and errors-fbreak-on-exception— breaks on any exception thrown-fghci-hist-size=⟨n⟩— sets how many entries GHCi keeps for:history. check out The GHCi Debugger 📜-fghci-leak-check— (debugging only) checks for space leaks when loading new modules in GHCi-fimplicit-import-qualified— puts qualified identifiers in scope for every loaded module-flocal-ghci-history— uses the current directory for the GHCi command history file.ghci-history-fno-it— no longer sets the special variableit-fprint-bind-result— turns on printing of binding results in GHCi-fprint-evld-with-show— tells:printto useShowinstances where possible-fshow-loaded-modules— shows the names of modules GHCi loaded after a:loadcommand-ghci-script— reads additional.ghcifiles-ignore-dot-ghci— disables reading of.ghcifiles-interactive-print ⟨name⟩— picks 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.hcfiles-keep-hi-files— retains intermediate.hifiles (this one's the default)-keep-hscpp-file— retains intermediate.hscppfiles-keep-llvm-file— retains intermediate LLVM.llfiles. implies-fllvm-keep-o-files— retains intermediate.ofiles (also the default)-keep-s-file— retains intermediate.sfiles-keep-tmp-files— retains all the intermediate temporary files 🗂️
✨ 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-XDeepSubsumption— enables deep subsumption-XDefaultSignatures— enables default signatures-XDeriveAnyClass— enables deriving for any class-XDeriveDataTypeable— enables deriving for theDataclass. implied by the (deprecated)AutoDeriveTypeable-XDeriveFoldable— enables deriving for theFoldableclass. implied byDeriveTraversable-XDeriveFunctor— enables deriving for theFunctorclass. implied byDeriveTraversable-XDeriveGeneric— enables deriving for theGenericclass-XDeriveLift— enables deriving for theLiftclass-XDeriveTraversable— enables deriving for theTraversableclass. impliesDeriveFunctorandDeriveFoldable-XDerivingStrategies— enables deriving strategies-XDerivingVia— enables deriving instances via types of the same runtime representation. impliesDerivingStrategies-XDisambiguateRecordFields— enables record field disambiguation. implied byRecordWildCards-XDuplicateRecordFields— allows defining record types with identically-named fields-XEmptyCase— allows empty case alternatives-XEmptyDataDecls— allows defining empty data types
okay bestie, we're still deep in the language-extension buffet — next chunk coming right up, E through V, nothing skipped, nothing merged 💖
-XEmptyDataDeriving— lets you derive instances of the standard type classes for empty data types 🫙-XExistentialQuantification— Enable liberalised type synonyms.-XExplicitForAll— turns on explicit universal quantification ✨. It gets implied byScopedTypeVariables,LiberalTypeSynonyms,RankNTypesandExistentialQuantification.-XExplicitNamespaces— lets you use the keywordtypeto specify the namespace of entries in imports and exports (Explicit namespaces in import/export). Implied byTypeOperatorsandTypeFamilies.-XExtendedDefaultRules— uses GHCi's extended default rules inside a normal module 👑-XFieldSelectors— control the visibility of field selector functions.-XFlexibleContexts— removes some restrictions on class contexts 💅-XFlexibleInstances— enables flexible instances. ImpliesTypeSynonymInstances.-XForeignFunctionInterface— enables the foreign function interface 🌉-XFunctionalDependencies— enables functional dependencies. ImpliesMultiParamTypeClasses.-XGADTs— enables generalised algebraic data types. ImpliesGADTSyntaxandMonoLocalBinds.-XGADTSyntax— enables generalised algebraic data type syntax.-XGeneralisedNewtypeDeriving— enables newtype deriving.-XGeneralizedNewtypeDeriving— enables newtype deriving.-XGHC2021— use GHC's set of default language extensions from 2021 📅-XGHCForeignImportPrim— enables the prim calling convention. Intended for internal use only 🙈-XHaskell2010— use the Haskell 2010 language variant.-XHaskell98— use the Haskell 98 language variant.-XHexFloatLiterals— enables support for hexadecimal floating point literals.-XImplicitParams— enables Implicit Parameters.-XImportQualifiedPost—ImportQualifiedPostallows the syntaximport M qualified-XImpredicativeTypes— enables impredicative types. ImpliesRankNTypes.-XIncoherentInstances— enables incoherent instances. ImpliesOverlappingInstances.-XInstanceSigs— enables instance signatures.-XInterruptibleFFI— enables interruptible FFI ⚡-XKindSignatures— enables kind signatures. Implied byTypeFamiliesandPolyKinds.-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.-XMonoLocalBinds— enables do not generalise local bindings. Implied byTypeFamiliesandGADTs.-XMultiParamTypeClasses— enables multi parameter type classes. Implied byFunctionalDependencies.-XMultiWayIf— enables multi-way if-expressions.-XNamedFieldPuns— enables record puns 🎀-XNamedWildCards— enables named wildcards.-XNegativeLiterals— enables support for negative literals.-XNoImplicitPrelude— don't implicitly importPrelude. Implied byRebindableSyntax.-XNoMonomorphismRestriction— disables the monomorphism restriction.-XNondecreasingIndentation— allow nested contexts to be at the same indentation level as its enclosing context.-XNoPatternGuards— disables pattern guards. Implied byHaskell98.-XNoTraditionalRecordSyntax— disables support for traditional record syntax (as supported by Haskell 98)C {f = x}-XNPlusKPatterns— enables support for n+k patterns. Implied byHaskell98.-XNullaryTypeClasses— Deprecated, does nothing. nullary (no parameter) type classes are now enabled usingMultiParamTypeClasses.-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.-XOverloadedRecordDot— Record'.'syntax-XOverloadedRecordUpdate— Record'.'syntax record updates-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. ImpliesKindSignatures.-XPostfixOperators— enables postfix operators.-XQualifiedDo— enables qualified do-notation desugaring.-XQuantifiedConstraints— allowforallquantifiers in constraints.-XQuasiQuotes— enables quasiquotation.-XRank2Types— enables rank-2 types. Synonym forRankNTypes.-XRankNTypes— enables rank-N types. Implied byImpredicativeTypes.-XRebindableSyntax— employ rebindable syntax. ImpliesNoImplicitPrelude.-XRecordWildCards— enables record wildcards. ImpliesDisambiguateRecordFields.-XRecursiveDo— enables recursive do (mdo) notation.-XRoleAnnotations— enables role annotations.-XSafe— enable the Safe Haskell Safe mode. 🛡️-XScopedTypeVariables— enables lexically-scoped type variables.-XStandaloneDeriving— enables standalone deriving.-XStandaloneKindSignatures— allow the use of standalone kind signatures.-XStarIsType— treat*asData.Kind.Type.-XStaticPointers— enables static pointers.-XStrict— make 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— enable the Safe Haskell Trustworthy mode.-XTupleSections— enables tuple sections.-XTypeApplications— enables type application syntax in terms, patterns and types.-XTypeFamilies— enables type families. ImpliesExplicitNamespaces,KindSignatures, andMonoLocalBinds.-XTypeFamilyDependencies— enables injective type families. ImpliesTypeFamilies.-XTypeInType— Deprecated. Enable kind polymorphism and datatype promotion.-XTypeOperators— enables type operators. ImpliesExplicitNamespaces.-XTypeSynonymInstances— enables type synonyms in instance heads. Implied byFlexibleInstances.-XUnboxedSums— enables unboxed sums.-XUnboxedTuples— enables the use of unboxed tuple syntax.-XUndecidableInstances— enables undecidable instances.-XUndecidableSuperClasses— allow all superclass constraints, including those that may result in non-termination of the typechecker 😭-XUnicodeSyntax— enables unicode syntax 🌈-XUnliftedDatatypes— enables unlifted data types.-XUnliftedFFITypes— enables unlifted FFI types-XUnliftedNewtypes— enables unlifted newtypes.-XUnsafe— enable Safe Haskell Unsafe mode. 💀-XViewPatterns— enables view patterns.
🔗 Linking options 🔗
the part where your stuff actually gets glued together into a real binary, no cap 🫶
-c— stop after generating object (.o) file-debug— use the debugging runtime-dylib-install-name⟨path⟩ — set the install name (via-install_namepassed to Apple's linker), specifying the full install path of the library file. Any libraries or executables that link with it later will pick up that path as their runtime search location for it. (Darwin/OS X only) 🍎-dynamic— build dynamically-linked object files and executables-dynload— selects one of a number of modes for finding shared libraries at runtime.-eventlog— enable runtime event tracing-fcompact-unwind— instruct the linker to produce a__compact_unwindsection.-fkeep-cafs— do not garbage-collect CAFs (top-level expressions) at runtime-flink-rts— link the runtime when generating a shared or static library-fno-embed-manifest— 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-frameworkoption 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-Foption for Apple's Linker.-fuse-rpaths— set the rpath based on-Lflags-fwhole-archive-hs-libs— when linking a binary executable, this inserts the flag-Wl,--whole-archivebefore any-lflags for Haskell libraries, and-Wl,--no-whole-archiveafterwards-L⟨dir⟩ — add ⟨dir⟩ to the list of directories searched for libraries-l⟨lib⟩ — link in library ⟨lib⟩-main-is⟨thing⟩ — set main module and function 👑-no-hs-main— don't assume this program containsmain-no-link— stop after generating object (.o) file-no-pie— don't instruct the linker to produce a position-independent executable.-no-rtsopts-suggestions— don't print RTS suggestions about linking with-rtsopts[=⟨none|some|all|ignore|ignoreAll⟩].-package⟨name⟩ — expose package ⟨pkg⟩-pie— instruct the linker to produce a position-independent executable.-rdynamic— 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 -rdynamicon Linux, and-optl -export-all-symbolson Windows.
still more coming bestie, don't go anywhere 💜
-rtsopts[=⟨none|some|all|ignore|ignoreAll⟩]— okay bestie, this one controls whether the RTS behaviour can be tweaked via command-line flags and theGHCRTSenvironment variable. Usingnonemeans no RTS flags can be given;somemeans only a minimum of safe options can be given (the default);all(or no argument at all) means that all RTS flags are permitted;ignoremeans RTS flags can be given, but are treated as regular arguments and passed to the Haskell program as arguments;ignoreAllis the same asignore, butGHCRTSis also ignored.-rtsoptsdoes not affect-with-rtsoptsbehavior; flags passed via-with-rtsoptsare used regardless of-rtsopts.-shared— Generate a shared library (as opposed to an executable) 💅-split-sections— Split sections for link-time dead-code stripping ✂️-static— Use static Haskell libraries 🧊-staticlib— Generate a standalone static library (as opposed to an executable). This is useful when cross compiling. The library together with all its dependencies ends up in a single static library that can be linked against. 🫶-threaded— Use the threaded runtime 🧵-with-rtsopts=⟨opts⟩— Set the default RTS options to ⟨opts⟩.
✨ Miscellaneous options ✨
these are the little extra knobs and switches, bestie
-fexternal-interpreter— Run interpreted code in a separate process-ffamily-application-cache— Use a cache when reducing type family applications-fglasgow-exts— Deprecated. Enable most language extensions; see Controlling extensions for exactly which ones.-fno-safe-haskell— Disable Safe Haskell-ghcversion-file ⟨path to ghcversion.h⟩— (GHC as a C compiler only) Use thisghcversion.hfile-H ⟨size⟩— Set the minimum size of the heap to ⟨size⟩-hidden-module ⟨module name⟩— A module which should not be visible outside its unit.-j[⟨n⟩]— When compiling with--make, compile ⟨n⟩ modules in parallel.-reexported-module ⟨module name⟩— A module which should be reexported from this unit.-this-package-name ⟨unit-id⟩— The name of the package which this module would be part of when installed.-unit @⟨filename⟩— Specify the options to build a specific unit.-working-dir ⟨dir⟩— Specify the directory a unit is expected to be compiled in.
🎀 Modes of operation 🎀
pick your adventure, bestie
--frontend ⟨module⟩— run GHC with the given frontend plugin; see Frontend plugins for details.--help— Display help--info— display information about the compiler--interactive— Interactive mode - normally used by just runningghci; see Using GHCi for details.--make— Build a multi-module Haskell program, automatically figuring out dependencies. Likely to be much easier, and faster, than usingmake; see Usingghc --makefor details.--numeric-version— display GHC version (numeric only)--print-booter-version— display bootstrap compiler version--print-build-platform— display platform on which GHC was built--print-c-compiler-flags— C compiler flags used to build GHC--print-c-compiler-link-flags— C linker flags used to build GHC--print-debug-on— print whether GHC was built with-DDEBUG--print-global-package-db— display GHC's global package database directory--print-have-interpreter— display whether GHC was built with interactive support--print-have-native-code-generator— display whether target platform has NCG support--print-host-platform— display host platform of GHC--print-ld-flags— display linker flags used to compile GHC--print-leading-underscore— display use of leading underscores on symbol names--print-libdir— display GHC library directory--print-object-splitting-supported— display whether GHC supports object splitting--print-project-git-commit-id— display Git commit id GHC is built from--print-project-version— display GHC version--print-rts-ways— display which way RTS was built--print-stage— display stage number of GHC--print-support-smp— display whether GHC was compiled with SMP support--print-tables-next-to-code— display whether GHC was compiled with--enable-tables-next-to-code--print-target-platform— display target platform of GHC--print-unregisterised— display whether this GHC was built in unregisterised mode--run ⟨file⟩— Run a Haskell program.--show-iface ⟨file⟩— display the contents of an interface file.--show-options— display the supported command line options--supported-extensions— display the supported language extensions--version— display GHC version-e ⟨expr⟩— Evaluate expr; see Expression evaluation mode for details.-M— generate dependency information suitable for use in a Makefile; see Dependency generation for details.-shared— Create a shared object.
💖 Individual optimizations 💖
the optimizer menu, bestie — every single one is here, no skips
-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-control-flow— Enable control flow optimisation in the Cmm backend. Implied by-O.-fcmm-elim-common-blocks— Enable Cmm common block elimination. Implied by-O.-fcmm-sink— Enable Cmm sinking. Implied by-O.-fcmm-static-pred— Enable static control flow prediction. Implied by-O.-fcore-constant-folding— Enable constant folding in Core. Implied by-O.-fcpr-anal— Turn on Constructed Product Result analysis. Implied by-O.-fcross-module-specialise— Turn on specialisation of overloaded functions imported from other modules.-fcse— Enable common sub-expression elimination. Implied by-O.-fdicts-cheap— Make dictionary-valued expressions seem cheap to the optimiser.-fdicts-strict— Make dictionaries strict. Implied by-O2.-fdmd-tx-dict-sel— (deprecated) Use a special demand transformer for dictionary selectors.-fdmd-unbox-width=⟨n⟩— default:3. Boxity analysis pretends that returned records with this many fields can be unboxed.-fdo-eta-reduction— Enable eta-reduction. Implied by-O.-fdo-lambda-eta-expansion— Enable lambda eta-expansion. Always enabled by default.-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— (deprecated) superseded by-ffull-laziness.-fignore-asserts— Ignore assertions in the source. Implied by-O.-fignore-interface-pragmas— Ignore pragmas in interface files. Implied by-O0only.-finline-generics— Annotate methods of derivedGenericandGeneric1instances withINLINE[1]pragmas based on heuristics. Implied by-O.-finline-generics-aggressively— Annotate methods of all derivedGenericandGeneric1instances withINLINE[1]pragmas.-flate-dmd-anal— Run demand analysis again, at the end of the simplification pipeline-flate-specialise— Run a late specialisation pass-fliberate-case— Turn on the liberate-case transformation. Implied by-O2.-fliberate-case-threshold=⟨n⟩— default:2000. Set the size threshold for the liberate-case transformation to ⟨n⟩-fllvm-pass-vectors-in-regs— (deprecated) Does nothing-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. Inlinememcpycalls if they would generate no more than ⟨n⟩ pseudo instructions.-fmax-inline-memset-insns=⟨n⟩— default:32. Inlinememsetcalls if they would generate no more than ⟨n⟩ pseudo instructions-fmax-simplifier-iterations=⟨n⟩— default:4. Set the max iterations for the simplifier.-fmax-uncovered-patterns=⟨n⟩— default:4. Set the maximum number of patterns to display in warnings about non-exhaustive ones.-fmax-worker-args=⟨n⟩— default:10. Maximum number of value arguments for a worker.-fno-opt-coercion— Turn off the coercion optimiser-fno-pre-inlining— Turn off pre-inlining-fno-state-hack— Turn off the state hack whereby any lambda with a real-world state token as argument is considered to be single-entry. Hence OK to inline things inside it.-fomit-interface-pragmas— Don't generate interface pragmas. Implied by-O0only.-fomit-yields— Omit heap checks when no allocation is being performed.-foptimal-applicative-do— Use a slower but better algorithm forApplicativeDo-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.
-fregs-iterative— bestie, this makes the native code generator use the iterative coalescing graph colouring register allocator. It's giving very fancy algorithm energy 💅-fsimpl-tick-factor=⟨n⟩— default:100. Sets the percentage factor for simplifier ticks.-fsimplifier-phases=⟨n⟩— default:2. Sets the number of phases for the simplifier. Ngl this one gets ignored when you're on-O0, so don't stress about it there 🙈-fsolve-constant-dicts— when solving constraints, it tries to eagerly solve super classes using whatever dictionaries are available. Slay.-fspec-constr— turns on the SpecConstr transformation. It's implied by-O2. ✨-fspec-constr-count=⟨n⟩— default:3.*Sets ⟨n⟩ as the maximum number of specialisations that will get created for any one function by the SpecConstr transformation.-fspec-constr-keen— specialise a call with an explicit constructor argument, even if that argument is not scrutinised in the body of the function. Obsessed with the commitment honestly 💖-fspec-constr-threshold=⟨n⟩— default:2000. Sets the size threshold for the SpecConstr transformation to ⟨n⟩.-fspecialise— turns on specialisation of overloaded functions. Implied by-O. 🎀-fspecialise-aggressively— turns on specialisation of overloaded functions regardless of size, if unfolding is available. It's giving no-chill, and we respect it.-fstatic-argument-transformation— turns on the static argument transformation.-fstg-cse— enables common sub-expression elimination on the STG intermediate language.-fstg-lift-lams— enables late lambda lifting on the STG intermediate language. Implied by-O2. 🦋-fstg-lift-lams-known— allows turning known into unknown calls while performing late lambda lifting.-fstg-lift-lams-non-rec-args— 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— turns on demand analysis. Implied by-O. Implies-fworker-wrapper. The pipeline is pipelining 😭-fstrictness-before=⟨n⟩— runs an additional demand analysis before simplifier phase ⟨n⟩.-funbox-small-strict-fields— flattens strict constructor fields with a pointer-sized representation. Implied by-O.-funbox-strict-fields— flattens strict constructor fields.-funfolding-case-scaling=⟨n⟩— default:30. Applies a penalty of(inlining_cost * 1/n)for each level of case nesting.-funfolding-case-threshold=⟨n⟩— default:2. Reduces inlining for cases nested deeper than n.-funfolding-creation-threshold=⟨n⟩— default:750. Tweak unfolding settings. ✨-funfolding-dict-discount=⟨n⟩— default:30. Tweak unfolding settings.-funfolding-fun-discount=⟨n⟩— default:60. Tweak unfolding settings.-funfolding-keeness-factor=⟨n⟩— bestie this one has been deprecated in GHC 9.0.1. Rest in peace 🪦 (spelled exactly like that too, we don't make the rules)-funfolding-use-threshold=⟨n⟩— default:80. Tweak unfolding settings.-fworker-wrapper— enables the worker/wrapper transformation. 👑-fworker-wrapper-cbv— enables w/w splits for wrappers whos sole purpose is evaluating arguments.
🌈 Optimization levels 🌈
-O— enable level 1 optimisations. The glow-up begins 💖-O0— disable optimisations (this is the default, no cap).-O2— enable level 2 optimisations. Main character mode 🔥-O⟨n⟩— any-Onwhere n > 2 is the same as-O2. So like,-O5? Still just-O2babe 💅
📦 Package options 📦
-clear-package-db— clears the package db stack. Poof, gone 🫶-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— enables the Safe Haskell trusted package requirement for trustworthy modules.-global-package-db— adds the global package db to the stack.-hide-all-packages— hides all packages by default.-hide-package ⟨pkg⟩— hides package ⟨pkg⟩.-ignore-package ⟨pkg⟩— ignores package ⟨pkg⟩. Not the same as hiding, bestie, don't mix them up 🙈-no-auto-link-packages— doesn't automatically link in thebaseandrtspackages.-no-global-package-db— removes the global package db from the stack.-no-user-package-db— removes the user's package db from the stack.-package ⟨pkg⟩— exposes package ⟨pkg⟩. Come through ✨-package-db ⟨file⟩— adds ⟨file⟩ to the package db stack.-package-env ⟨file⟩|⟨name⟩— uses the specified package environment.-package-id ⟨unit-id⟩— exposes a package by id ⟨unit-id⟩.-this-unit-id ⟨unit-id⟩— compiles to be part of unit (i.e. package) ⟨unit-id⟩.-trust ⟨pkg⟩— exposes package ⟨pkg⟩ and sets it to be trusted. See Safe Haskell.-user-package-db— adds the user's package db to the stack.
🛠️ Phases of compilation 🛠️
--merge-objs— merge a set of objects into a GHCi library.-C— stop after generating C (.hcfile).-c— stop after generating object (.o) file.-E— stop after preprocessing (.hsppfile).-F— enables the use of a pre-processor (set with-pgmF ⟨cmd⟩).-S— stop after generating assembly (.sfile).-x ⟨suffix⟩— override default behaviour for source files.
🌸 Overriding external programs 🌸
-pgma ⟨cmd⟩— use ⟨cmd⟩ as the assembler.-pgmc ⟨cmd⟩— use ⟨cmd⟩ as the C compiler.-pgmcxx ⟨cmd⟩— use ⟨cmd⟩ as the C++ compiler.-pgmdll ⟨cmd⟩— use ⟨cmd⟩ as the DLL generator.-pgmF ⟨cmd⟩— use ⟨cmd⟩ as the pre-processor (with-Fonly).-pgmi ⟨cmd⟩— use ⟨cmd⟩ as the external interpreter command.-pgminstall_name_tool ⟨cmd⟩— use ⟨cmd⟩ as the program to inject runpath into mach-o dylibs on macOS.-pgmL ⟨cmd⟩— use ⟨cmd⟩ as the literate pre-processor.-pgml ⟨cmd⟩— use ⟨cmd⟩ as the linker. Yes, capitalLvs lowercaselmatters here — one character and it's a whole different job 💀-pgmlc ⟨cmd⟩— use ⟨cmd⟩ as the LLVM compiler.-pgmlibtool ⟨cmd⟩— use ⟨cmd⟩ as the command for libtool (with-staticlibonly).-pgmlm ⟨cmd⟩— use ⟨cmd⟩ as the linker when merging object files.-pgmlo ⟨cmd⟩— use ⟨cmd⟩ as the LLVM optimiser.-pgmotool ⟨cmd⟩— use ⟨cmd⟩ as the program to inspect mach-o dylibs on macOS.-pgmP ⟨cmd⟩— use ⟨cmd⟩ as the C pre-processor (with-cpponly).-pgms ⟨cmd⟩— use ⟨cmd⟩ as the splitter.-pgmwindres ⟨cmd⟩— use ⟨cmd⟩ as the program for embedding manifests on Windows.
💜 Phase-specific options 💜
-opta ⟨option⟩— pass ⟨option⟩ to the assembler.-optc ⟨option⟩— pass ⟨option⟩ to the C compiler.-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-cpponly).-optwindres ⟨option⟩— pass ⟨option⟩ to windres.-pgmc-supports-no-pie— (deprecated) indicates that the linker supports-no-pie.-pgml-supports-no-pie— indicates that the linker supports-no-pie.
💻 Platform-specific options 💻
-mavx— (x86 only) enable support for AVX SIMD extensions.-mavx2— (x86 only) enable support for AVX2 SIMD extensions.-mavx512cd— (x86 only) enable support for AVX512-CD SIMD extensions.-mavx512er— (x86 only) enable support for AVX512-ER SIMD extensions.-mavx512f— (x86 only) enable support for AVX512-F SIMD extensions.-mavx512pf— (x86 only) enable support for AVX512-PF SIMD extensions.-mbmi— (x86 only) use BMI1 for bit manipulation operations.-mbmi2— (x86 only) use BMI2 for bit manipulation operations.-msse— (x86 only) use SSE for floating-point operations.-msse2— (x86 only) use SSE2 for floating-point operations.-msse3— (x86 only) use SSE3 for floating-point operations.-msse4— (x86 only) use SSE4 for floating-point operations.-msse4.2— (x86 only) use SSE4.2 for floating-point operations.
all of these are x86 only bestie, so if you're not on x86 they're just gonna vibe there doing nothing 🧚
🧩 Compiler plugins 🧩
-fclear-plugins— clears the list of active plugins.-fplugin-opt=⟨module⟩:⟨args⟩— gives arguments to a plugin module; the module must be specified with-fplugin=⟨module⟩.-fplugin-trustworthy— trusts the used plugins and no longer marks the compiled module as unsafe. 🫶-fplugin=⟨module⟩— loads a plugin exported by a given module.-hide-all-plugin-packages— hides all packages for plugins by default.-plugin-package ⟨pkg⟩— exposes ⟨pkg⟩ for plugins.-plugin-package-id ⟨pkg-id⟩— exposes ⟨pkg-id⟩ for plugins.
📊 Profiling 📊
-auto— (deprecated) alias for-fprof-auto-exported.-auto-all— (deprecated) alias for-fprof-auto.-caf-all— (deprecated) alias for-fprof-cafs.-fno-prof-count-entries— do not collect entry counts.-fprof-auto— auto-addSCC\ sto all bindings not markedINLINE. ✨-fprof-auto-calls— auto-addSCC\ sto all call sites.-fprof-auto-exported— auto-addSCC\ sto all exported bindings not markedINLINE.-fprof-auto-top— auto-addSCC\ sto all top-level bindings not markedINLINE.-fprof-cafs— auto-addSCC\ sto all CAFs.-fprof-callers=⟨name⟩— auto-addSCC\ sto all call-sites of the named function.-fprof-late— auto-addSCC\ sto all top level bindings after the core pipeline has run.-fprof-late-inline— auto-addSCC\ sto all top level bindings after the optimizer has run and retain them when inlining.-fprof-manual— process manualSCCannotations.-no-auto— (deprecated) alias for-fno-prof-auto.-no-auto-all— (deprecated) alias for-fno-prof-auto.-no-caf-all— (deprecated) alias for-fno-prof-cafs.-prof— turn on profiling. Let's see where the time is actually going bestie 🔍-ticky— turn on ticky-ticky profiling.-ticky-allocd— keeps a running tally of how many times each closure type gets allocated. counting era fr 💅-ticky-ap-thunk— bestie, this one does NOT use the standard AP thunks, specifically so your entry counters come out more reliable.-ticky-dyn-thunk— tracks the allocations of dynamic thunks.-ticky-LNE— treats join point binders kinda like thunks/functions.-ticky-tag-checks— emits dummy ticky counters so you can see how many tag-inference checks tag inference actually dodged. iconic bookkeeping ✨
🌸 Program coverage 🌸
-fhpc— turns ON Haskell program coverage instrumentation. slay 🎀-hpcdir⟨dir⟩— sets the directory where GHC places its.mixfiles.
🔁 Recompilation checking 🔁
-fforce-recomp— turns recompilation checking OFF. it's implied by any-ddump-Xoption when you're compiling a single file (i.e. when you use-c).-fignore-hpc-changes— do NOT recompile modules just to match changes to HPC flags. this is especially useful for dodging recompiles when you're in GHCi, and it's enabled by default for GHCi. periodt.-fignore-optim-changes— do NOT recompile modules just to match changes to optimisation flags. also super useful for avoiding recompiles in GHCi, and also enabled by default for GHCi.
📦 Redirecting output 📦
--exclude-module=⟨file⟩— regards ⟨file⟩ as "stable"; i.e., excludes it from having dependencies on it.-ddump-mod-cycles— dumps module cycles-dep-makefile ⟨file⟩— uses ⟨file⟩ as the makefile-dep-suffix ⟨suffix⟩— makes dependencies that declare that files with suffix.⟨suf⟩⟨osuf⟩depend on interface files with suffix.⟨suf⟩hi-dumpdir ⟨dir⟩— redirects dump files-dynhisuf ⟨suffix⟩— sets the suffix to use for dynamic interface files-dyno ⟨file⟩— sets the dynamic output filename-dynohi ⟨file⟩— sets the filename in which to put the dynamic interface-dynosuf ⟨suffix⟩— sets the dynamic output file suffix-hcsuf ⟨suffix⟩— sets the suffix to use for intermediate C files-hidir ⟨dir⟩— sets the directory for interface files-hiedir ⟨dir⟩— sets the directory for extended interface files-hiesuf ⟨suffix⟩— sets the suffix to use for extended interface files-hisuf ⟨suffix⟩— sets the suffix to use for interface files-include-cpp-deps— includes preprocessor dependencies-include-pkg-deps— regards modules imported from packages as unstable-o ⟨file⟩— sets the output filename-odir ⟨dir⟩— sets the directory for object files-ohi ⟨file⟩— sets the filename in which to put the interface-osuf ⟨suffix⟩— sets the output file suffix-outputdir ⟨dir⟩— sets the output directory-stubdir ⟨dir⟩— redirects FFI stub files
🧚 Temporary files 🧚
-tmpdir ⟨dir⟩— sets the directory for temporary files
🗣️ Verbosity options 🗣️
-fabstract-refinement-hole-fits— default: off. toggles whether refinements where one or more of the holes are abstract get reported.-fdefer-diagnostics— defers and groups diagnostic messages by severity-fdiagnostics-color=⟨always|auto|never⟩— uses colors in error messages-fdiagnostics-show-caret— whether to show snippets of the original source code-ferror-spans— outputs the full span in error messages-fhide-source-paths— hides module source and object paths-fkeep-going— keeps compiling as far as possible even when there are errors-fmax-refinement-hole-fits=⟨n⟩— default: 6. sets the maximum number of refinement hole fits for typed holes to display in type error messages.-fmax-relevant-binds=⟨n⟩— default: 6. sets the maximum number of bindings to display in type error messages.-fmax-valid-hole-fits=⟨n⟩— default: 6. sets the maximum number of valid hole fits for typed holes to display in type error messages.-fno-show-valid-hole-fits— disables showing a list of valid hole fits for typed holes in type error messages.-fno-sort-valid-hole-fits— disables the sorting of the list of valid hole fits for typed holes in type error messages.-fprint-axiom-incomps— displays equation incompatibilities in closed type families-fprint-equality-relations— distinguishes between equality relations when printing-fprint-expanded-synonyms— in type errors, also prints type-synonym-expanded types.-fprint-explicit-coercions— prints coercions in types-fprint-explicit-foralls— prints explicit forall quantification in types. see alsoExplicitForAll-fprint-explicit-kinds— prints explicit kind foralls and kind arguments in types. see alsoKindSignatures-fprint-explicit-runtime-reps— printsRuntimeRepandLevityvariables in types which are runtime-representation polymorphic.-fprint-potential-instances— displays all available instances in type error messages-fprint-typechecker-elaboration— prints extra information from typechecker.-fprint-unicode-syntax— uses unicode syntax when printing expressions, types and kinds. see alsoUnicodeSyntax-frefinement-level-hole-fits=⟨n⟩— default: off. sets the level of refinement of the refinement hole fits, where level n means that hole fits of up to n holes will be considered.-freverse-errors— outputs errors in reverse order-fshow-docs-of-hole-fits— toggles whether to show the documentation of the valid hole fits in the output.-fshow-hole-constraints— shows constraints when reporting typed holes.-fshow-hole-matches-of-hole-fits— toggles whether to show the type of the additional holes in refinement hole fits.-fshow-provenance-of-hole-fits— toggles whether to show the provenance of the valid hole fits in the output.-fshow-type-app-of-hole-fits— toggles whether to show the type application of the valid hole fits in the output.-fshow-type-app-vars-of-hole-fits— toggles whether to show what type each quantified variable takes in a valid hole fit.-fshow-type-of-hole-fits— toggles whether to show the type of the valid hole fits in the output.-fsort-by-size-hole-fits— sorts valid hole fits by size.-fsort-by-subsumption-hole-fits— sorts valid hole fits by subsumption.-funclutter-valid-hole-fits— unclutters the list of valid hole fits by not showing provenance nor type applications of suggestions.-Rghc-timing— summarises timing stats for GHC (same as+RTS -tstderr).-v— verbose mode (equivalent to-v3)-v⟨n⟩— sets the verbosity level
⚠️ Warnings ⚠️
bestie this section is a whole mood. warning flags are where the drama lives 💀
-fdefer-out-of-scope-variables— converts variable out of scope variables errors into warnings. implied by-fdefer-type-errors. see also-Wdeferred-out-of-scope-variables.-fdefer-type-errors— turns type errors into warnings, deferring the error until runtime. implies-fdefer-typed-holesand-fdefer-out-of-scope-variables. see also-Wdeferred-type-errors-fdefer-typed-holes— converts typed hole errors into warnings, deferring the error until runtime. implied by-fdefer-type-errors. see also-Wtyped-holes.-fenable-th-splice-warnings— generates warnings for Template Haskell splices-fhelpful-errors— makes suggestions for mis-spelled names.-fmax-pmcheck-models=⟨n⟩— soft limit on the number of parallel models the pattern match checker should check a pattern match clause against-fshow-warning-groups— shows which group an emitted warning belongs to.-fvia-C— uses the C code generator-W— enables normal warnings-w— disables all warnings-Wall— enables almost all warnings (details in Warnings and sanity-checking)-Wall-missed-specialisations— warns when specialisation of any overloaded function fails.-Wall-missed-specializations— alias for-Wall-missed-specialisations-Wambiguous-fields— warns about ambiguous field selectors or updates-Wauto-orphans— (deprecated) does nothing-Wcompat— enables future compatibility warnings (details in Warnings and sanity-checking)-Wcompat-unqualified-imports— reports unqualified imports of core libraries which are expected to cause compatibility problems in future releases.-Wcpp-undef— warns on uses of the#ifdirective on undefined identifiers-Wdefault— enables default flags-Wdeferred-out-of-scope-variables— reports warnings when variable out-of-scope errors are deferred until runtime. see-fdefer-out-of-scope-variables.-Wdeferred-type-errors— reports warnings when deferred type errors are enabled. this option is enabled by default. see-fdefer-type-errors.-Wdeprecated-flags— warns about uses of commandline flags that are deprecated-Wdeprecations— warns about uses of functions & types that have warnings or deprecated pragmas. alias for-Wwarnings-deprecations-Wderiving-defaults— warns about default deriving when using bothDeriveAnyClassandGeneralizedNewtypeDeriving-Wderiving-typeable— warns whenTypeableis derived-Wdodgy-exports— warns about dodgy exports-Wdodgy-foreign-imports— warns about dodgy foreign imports-Wdodgy-imports— warns about dodgy imports-Wduplicate-constraints— warns when a constraint appears duplicated in a type signature-Wduplicate-exports— warns when an entity is exported multiple times-Wempty-enumerations— warns about enumerations that are empty-Werror— makes warnings fatal 😭-Weverything— enables all warnings supported by GHC-Wextra— alias for-W-Wforall-identifier— warns whenforallis used as an identifier (at definition sites)-Wgadt-mono-local-binds— warns when pattern matching on a GADT withoutMonoLocalBinds-Whi-shadowing— (deprecated) warns when a.hifile in the current directory shadows a library-Widentities— warns about uses ofPreludenumeric conversions that are probably the identity (and hence could be omitted)-Wimplicit-kind-vars— (deprecated) warn when kind variables are implicitly quantified over. 💅-Wimplicit-lift— warn about implicit lift in Template Haskell quotes ✨-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, pattern binding or a lazy pattern 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. 🔥-Winvalid-haddock— warn when a Haddock comment occurs in an invalid position 💜-Wmisplaced-pragmas— warn about uses of file header pragmas in the module body 🌸-Wmissed-extra-shared-lib— Warn when GHCi can't load a shared lib. 😭-Wmissed-specialisations— warn when specialisation of an imported, overloaded function fails. ✨-Wmissed-specializations— alias for-Wmissed-specialisations💅-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-pattern-synonym-signatures— warn about pattern synonyms without signatures, only if they are exported 🦋-Wmissing-exported-signatures— warn about top-level functions without signatures, only if they are exported ⭐-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-kind-signatures— warn when type declarations don't have kind signatures nor CUSKs 💜-Wmissing-local-signatures— warn about polymorphic local bindings without signatures 💅-Wmissing-local-sigs— (deprecated) warn about polymorphic local bindings without signatures 💅-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 ofreturn,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 offail. 😭-Wnoncanonical-monoid-instances— warn when Semigroup or Monoid instances have noncanonical definitions of(<>)ormappend. See flag description in Warnings and sanity-checking for more details. 💜-Wnot— (deprecated) Alias for-w💅-Woperator-whitespace— warn on prefix, suffix, and tight infix uses of infix operators 🌸-Woperator-whitespace-ext-conflict— warn on uses of infix operators that would be parsed differently were a particular GHC extension enabled 🧚-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. 🔥-Wprepositive-qualified-module— Report imports with a leading/prepositive"qualified"👑-Wredundant-bang-patterns— Warn about redundant bang patterns. 💥-Wredundant-constraints— Have the compiler warn about redundant constraints in type signatures. 💅-Wredundant-record-wildcards— Warn about record wildcard matches when the wildcard binds no patterns. 🎀-Wredundant-strictness-flags— Warn about redundant strictness flags. ⭐-Wsafe— warn if the module being compiled is regarded to be safe. 🫶-Wsemigroup— 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. ✨-Wstar-binder— warn about binding the(*)type operator despite StarIsType ⭐-Wstar-is-type— warn when*is used to meanData.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 🌸-Wtype-equality-out-of-scope— warn when type equalitya ~ bis used despite being out of scope 🦋-Wtype-equality-requires-operators— warn when type equalitya ~ bis used despite being out of scope 🦋-Wtyped-holes— Report warnings when typed hole errors are deferred until runtime. See-fdefer-typed-holes. 😭-Wunbanged-strict-patterns— warn on pattern bind of unlifted variable that is neither bare nor banged 💅-Wunicode-bidirectional-format-characters— warn about the usage of unicode bidirectional layout override characters 🌈-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-fllvmwith an unsupported version of LLVM. 🔥-Wunticked-promoted-constructors— warn if promoted constructors are not ticked ✅-Wunused-binds— warn about bindings that are unused. Alias for-Wunused-top-binds,-Wunused-local-bindsand-Wunused-pattern-binds💅-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-writtenforall\sthat are unused 🦋-Wunused-imports— warn about unnecessary imports 🧚-Wunused-local-binds— warn about local bindings that are unused 🌸-Wunused-matches— warn about variables in patterns that aren't used 🙈-Wunused-packages— warn when package is requested on command line, but not needed. 📦-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 💖
Copyright 2015. The University Court of the University of Glasgow. All rights reserved.
🌈 SEE ALSO 🌈
https://www.haskell.org/ghc the GHC homepage
👑 AUTHOR 👑
The GHC Team
💖 COPYRIGHT 💖
2024, GHC Team
This iconic manual page is from GHC9.4.7, datedFeb 19, 2024— periodt, bestie. 💅✨
📦 where this page comes from
- ubuntu noble: ghc 9.4.7-3 · BSD-3-Clause
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms