A structured set of GHC options/flags
Note that options containing lists fall into two categories:
options that can be safely deduplicated, e.g. input modules or enabled extensions;
options that cannot be deduplicated in general without changing semantics, e.g. extra ghc options or linking options.
Constructors
GhcOptionsghcOptMode :: Flag GhcModeThe major mode for the ghc invocation.
ghcOptExtra :: [String]Any extra options to pass directly to ghc. These go at the end and hence override other stuff.
ghcOptExtraDefault :: [String]Extra default flags to pass directly to ghc. These go at the beginning and so can be overridden by other stuff.
ghcOptInputFiles :: NubListR (SymbolicPath Pkg 'File)The main input files; could be .hs, .hi, .c, .o, depending on mode.
ghcOptInputScripts :: NubListR (SymbolicPath Pkg 'File)Script files with irregular extensions that need -x hs.
ghcOptInputModules :: NubListR ModuleNameThe names of input Haskell modules, mainly for
--makemode.ghcOptOutputFile :: Flag (SymbolicPath Pkg 'File)Location for output file; the
ghc -oflag.ghcOptOutputDynFile :: Flag FilePathLocation for dynamic output file in GhcStaticAndDynamic mode; the
ghc -dynoflag.ghcOptSourcePathClear :: Flag BoolStart with an empty search path for Haskell source files; the
ghc -iflag (-ion its own with no path argument).ghcOptSourcePath :: NubListR (SymbolicPath Pkg ('Dir Source))Search path for Haskell source files; the
ghc -iflag.ghcOptUnitFiles :: [FilePath]Unit files to load; the
ghc -unitflag.ghcOptThisUnitId :: Flag StringThe unit ID the modules will belong to; the
ghc -this-unit-idflag (or-this-package-keyor-package-nameon older versions of GHC). This is a String because we assume you've already figured out what the correct format for this string is (we need to handle backwards compatibility.)ghcOptThisComponentId :: Flag ComponentIdGHC doesn't make any assumptions about the format of definite unit ids, so when we are instantiating a package it needs to be told explicitly what the component being instantiated is. This only gets set when ghcOptInstantiatedWith is non-empty
ghcOptInstantiatedWith :: [(ModuleName, OpenModule)]How the requirements of the package being compiled are to be filled. When typechecking an indefinite package, the OpenModule is always a OpenModuleVar; otherwise, it specifies the installed module that instantiates a package.
ghcOptNoCode :: Flag BoolNo code? (But we turn on interface writing
ghcOptPackageDBs :: PackageDBStackGHC package databases to use, the
ghc -package-confflag.ghcOptPackages :: NubListR (OpenUnitId, ModuleRenaming)The GHC packages to bring into scope when compiling, the
ghc -package-idflags.ghcOptHideAllPackages :: Flag BoolStart with a clean package set; the
ghc -hide-all-packagesflagghcOptWarnMissingHomeModules :: Flag BoolWarn about modules, not listed in command line
ghcOptNoAutoLinkPackages :: Flag BoolDon't automatically link in Haskell98 etc; the
ghc -no-auto-link-packagesflag.ghcOptLinkLibs :: [FilePath]Names of libraries to link in; the
ghc -lflag.ghcOptLinkLibPath :: NubListR (SymbolicPath Pkg ('Dir Lib))Search path for libraries to link in; the
ghc -Lflag.ghcOptLinkOptions :: [String]Options to pass through to the linker; the
ghc -optlflag.ghcOptLinkFrameworks :: NubListR StringOSX only: frameworks to link in; the
ghc -frameworkflag.ghcOptLinkFrameworkDirs :: NubListR (SymbolicPath Pkg ('Dir Framework))OSX only: Search path for frameworks to link in; the
ghc -framework-pathflag.ghcOptLinkRts :: Flag BoolInstruct GHC to link against
libHSrtswhen producing a shared library.ghcOptNoLink :: Flag BoolDon't do the link step, useful in make mode; the
ghc -no-linkflag.ghcOptLinkNoHsMain :: Flag BoolDon't link in the normal RTS
mainentry point; theghc -no-hs-mainflag.ghcOptLinkModDefFiles :: NubListR FilePathModule definition files (Windows specific)
ghcOptCcOptions :: [String]Options to pass through to the C compiler; the
ghc -optcflag.ghcOptCxxOptions :: [String]Options to pass through to the C++ compiler.
ghcOptAsmOptions :: [String]Options to pass through to the Assembler.
ghcOptCppOptions :: [String]Options to pass through to CPP; the
ghc -optPflag.ghcOptJSppOptions :: [String]Options to pass through to CPP; the
ghc -optJSPflag. @since 3.16.0.0ghcOptCppIncludePath :: NubListR (SymbolicPath Pkg ('Dir Include))Search path for CPP includes like header files; the
ghc -Iflag.ghcOptCppIncludes :: NubListR (SymbolicPath Pkg 'File)Extra header files to include at CPP stage; the
ghc -optP-includeflag.ghcOptFfiIncludes :: NubListR FilePathExtra header files to include for old-style FFI; the
ghc -#includeflag.ghcOptCcProgram :: Flag FilePathProgram to use for the C and C++ compiler; the
ghc -pgmcflag.ghcOptLanguage :: Flag LanguageThe base language; the
ghc -XHaskell98or-XHaskell2010flag.ghcOptExtensions :: NubListR ExtensionThe language extensions; the
ghc -Xflag.ghcOptExtensionMap :: Map Extension (Maybe CompilerFlag)A GHC version-dependent mapping of extensions to flags. This must be set to be able to make use of the ghcOptExtensions.
ghcOptOptimisation :: Flag GhcOptimisationWhat optimisation level to use; the
ghc -Oflag.ghcOptDebugInfo :: Flag DebugInfoLevelEmit debug info; the
ghc -gflag.ghcOptProfilingMode :: Flag BoolCompile in profiling mode; the
ghc -profflag.ghcOptProfilingAuto :: Flag GhcProfAutoAutomatically add profiling cost centers; the
ghc -fprof-auto*flags.ghcOptSplitSections :: Flag BoolUse the "split sections" feature; the
ghc -split-sectionsflag.ghcOptSplitObjs :: Flag BoolUse the "split object files" feature; the
ghc -split-objsflag.ghcOptNumJobs :: Flag ParStratRun N jobs simultaneously (if possible).
ghcOptHPCDir :: Flag (SymbolicPath Pkg ('Dir Mix))Enable coverage analysis; the
ghc -fhpc -hpcdirflags.ghcOptGHCiScripts :: [FilePath]Extra GHCi startup scripts; the
-ghci-scriptflagghcOptHiSuffix :: Flag StringghcOptObjSuffix :: Flag StringghcOptDynHiSuffix :: Flag Stringonly in GhcStaticAndDynamic mode
ghcOptDynObjSuffix :: Flag Stringonly in GhcStaticAndDynamic mode
ghcOptHiDir :: Flag (SymbolicPath Pkg ('Dir Artifacts))ghcOptHieDir :: Flag (SymbolicPath Pkg ('Dir Artifacts))ghcOptObjDir :: Flag (SymbolicPath Pkg ('Dir Artifacts))ghcOptOutputDir :: Flag (SymbolicPath Pkg ('Dir Artifacts))ghcOptStubDir :: Flag (SymbolicPath Pkg ('Dir Artifacts))ghcOptDynLinkMode :: Flag GhcDynLinkModeghcOptStaticLib :: Flag BoolghcOptFPic :: Flag BoolghcOptDylibName :: Flag StringghcOptRPaths :: NubListR FilePathghcOptVerbosity :: Flag VerbosityGet GHC to be quiet or verbose with what it's doing; the
ghc -vflag.ghcOptExtraPath :: NubListR (SymbolicPath Pkg ('Dir Build))Put the extra folders in the PATH environment variable we invoke GHC with
ghcOptCabal :: Flag BoolLet GHC know that it is Cabal that's calling it. Modifies some of the GHC error messages.
Instances5Show, Generic, Semigroup, Monoid, Rep
Show GhcOptionsDefined in Cabal-3.16.0.0 · Distribution.Simple.Program.GHCGeneric GhcOptionsDefined in Cabal-3.16.0.0 · Distribution.Simple.Program.GHCSemigroup GhcOptionsDefined in Cabal-3.16.0.0 · Distribution.Simple.Program.GHCMonoid GhcOptionsDefined in Cabal-3.16.0.0 · Distribution.Simple.Program.GHCtype Rep GhcOptions = D1 ('MetaDataDefined in Cabal-3.16.0.0 · Distribution.Simple.Program.GHC"GhcOptions"
"Distribution.Simple.Program.GHC"
"Cabal-3.16.0.0-2669"
'False) (C1 ('MetaCons"GhcOptions"
'PrefixI 'True) ((((((S1 ('MetaSel ('Just"ghcOptMode"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag GhcMode)) :*: S1 ('MetaSel ('Just"ghcOptExtra"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String])) :*: (S1 ('MetaSel ('Just"ghcOptExtraDefault"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just"ghcOptInputFiles"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR (SymbolicPath Pkg 'File))))) :*: ((S1 ('MetaSel ('Just"ghcOptInputScripts"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR (SymbolicPath Pkg 'File))) :*: S1 ('MetaSel ('Just"ghcOptInputModules"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR ModuleName))) :*: (S1 ('MetaSel ('Just"ghcOptOutputFile"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag (SymbolicPath Pkg 'File))) :*: S1 ('MetaSel ('Just"ghcOptOutputDynFile"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag FilePath))))) :*: (((S1 ('MetaSel ('Just"ghcOptSourcePathClear"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool)) :*: S1 ('MetaSel ('Just"ghcOptSourcePath"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR (SymbolicPath Pkg ('Dir Source))))) :*: (S1 ('MetaSel ('Just"ghcOptUnitFiles"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: S1 ('MetaSel ('Just"ghcOptThisUnitId"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag String)))) :*: ((S1 ('MetaSel ('Just"ghcOptThisComponentId"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag ComponentId)) :*: S1 ('MetaSel ('Just"ghcOptInstantiatedWith"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(ModuleName, OpenModule)])) :*: (S1 ('MetaSel ('Just"ghcOptNoCode"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool)) :*: (S1 ('MetaSel ('Just"ghcOptPackageDBs"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageDBStack) :*: S1 ('MetaSel ('Just"ghcOptPackages"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR (OpenUnitId, ModuleRenaming)))))))) :*: ((((S1 ('MetaSel ('Just"ghcOptHideAllPackages"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool)) :*: S1 ('MetaSel ('Just"ghcOptWarnMissingHomeModules"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool))) :*: (S1 ('MetaSel ('Just"ghcOptNoAutoLinkPackages"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool)) :*: S1 ('MetaSel ('Just"ghcOptLinkLibs"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]))) :*: ((S1 ('MetaSel ('Just"ghcOptLinkLibPath"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR (SymbolicPath Pkg ('Dir Lib)))) :*: S1 ('MetaSel ('Just"ghcOptLinkOptions"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String])) :*: (S1 ('MetaSel ('Just"ghcOptLinkFrameworks"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR String)) :*: S1 ('MetaSel ('Just"ghcOptLinkFrameworkDirs"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR (SymbolicPath Pkg ('Dir Framework))))))) :*: (((S1 ('MetaSel ('Just"ghcOptLinkRts"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool)) :*: S1 ('MetaSel ('Just"ghcOptNoLink"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool))) :*: (S1 ('MetaSel ('Just"ghcOptLinkNoHsMain"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool)) :*: S1 ('MetaSel ('Just"ghcOptLinkModDefFiles"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR FilePath)))) :*: ((S1 ('MetaSel ('Just"ghcOptCcOptions"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just"ghcOptCxxOptions"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String])) :*: (S1 ('MetaSel ('Just"ghcOptAsmOptions"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: (S1 ('MetaSel ('Just"ghcOptCppOptions"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just"ghcOptJSppOptions"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]))))))) :*: (((((S1 ('MetaSel ('Just"ghcOptCppIncludePath"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR (SymbolicPath Pkg ('Dir Include)))) :*: S1 ('MetaSel ('Just"ghcOptCppIncludes"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR (SymbolicPath Pkg 'File)))) :*: (S1 ('MetaSel ('Just"ghcOptFfiIncludes"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR FilePath)) :*: S1 ('MetaSel ('Just"ghcOptCcProgram"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag FilePath)))) :*: ((S1 ('MetaSel ('Just"ghcOptLanguage"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Language)) :*: S1 ('MetaSel ('Just"ghcOptExtensions"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR Extension))) :*: (S1 ('MetaSel ('Just"ghcOptExtensionMap"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Extension (Maybe CompilerFlag))) :*: S1 ('MetaSel ('Just"ghcOptOptimisation"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag GhcOptimisation))))) :*: (((S1 ('MetaSel ('Just"ghcOptDebugInfo"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag DebugInfoLevel)) :*: S1 ('MetaSel ('Just"ghcOptProfilingMode"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool))) :*: (S1 ('MetaSel ('Just"ghcOptProfilingAuto"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag GhcProfAuto)) :*: S1 ('MetaSel ('Just"ghcOptSplitSections"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool)))) :*: ((S1 ('MetaSel ('Just"ghcOptSplitObjs"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool)) :*: S1 ('MetaSel ('Just"ghcOptNumJobs"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag ParStrat))) :*: (S1 ('MetaSel ('Just"ghcOptHPCDir"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag (SymbolicPath Pkg ('Dir Mix)))) :*: (S1 ('MetaSel ('Just"ghcOptGHCiScripts"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: S1 ('MetaSel ('Just"ghcOptHiSuffix"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag String))))))) :*: ((((S1 ('MetaSel ('Just"ghcOptObjSuffix"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag String)) :*: S1 ('MetaSel ('Just"ghcOptDynHiSuffix"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag String))) :*: (S1 ('MetaSel ('Just"ghcOptDynObjSuffix"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag String)) :*: S1 ('MetaSel ('Just"ghcOptHiDir"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag (SymbolicPath Pkg ('Dir Artifacts)))))) :*: ((S1 ('MetaSel ('Just"ghcOptHieDir"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag (SymbolicPath Pkg ('Dir Artifacts)))) :*: S1 ('MetaSel ('Just"ghcOptObjDir"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag (SymbolicPath Pkg ('Dir Artifacts))))) :*: (S1 ('MetaSel ('Just"ghcOptOutputDir"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag (SymbolicPath Pkg ('Dir Artifacts)))) :*: S1 ('MetaSel ('Just"ghcOptStubDir"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag (SymbolicPath Pkg ('Dir Artifacts))))))) :*: (((S1 ('MetaSel ('Just"ghcOptDynLinkMode"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag GhcDynLinkMode)) :*: S1 ('MetaSel ('Just"ghcOptStaticLib"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool))) :*: (S1 ('MetaSel ('Just"ghcOptShared"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool)) :*: S1 ('MetaSel ('Just"ghcOptFPic"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool)))) :*: ((S1 ('MetaSel ('Just"ghcOptDylibName"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag String)) :*: S1 ('MetaSel ('Just"ghcOptRPaths"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR FilePath))) :*: (S1 ('MetaSel ('Just"ghcOptVerbosity"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Verbosity)) :*: (S1 ('MetaSel ('Just"ghcOptExtraPath"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NubListR (SymbolicPath Pkg ('Dir Build)))) :*: S1 ('MetaSel ('Just"ghcOptCabal"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Flag Bool))))))))))