Install some default exception handlers and run the inner computation. Unless you want to handle exceptions yourself, you should wrap this around the top level of your program. The default handlers output the error message(s) to stderr and exit cleanly.
Moduleghc-10.0.0.20260917GHC2024
GHC
- 78 types
- 4 classes
- 288 values
- Packageghc-10.0.0.20260917
- Exports377
- LanguageGHC2024
- LicenceBSD-3-Clause
- SourceGHC.hs
Initialisation
5 declarationsDeprecated. Cleanup is now done by runGhc/runGhcT
This function is no longer necessary, cleanup is now done by runGhc/runGhcT.
Temporarily install standard signal handlers for catching ^C, which just throw an exception in the current thread.
GHC Monad
9 declarationsInstances12Monad, Functor, MonadFix, MonadFail, Applicative, MonadIO, …
Monad GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadFunctor GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadFix GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadFail GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadApplicative GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadIO GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadCatch GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadMask GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadThrow GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadGhcMonad GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadHasLogger GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.MonadHasDynFlags GhcDefined in ghc-10.0.0.20260917 · GHC.Driver.Monad
A monad transformer to add GHC specific features to another monad.
Note that the wrapped monad must support IO and handling of exceptions.
Instances12Monad, Functor, MonadFix, MonadFail, Applicative, MonadIO, …
Monad m => Monad (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadFunctor m => Functor (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadFix m => MonadFix (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadFail m => MonadFail (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadApplicative m => Applicative (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadIO m => MonadIO (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadCatch m => MonadCatch (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadMask m => MonadMask (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadThrow m => MonadThrow (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadExceptionMonad m => GhcMonad (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadIO m => HasLogger (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.MonadMonadIO m => HasDynFlags (GhcT m)Defined in ghc-10.0.0.20260917 · GHC.Driver.Monad
class (Functor m, ExceptionMonad m, HasDynFlags m, HasLogger m) => GhcMonad (m :: Type -> Type) whereA monad that has all the features needed by GHC API calls.
In short, a GHC monad
allows embedding of IO actions,
can log warnings,
allows handling of (extensible) exceptions, and
maintains a current session.
If you do not use Ghc or GhcT, make sure to call initGhcMonad before any call to the GHC API functions can occur.
Methods
getSession :: m HscEnvsetSession :: HscEnv -> m ()
HscEnv is like Session, except that some of the fields are immutable. An HscEnv is used to compile a single module from plain Haskell source code (after preprocessing) to either C, assembly or C--. It's also used to store the dynamic linker state to allow for multiple linkers in the same address space. Things like the module graph don't change during a single compilation.
Historical note: "hsc" used to be the name of the compiler binary, when there was a separate driver and compiler. To compile a single module, the driver would invoke hsc on the source code... so nowadays we think of hsc as the layer of the compiler that deals with compiling a single module.
Instances2ContainsDynFlags, HasHscEnv
ContainsDynFlags HscEnvDefined in ghc-10.0.0.20260917 · GHC.Driver.Env.TypesHasHscEnv ((->) HscEnv)Defined in ghc-10.0.0.20260917 · GHC.Driver.Env.Types
Run function for the Ghc monad.
It initialises the GHC session and warnings via initGhcMonad. Each call to this function will create a new session which should not be shared among several threads.
Any errors not handled inside the Ghc action are propagated as IO exceptions.
runGhcT :: ExceptionMonad m=> Maybe FilePathSee argument to initGhcMonad.
-> GhcT m aThe action to perform.
-> m a
Run function for GhcT monad transformer.
It initialises the GHC session and warnings via initGhcMonad. Each call to this function will create a new session which should not be shared among several threads.
Initialise a GHC session.
If you implement a custom GhcMonad you must call this function in the monad run function. It will initialise the session variable and clear all warnings.
The first argument should point to the directory where GHC's library files
reside. More precisely, this should be the output of ghc --print-libdir
of the version of GHC the module using this API is compiled with. For
portability, you should use the ghc-paths package, available at
http://hackage.haskell.org/package/ghc-paths.
Print the all diagnostics in a SourceError. Useful inside exception handlers.
handleSourceError :: MonadCatch m=> (SourceError -> m a)exception handler
-> m aaction to perform
-> m a
Perform the given action and call the exception handler if the action throws a SourceError. See SourceError for more information.
Flags and settings
28 declarationsContains not only a collection of GeneralFlags but also a plethora of information relating to the compilation of a single file or GHC session
Constructors
DynFlagsghcMode :: GhcModeghcLink :: GhcLinkbackend :: !BackendThe backend to use (if any).
Whenever you change the backend, also make sure to set ghcLink to something sensible.
NoBackendcan be used to avoid generating any output, however, note that:If a program uses Template Haskell the typechecker may need to run code from an imported module. To facilitate this, code generation is enabled for modules imported by modules that use template haskell, using the default backend for the platform. See Note [-fno-code mode].
ghcNameVersion :: !GhcNameVersionfileSettings :: !FileSettingsunitSettings :: !UnitSettingstargetPlatform :: PlatformtoolSettings :: !ToolSettingsplatformMisc :: !PlatformMiscrawSettings :: [(String, String)]rawTarget :: TargettmpDir :: TempDirllvmOptLevel :: IntLLVM optimisation level
verbosity :: IntVerbosity level: see Note [Verbosity levels]
debugLevel :: IntHow much debug information to produce
simplPhases :: IntNumber of simplifier phases
maxSimplIterations :: IntMax simplifier iterations
ruleCheck :: Maybe StringstrictnessBefore :: [Int]Additional demand analysis
parMakeCount :: Maybe ParMakeCountThe number of modules to compile in parallel If unspecified, compile with a single job.
enableTimeStats :: BoolEnable RTS timing statistics?
ghcHeapSize :: Maybe IntThe heap size to set.
maxRelevantBinds :: Maybe IntMaximum number of bindings from the type envt to show in type error messages
maxValidHoleFits :: Maybe IntMaximum number of hole fits to show in typed hole error messages
maxRefHoleFits :: Maybe IntMaximum number of refinement hole fits to show in typed hole error messages
refLevelHoleFits :: Maybe IntMaximum level of refinement for refinement hole fits in typed hole error messages
maxUncoveredPatterns :: IntMaximum number of unmatched patterns to show in non-exhaustiveness warnings
maxPmCheckModels :: IntSoft limit on the number of models the pattern match checker checks a pattern against. A safe guard against exponential blow-up.
simplTickFactor :: IntMultiplier for simplifier ticks
dmdUnboxWidth :: !IntWhether DmdAnal should optimistically put an Unboxed demand on returned products with at most this number of fields
ifCompression :: IntspecConstrThreshold :: Maybe IntThreshold for SpecConstr
specConstrCount :: Maybe IntMax number of specialisations for any one function
specConstrRecursive :: IntMax number of specialisations for recursive types Not optional; otherwise ForceSpecConstr can diverge.
binBlobThreshold :: Maybe WordBinary literals (e.g. strings) whose size is above this threshold will be dumped in a binary file by the assembler code generator. 0 and Nothing disables this feature. See
GHC.StgToCmm.Config.liberateCaseThreshold :: Maybe IntThreshold for LiberateCase
floatLamArgs :: Maybe IntArg count for lambda floating See FloatOutSwitches
liftLamsRecArgs :: Maybe IntMaximum number of arguments after lambda lifting a recursive function.
liftLamsNonRecArgs :: Maybe IntMaximum number of arguments after lambda lifting a non-recursive function.
liftLamsKnown :: BoolLambda lift even when this turns a known call into an unknown call.
cmmProcAlignment :: Maybe IntAlign Cmm functions at this boundary or use default.
historySize :: IntSimplification history size
importPaths :: [FilePath]mainModuleNameIs :: ModuleNamemainFunIs :: Maybe StringreductionDepth :: IntWithInfTypechecker maximum stack depth
solverIterations :: IntWithInfNumber of iterations in the constraints solver Typically only 1 is needed
givensFuel :: IntNumber of layers of superclass expansion for givens Should be < solverIterations See Note [Expanding Recursive Superclasses and ExpansionFuel]
wantedsFuel :: IntNumber of layers of superclass expansion for wanteds Should be < givensFuel See Note [Expanding Recursive Superclasses and ExpansionFuel]
qcsFuel :: IntNumber of layers of superclass expansion for quantified constraints Should be < givensFuel See Note [Expanding Recursive Superclasses and ExpansionFuel]
homeUnitId_ :: UnitIdTarget home unit-id
homeUnitInstanceOf_ :: Maybe UnitIdId of the unit to instantiate
homeUnitInstantiations_ :: [(ModuleName, Module)]Module instantiations
workingDirectory :: Maybe FilePaththisPackageName :: Maybe StringWhat the package is called, use with multiple home units
reexportedModules :: [ReexportedModule]targetWays_ :: WaysTarget way flags from the command line
splitInfo :: Maybe (String, Int)objectDir :: Maybe StringdylibInstallName :: Maybe StringhiDir :: Maybe StringhieDir :: Maybe StringbytecodeDir :: Maybe StringstubDir :: Maybe StringdumpDir :: Maybe StringobjectSuf_ :: StringhcSuf :: StringhiSuf_ :: StringhieSuf :: StringbytecodeSuf :: StringdynObjectSuf_ :: StringdynHiSuf_ :: StringoutputFile_ :: Maybe StringdynOutputFile_ :: Maybe StringoutputHi :: Maybe StringdynOutputHi :: Maybe StringdynLibLoader :: DynLibLoaderdynamicNow :: !BoolIndicate if we are now generating dynamic output because of -dynamic-too. This predicate is used to query the appropriate fields (outputFile/dynOutputFile, ways, etc.)
dumpPrefix :: FilePathThis defaults to 'non-module'. It can be set by
GHC.Driver.Pipeline.setDumpPrefixorghc.GHCi.UI.runStmtbased on where its output is going.dumpPrefixForce :: Maybe FilePathOverride the dumpPrefix set by
GHC.Driver.Pipeline.setDumpPrefixorghc.GHCi.UI.runStmt. Set by-ddump-file-prefixldInputs :: [Option]includePaths :: IncludeSpecslibraryPaths :: [String]frameworkPaths :: [String]cmdlineFrameworks :: [String]rtsOpts :: Maybe StringrtsOptsEnabled :: RtsOptsEnabledrtsOptsSuggestions :: BoolhpcDir :: StringPath to store the .mix files
pluginModNames :: [ModuleName]the
-fpluginflags given on the command line, in *reverse* order that they're specified on the command line.pluginModNameOpts :: [(ModuleName, String)]frontendPluginOpts :: [String]the
-ffrontend-optflags given on the command line, in *reverse* order that they're specified on the command line.externalPluginSpecs :: [ExternalPluginSpec]External plugins loaded from shared libraries
depMakefile :: FilePathdepIncludePkgDeps :: BooldepIncludeCppDeps :: BooldepExcludeMods :: [ModuleName]depSuffixes :: [String]packageDBFlags :: [PackageDBFlag]The
-package-dbflags given on the command line, In *reverse* order that they're specified on the command line. This is intended to be applied with the list of "initial" package databases derived fromGHC_PACKAGE_PATH; seegetUnitDbRefs.ignorePackageFlags :: [IgnorePackageFlag]The
-ignore-packageflags from the command line. In *reverse* order that they're specified on the command line.packageFlags :: [PackageFlag]The
-packageand-hide-packageflags from the command-line. In *reverse* order that they're specified on the command line.pluginPackageFlags :: [PackageFlag]The
-plugin-package-idflags from command line. In *reverse* order that they're specified on the command line.trustFlags :: [TrustFlag]The
-trustand-distrustflags. In *reverse* order that they're specified on the command line.packageEnv :: Maybe FilePathFilepath to the package environment file (if overriding default)
dumpFlags :: EnumSet DumpFlaggeneralFlags :: EnumSet GeneralFlagwarningFlags :: EnumSet WarningFlagfatalWarningFlags :: EnumSet WarningFlagcustomWarningCategories :: WarningCategorySetfatalCustomWarningCategories :: WarningCategorySetlanguage :: Maybe LanguagesafeHaskell :: SafeHaskellModeSafe Haskell mode
safeInfer :: BoolsafeInferred :: BoolthOnLoc :: SrcSpannewDerivOnLoc :: SrcSpanderiveViaOnLoc :: SrcSpanoverlapInstLoc :: SrcSpanincoherentOnLoc :: SrcSpanpkgTrustOnLoc :: SrcSpanwarnSafeOnLoc :: SrcSpanwarnUnsafeOnLoc :: SrcSpantrustworthyOnLoc :: SrcSpanextensions :: [OnOff Extension]extensionFlags :: EnumSet ExtensionunfoldingOpts :: !UnfoldingOptsUnfolding control See Note [Discounts and thresholds] in GHC.Core.Unfold
maxWorkerArgs :: IntmaxForcedSpecArgs :: IntghciHistSize :: IntghciBrowserHost :: !StringghciBrowserPort :: !IntghciBrowserAssetsDir :: !Maybe FilePathghciBrowserPuppeteerLaunchOpts :: !Maybe StringghciBrowserPlaywrightBrowserType :: !Maybe StringghciBrowserPlaywrightLaunchOpts :: !Maybe StringflushOut :: FlushOutghcVersionFile :: Maybe FilePathhaddockOptions :: Maybe StringghciScripts :: [String]GHCi scripts specified by -ghci-script, in reverse order
pprUserLength :: IntpprCols :: IntuseUnicode :: BooluseColor :: OverridingBoolcanUseColor :: BooluseErrorLinks :: OverridingBoolcanUseErrorLinks :: BoolcolScheme :: SchemeprofAuto :: ProfAutowhat kind of {-# SCC #-} to add automatically
callerCcFilters :: [CallerCcFilter]interactivePrint :: Maybe StringsseAvxVersion :: Maybe SseAvxVersionMachine dependent flags (-m<blah> stuff)
bmiVersion :: Maybe BmiVersionavx512bw :: BoolEnable AVX-512BW Instructions.
avx512cd :: BoolEnable AVX-512 Conflict Detection Instructions.
avx512dq :: BoolEnable AVX-512DQ Instructions.
avx512er :: BoolEnable AVX-512 Exponential and Reciprocal Instructions.
avx512f :: BoolEnable AVX-512 instructions.
avx512pf :: BoolEnable AVX-512 PreFetch Instructions.
avx512vl :: BoolEnable AVX-512VL Instructions.
fma :: BoolEnable FMA instructions.
gfni :: BoolEnable GFNI Instructions.
la664 :: BoolEnable LA664 instructions
maxInlineAllocSize :: IntMax size, in bytes, of inline array allocations.
maxInlineMemcpyInsns :: IntOnly inline memcpy if it generates no more than this many pseudo (roughly: Cmm) instructions.
maxInlineMemsetInsns :: IntOnly inline memset if it generates no more than this many pseudo (roughly: Cmm) instructions.
reverseErrors :: BoolReverse the order of error messages in GHC/GHCi
maxErrors :: Maybe IntLimit the maximum number of errors to show
initialUnique :: Word64Unique supply configuration for testing build determinism
uniqueIncrement :: IntcfgWeights :: WeightsTemporary: CFG Edge weights for fast iterations
distinctConstructorTables :: StgDebugDctConfigConfiguration specifying which constructor names we should create distinct info tables for
Enumerates the simple on-or-off dynamic flags
Constructors
Opt_DumpToFileAppend dump output to files instead of stdout.
Opt_DumpWithWaysOpt_D_dump_minimal_importsOpt_DoCoreLintingOpt_DoLinearCoreLintingOpt_DoStgLintingOpt_DoCmmLintingOpt_DoAsmLintingOpt_DoAnnotationLintingOpt_DoBoundsCheckingOpt_AddBcoNameOpt_NoLlvmManglerOpt_FastLlvmOpt_NoTypeableBindsOpt_NoBuiltinRulesOpt_NoBignumRulesOpt_InfoTableMapOpt_InfoTableMapWithFallbackOpt_InfoTableMapWithStackOpt_WarnIsError-Werror; makes all warnings fatal. Seewopt_set_fatalfor making individual warnings fatal as in-Werror=foo.Opt_ShowWarnGroupsShow the group a warning belongs to.
Opt_HideSourcePaths-fhide-source-paths; hide module source/object paths.Opt_PrintExplicitForallsOpt_PrintExplicitKindsOpt_PrintExplicitCoercionsOpt_PrintExplicitRuntimeRepsOpt_PrintEqualityRelationsOpt_PrintAxiomIncompsOpt_PrintUnicodeSyntaxOpt_PrintExpandedSynonymsOpt_PrintPotentialInstancesOpt_PrintRedundantPromotionTicksOpt_PrintTypecheckerElaborationOpt_CallArityOpt_ExitificationOpt_StrictnessOpt_LateDmdAnalOpt_KillAbsenceOpt_KillOneShotOpt_FullLazinessOpt_FloatInOpt_LocalFloatOutEnable floating out of let-bindings in the simplifier
Opt_LocalFloatOutTopLevelEnable floating out of let-bindings at the top level in the simplifier N.B. See Note [RHS Floating]
Opt_LateSpecialiseOpt_SpecialiseOpt_SpecialiseAggressivelyOpt_CrossModuleSpecialiseOpt_PolymorphicSpecialisationOpt_InlineGenericsOpt_InlineGenericsAggressivelyOpt_StaticArgumentTransformationOpt_CSEOpt_StgCSEOpt_StgLiftLamsOpt_LiberateCaseOpt_SpecConstrOpt_SpecConstrKeenOpt_SpecialiseIncoherentsOpt_DoLambdaEtaExpansionOpt_DoCleverArgEtaExpansionOpt_IgnoreAssertsOpt_DoEtaReductionOpt_CaseMergeOpt_CaseFoldingConstant folding through case-expressions
Opt_UnboxStrictFieldsOpt_UnboxSmallStrictFieldsOpt_DictsCheapOpt_EnableRewriteRulesApply rewrite rules during simplification
Opt_EnableThSpliceWarningsEnable warnings for TH splices
Opt_RegsGraphDo graph coloring register allocation
Opt_RegsIterativeDo iterative coalescing graph coloring register allocation
Opt_PedanticBottomsBe picky about how we treat bottom
Opt_LlvmFillUndefWithGarbageOpt_IrrefutableTuplesOpt_CmmSinkOpt_CmmStaticPredOpt_CmmElimCommonBlocksOpt_CmmControlFlowOpt_AsmShortcuttingOpt_InterModuleFarJumpsOpt_OmitYieldsOpt_FunToThunkOpt_DictsStrictBe strict in argument dictionaries
Opt_DmdTxDictSeldeprecated, no effect and behaviour is now default. Allowed switching of a special demand transformer for dictionary selectors
Opt_LoopificationOpt_CfgBlocklayoutUse the cfg based block layout algorithm.
Opt_WeightlessBlocklayoutLayout based on last instruction per block.
Opt_CprAnalOpt_WorkerWrapperOpt_WorkerWrapperUnliftDo W/W split for unlifting even if we won't unbox anything.
Opt_SolveConstantDictsOpt_AlignmentSanitisationOpt_CatchNonexhaustiveCasesOpt_NumConstantFoldingSee Note [Constant folding through nested expressions] in GHC.Core.Opt.ConstantFold
Opt_CoreConstantFoldingOpt_FastPAPCallsOpt_SpecEvalOpt_SpecEvalDictFunOpt_DoTagInferenceChecksOpt_SimplPreInliningPreInlining is on by default. The option is there just to see how bad things get if you turn it off!
Opt_IgnoreInterfacePragmasOpt_OmitInterfacePragmasOpt_ExposeAllUnfoldingsOpt_ExposeOverloadedUnfoldingsOpt_KeepAutoRulesKeep auto-generated rules even if they seem to have become useless
Opt_WriteInterfaceForces .hi files to be written even with -fno-code
Opt_WriteByteCodeForces bytecode files to be written
Opt_WriteSelfRecompInfoOpt_WriteSelfRecompFlagsInclude detailed flag information for self-recompilation debugging
Opt_WriteHieGenerate .hie files
Opt_DisableJsMinifierRender JavaScript pretty-printed instead of minified (compacted)
Opt_DisableJsCsourcesDon't link C sources (compiled to JS) with Haskell code (compiled to JS)
Opt_AutoSccsOnIndividualCafsOpt_ProfCountEntriesOpt_ProfLateInlineCcsOpt_ProfLateCcsOpt_ProfLateOverloadedCcsOpt_ProfLateoverloadedCallsCCsOpt_ProfManualCcsIgnore manual SCC annotations
Opt_PpOpt_ForceRecompOpt_IgnoreOptimChangesOpt_IgnoreHpcChangesOpt_ExcessPrecisionOpt_EagerBlackHolingOpt_OrigThunkInfoOpt_NoHsMainOpt_SplitSectionsOpt_StgStatsOpt_HideAllPackagesOpt_HideAllPluginPackagesOpt_PrintBindResultOpt_HaddockOpt_HaddockOptionsOpt_BreakOnExceptionOpt_BreakOnErrorOpt_PrintEvldWithShowOpt_PrintBindContentsOpt_GenManifestOpt_EmbedManifestOpt_BuildingCabalPackageOpt_IgnoreDotGhciOpt_GhciSandboxOpt_InsertBreakpointsOpt_GhciHistoryOpt_GhciLeakCheckOpt_ValidateHieOpt_LocalGhciHistoryOpt_NoItOpt_GhciBrowserOpt_GhciBrowserRedirectWasiConsoleOpt_GhciDoLoadTargetsInstruct GHCi to load all targets on startup
Opt_GhciImportLoadedTargetsInstruct GHCi to import all loaded targets on startup
Opt_HelpfulErrorsOpt_DeferTypeErrorsOpt_DeferTypedHolesOpt_DeferOutOfScopeVariablesOpt_PIC-fPICOpt_PIE-fPIEOpt_PICExecutable-pieOpt_ExternalDynamicRefsOpt_TickyOpt_Ticky_AllocdOpt_Ticky_LNEOpt_Ticky_Dyn_ThunkOpt_Ticky_TagOpt_Ticky_APUse regular thunks even when we could use std ap thunks in order to get entry counts
Opt_CmmThreadSanitizerOpt_RPathOpt_RelativeDynlibPathsOpt_CompactUnwind-fcompact-unwindOpt_HpcOpt_FamAppCacheOpt_ExternalInterpreterOpt_OptimalApplicativeDoOpt_VersionMacrosOpt_WholeArchiveHsLibsOpt_SingleLibFolderOpt_ExposeInternalSymbolsOpt_KeepCAFsOpt_KeepGoingOpt_ByteCodeOpt_ByteCodeAndObjectCodeOpt_UnoptimizedCoreForInterpreterOpt_LinkRtsOpt_ErrorSpansInclude full span info in error messages, instead of just the start position.
Opt_DeferDiagnosticsOpt_DiagnosticsAsJSONDump diagnostics as JSON
Opt_DiagnosticsShowCaretShow snippets of offending code
Opt_PprCaseAsLetOpt_PprShowTicksOpt_ShowHoleConstraintsOpt_ShowValidHoleFitsOpt_SortValidHoleFitsOpt_SortBySizeHoleFitsOpt_SortBySubsumHoleFitsOpt_AbstractRefHoleFitsOpt_UnclutterValidHoleFitsOpt_ShowTypeAppOfHoleFitsOpt_ShowTypeAppVarsOfHoleFitsOpt_ShowDocsOfHoleFitsOpt_ShowTypeOfHoleFitsOpt_ShowProvOfHoleFitsOpt_ShowMatchesOfHoleFitsOpt_ShowLoadedModulesOpt_HexWordLiteralsOpt_SuppressCoercionsSuppress a coercions inner structure, replacing it with
...Opt_SuppressCoercionTypesSuppress the type of a coercion as well
Opt_SuppressVarKindsOpt_SuppressModulePrefixesSuppress module id prefixes on variables.
Opt_SuppressTypeApplicationsSuppress type applications.
Opt_SuppressIdInfoSuppress info such as arity and unfoldings on identifiers.
Opt_SuppressUnfoldingsSuppress separate type signatures in core, but leave types on lambda bound vars
Opt_SuppressTypeSignaturesSuppress the details of even stable unfoldings
Opt_SuppressUniquesSuppress unique ids on variables. Except for uniques, as some simplifier phases introduce new variables that have otherwise identical names.
Opt_SuppressStgExtsOpt_SuppressStgRepsOpt_SuppressTicksReplaces Opt_PprShowTicks
Opt_SuppressTimestampsSuppress timestamps in dumps
Opt_SuppressCoreSizesSuppress per binding Core size stats in dumps
Opt_ShowErrorContextOpt_ObjectDeterminismOpt_AutoLinkPackagesOpt_ImplicitImportQualifiedOpt_KeepHscppFilesOpt_KeepHiDiffsOpt_KeepHcFilesOpt_KeepSFilesOpt_KeepTmpFilesOpt_KeepRawTokenStreamOpt_KeepLlvmFilesOpt_KeepHiFilesOpt_KeepOFilesOpt_BuildDynamicTooOpt_WriteIfSimplifiedCoreOpt_UseBytecodeRatherThanObjectsOpt_DistrustAllPackagesOpt_PackageTrustOpt_PluginTrustworthyOpt_G_NoStateHackOpt_G_NoOptCoercion
Instances3Enum, Eq, Show
Enum GeneralFlagDefined in ghc-10.0.0.20260917 · GHC.Driver.FlagsEq GeneralFlagDefined in ghc-10.0.0.20260917 · GHC.Driver.FlagsShow GeneralFlagDefined in ghc-10.0.0.20260917 · GHC.Driver.Flags
Used to describe warnings and errors o The message has a file/line/column heading, plus "warning:" or "error:", added by mkLocMessage o With SevIgnore the message is suppressed o Output is intended for end users
Constructors
SevIgnoreIgnore this message, for example in case of suppression of warnings users don't want to see. See Note [Suppressing Messages]
SevWarningSevError
Instances5Eq, Ord, Show, Outputable, ToJson
Eq SeverityDefined in ghc-10.0.0.20260917 · GHC.Types.ErrorOrd SeverityDefined in ghc-10.0.0.20260917 · GHC.Types.ErrorShow SeverityDefined in ghc-10.0.0.20260917 · GHC.Types.ErrorOutputable SeverityDefined in ghc-10.0.0.20260917 · GHC.Types.ErrorToJson SeverityDefined in ghc-10.0.0.20260917 · GHC.Types.Error
A value of type Backend represents one of GHC's back ends.
The set of back ends cannot be extended except by modifying the
definition of Backend in this module.
The Backend type is abstract; that is, its value constructors are
not exported. It's crucial that they not be exported, because a
value of type Backend carries only the back end's name, not its
behavior or properties. If Backend were not abstract, then code
elsewhere in the compiler could depend directly on the name, not on
the semantics, which would make it challenging to create a new back end.
Because Backend is abstract, all the obligations of a new back
end are enumerated in this module, in the form of functions that
take Backend as an argument.
The issue of abstraction is discussed at great length in #20927 and !7442.
Test whether a GeneralFlag is set
Note that dynamicNow (i.e., dynamic objects built with `-dynamic-too`) always implicitly enables Opt_PIC, Opt_ExternalDynamicRefs, and disables Opt_SplitSections.
The native code generator. Compiles Cmm code into textual assembler, then relies on an external assembler toolchain to produce machine code.
Only supports a few platforms (X86, PowerPC, SPARC).
See GHC.CmmToAsm.
The LLVM backend.
Compiles Cmm code into LLVM textual IR, then relies on LLVM toolchain to produce machine code.
It relies on LLVM support for the calling convention used by the NCG backend to produce code objects ABI compatible with it (see "cc 10" or "ghccc" calling convention in https://llvm.org/docs/LangRef.html#calling-conventions).
Supports a few platforms (X86, AArch64, s390x, ARM).
See GHC.CmmToLlvm
Via-C ("unregisterised") backend.
Compiles Cmm code into C code, then relies on a C compiler to produce machine code.
It produces code objects that are not ABI compatible with those produced by NCG and LLVM backends.
Produced code is expected to be less efficient than the one produced by NCG and LLVM backends because STG registers are not pinned into real registers. On the other hand, it supports more target platforms (those having a valid C toolchain).
See GHC.CmmToC
The ByteCode interpreter.
Produce ByteCode objects (BCO, see GHC.ByteCode) that
can be interpreted. It is used by GHCi.
Currently some extensions are not supported (foreign primops).
Deprecated. Renamed to bytecodeBackend
A dummy back end that generates no code.
Use this back end to disable code generation. It is particularly useful when GHC is used as a library for other purpose than generating code (e.g. to generate documentation with Haddock) or when the user requested it (via `-fno-code`) for some reason.
The GhcMode tells us whether we're doing multi-module compilation (controlled via the GHC API) or one-shot (single-module) compilation. This makes a difference primarily to the GHC.Unit.Finder: in one-shot mode we look for interface files for imported modules, but in multi-module mode we look for source files in order to check whether they need to be recompiled.
Constructors
CompManager--make, GHCi, etc.OneShotghc -c Foo.hsMkDependghc -M, see GHC.Unit.Finder for why we need this
Instances2Eq, Outputable
Eq GhcModeDefined in ghc-10.0.0.20260917 · GHC.Driver.DynFlagsOutputable GhcModeDefined in ghc-10.0.0.20260917 · GHC.Driver.DynFlags
What to do in the link step, if there is one.
Constructors
NoLinkDon't link at all
LinkExecutable ExecutableLinkModeLink object code into an executable
LinkInMemoryUse the in-memory dynamic linker (works for both bytecode and object code).
LinkDynLibLink objects into a dynamic lib (DLL on Windows, DSO on ELF platforms)
LinkBytecodeLibLink bytecode objects into a bytecode lib
LinkStaticLibLink objects into a static lib
LinkMergedObjLink objects into a merged "GHCi object"
Parse command line arguments that look like files. First normalises its arguments and then splits them into source files and object files. A source file can be turned into a Target via guessTarget
Grabs the DynFlags from the Session
Returns the program DynFlags.
Sets the program HomeUnitGraph.
Sets the given HomeUnitGraph as the HomeUnitGraph of the current session. If the package flags change, we reinitialise the UnitState of all HomeUnitEnvs in the current session.
This function unconditionally invalidates the module graph cache.
Precondition: the given HomeUnitGraph must have the same keys as the HomeUnitGraph
of the current session. I.e., assuming the new HomeUnitGraph is called
new_hug, then:
do
hug <- hsc_HUG <$> getSession
pure $ unitEnv_keys new_hug == unitEnv_keys hug
If this precondition is violated, the function will crash.
Conceptually, similar to setProgramDynFlags, but performs the same check for all HomeUnitEnvs.
Same as setProgramHUG, but gives you control over whether you want to invalidate the module graph cache.
Get the DynFlags used to evaluate interactive expressions.
Set the DynFlags used to evaluate interactive expressions. Also initialise (load) plugins.
Note: this cannot be used for changes to packages. Use
setSessionDynFlags, or setProgramDynFlags and then copy the
unitState into the interactive DynFlags.
Normalise the DynFlags for us in an interactive context.
Makes sure unsupported Flags and other incosistencies are reported and removed.
Given a set of normalised DynFlags (see normaliseInteractiveDynFlags) for the interactive context, initialize the InteractiveContext.
Initialized plugins and sets the DynFlags as the ic_dflags of the InteractiveContext.
Find the package environment (if one exists)
We interpret the package environment as a set of package flags; to be specific, if we find a package environment file like
clear-package-db
global-package-db
package-db blah/package.conf.d
package-id id1
package-id id2we interpret this as
[ -hide-all-packages
, -clear-package-db
, -global-package-db
, -package-db blah/package.conf.d
, -package-id id1
, -package-id id2
]There's also an older syntax alias for package-id, which is just an unadorned package id
id1
id2Logging
9 declarationsPush a log hook
Pop a log hook
Push a log hook on the stack
Pop a log hook from the stack
Modify the logger
Put a log message
Put a log message
Targets
9 declarationsA compilation target.
A target may be supplied with the actual text of the module. If so, use this instead of the file contents (this is for use in an IDE where the file hasn't been saved by the user yet).
These fields are strict because Targets are long lived.
Constructors
TargettargetId :: !TargetIdmodule or filename
targetAllowObjCode :: !Boolobject code allowed?
targetUnitId :: !UnitIdid of the unit this target is part of
targetContents :: !Maybe (InputFileBuffer, UTCTime)Optional in-memory buffer containing the source code GHC should use for this target instead of reading it from disk.
Since GHC version 8.10 modules which require preprocessors such as Literate Haskell or CPP to run are also supported.
If a corresponding source file does not exist on disk this will result in a
SourceErrorexception iftargetId = TargetModule _is used. However together withtargetId = TargetFile _GHC will not complain about the file missing.
Instances1Outputable
Outputable TargetDefined in ghc-10.0.0.20260917 · GHC.Types.Target
Constructors
TargetModule !ModuleNameA module name: search for the file
TargetFile !FilePath !(Maybe Phase)A filename: preprocess & parse it to find the module name. If specified, the Phase indicates how to compile this file (which phase to start from). Nothing indicates the starting phase should be determined from the suffix of the filename.
Instances2Eq, Outputable
Eq TargetIdDefined in ghc-10.0.0.20260917 · GHC.Types.TargetOutputable TargetIdDefined in ghc-10.0.0.20260917 · GHC.Types.Target
Untyped Phase description
Sets the targets for this session. Each target may be a module name or a filename. The targets correspond to the set of root modules for the program/library. Unloading the current program is achieved by setting the current set of targets to be empty, followed by load.
Returns the current set of targets
Add another target.
Remove a target
Attempts to guess what Target a string refers to. This function
implements the --make/GHCi command-line syntax for filenames:
if the string looks like a Haskell source filename, then interpret it as such
if adding a .hs or .lhs suffix yields the name of an existing file, then use that
If it looks like a module name, interpret it as such
otherwise, this function throws a GhcException.
Attempts to guess what TargetId a string refers to. This function
implements the --make/GHCi command-line syntax for filenames:
if the string looks like a Haskell source filename, then interpret it as such
if adding a .hs or .lhs suffix yields the name of an existing file, then use that
If it looks like a module name, interpret it as such
otherwise, this function throws a GhcException.
Loading/compiling the program
30 declarationsdepanal :: GhcMonad m=> [ModuleName]excluded modules
-> Boolallow duplicate roots
-> m ModuleGraph
Perform a dependency analysis starting from the current targets and update the session with the new module graph.
Dependency analysis entails parsing the import directives and may
therefore require running certain preprocessors.
Note that each ModSummary in the module graph caches its DynFlags.
These DynFlags are determined by the current session DynFlags and the
OPTIONS and LANGUAGE pragmas of the parsed module. Thus if you want
changes to the DynFlags to take effect you need to call this function
again.
In case of errors, just throw them.
depanalE :: GhcMonad m=> (GhcMessage -> AnyGhcDiagnostic)-> Maybe Messager-> [ModuleName]excluded modules
-> Boolallow duplicate roots
-> m (DriverMessages, ModuleGraph)
Perform dependency analysis like in depanal. In case of errors, the errors and an empty module graph are returned.
Try to load the program. See LoadHowMuch for the different modes.
This function implements the core of GHC's --make mode. It preprocesses,
compiles and loads the specified modules, avoiding re-compilation wherever
possible. Depending on the backend (see DynFlags.backend field) compiling
and loading may result in files being created on disk.
Calls the defaultWarnErrLogger after each compiling each module, whether successful or not.
If errors are encountered during dependency analysis, the module depanalE returns together with the errors an empty ModuleGraph. After processing this empty ModuleGraph, the errors of depanalE are thrown. All other errors are reported using the defaultWarnErrLogger.
loadWithCache :: GhcMonad m=> Maybe ModIfaceCacheInstructions about how to cache interfaces as we create them.
-> (GhcMessage -> AnyGhcDiagnostic)How to wrap error messages before they are displayed to a user. If you are using the GHC API you can use this to override how messages created during loadWithCache are displayed to the user.
-> LoadHowMuchHow much loadWithCache should load
-> m SuccessFlag
Describes which modules of the module graph need to be loaded.
Constructors
LoadAllTargetsLoad all targets and its dependencies.
LoadUpTo [HomeUnitModule]Load only the given modules and its dependencies. If empty, we load none of the targets
LoadDependenciesOf HomeUnitModuleLoad only the dependencies of the given module, but not the module itself.
Constructors
IIDecl (ImportDecl GhcPs)Bring the exports of a particular module (filtered by an import decl) into scope
IIModule ModuleBring into scope the entire top-level envt of of this module, including the things imported into it.
Instances1Outputable
Outputable InteractiveImportDefined in ghc-10.0.0.20260917 · GHC.Runtime.Context
Instances2Semigroup, Outputable
Semigroup SuccessFlagDefined in ghc-10.0.0.20260917 · GHC.Types.BasicOutputable SuccessFlagDefined in ghc-10.0.0.20260917 · GHC.Types.Basic
type WarnErrLogger = forall (m :: Type -> Type). (MonadIO m, HasLogger m) => Maybe SourceError -> m ()A function called to log warnings and errors.
Inform GHC that the working directory has changed. GHC will flush its cache of module locations, since it may no longer be valid.
Note: Before changing the working directory make sure all threads running in the same session have stopped. If you change the working directory, you should also unload the current program (set targets to empty, followed by load).
How should TcM plugins be handled when initialising of the typechecker? See Note [Stop TcM plugins after desugaring].
Usage:
If you want to typecheck then desugar, use StartAndKeepRunningTcMPlugins. This will ensure TcM plugins are kept running for the benefit of the pattern-match checker, and shut down after desugaring.
If you only want to typecheck and not desugar, use StartAndStopTcMPlugins.
If a prior operation has started TcM plugins, you can use UseRunningTcMPlugins to avoid re-initialising the plugins, for example in initTc.
If you don't care about TcM plugins at all, you can use NoTcMPlugins.
Constructors
StartAndStopTcMPluginsStart TcM plugins, run the inner action, then shut down all TcM plugins.
Use this if you only need to run the typechecker, and do not intend to proceed to desugaring (in which case you should use StartAndKeepRunningTcMPlugins).
StartAndKeepRunningTcMPluginsStart TcM plugins, run the inner action, then run the "post-tc" actions of the plugins, but keep the TcM plugins running.
Use this when you intend to proceed to desugaring, as the desugarer wants TcM plugins to be running (for solver invocations via the pattern match checker). The desugarer will then shut down all TcM plugins.
If you only intend to typecheck, without desugaring, you should use StartAndStopTcMPlugins.
UseRunningTcMPluginsNoTcMPluginsDon't use any TcM plugins.
Parse a module.
Throws a SourceError on parse error.
Typecheck and rename a parsed module.
Throws a SourceError if either fails.
Desugar a typechecked module.
The result of successful parsing.
Constructors
Instances1ParsedMod
ParsedMod ParsedModuleDefined in ghc-10.0.0.20260917 · GHC
The result of successful typechecking. It also contains the parser result.
Instances2ParsedMod, TypecheckedMod
ParsedMod TypecheckedModuleDefined in ghc-10.0.0.20260917 · GHCTypecheckedMod TypecheckedModuleDefined in ghc-10.0.0.20260917 · GHC
The result of successful desugaring (i.e., translation to core). Also contains all the information of a typechecked module.
Constructors
Instances3DesugaredMod, ParsedMod, TypecheckedMod
DesugaredMod DesugaredModuleDefined in ghc-10.0.0.20260917 · GHCParsedMod DesugaredModuleDefined in ghc-10.0.0.20260917 · GHCTypecheckedMod DesugaredModuleDefined in ghc-10.0.0.20260917 · GHC
Instances2TypecheckedMod
TypecheckedMod DesugaredModuleDefined in ghc-10.0.0.20260917 · GHCTypecheckedMod TypecheckedModuleDefined in ghc-10.0.0.20260917 · GHC
Instances3ParsedMod
ParsedMod DesugaredModuleDefined in ghc-10.0.0.20260917 · GHCParsedMod ParsedModuleDefined in ghc-10.0.0.20260917 · GHCParsedMod TypecheckedModuleDefined in ghc-10.0.0.20260917 · GHC
Package-qualifier after renaming
Renaming detects if "this" or the unit-id of the home-unit was used as a package qualifier.
Instances5Eq, Data, Ord, Outputable, Binary
Eq PkgQualDefined in ghc-10.0.0.20260917 · GHC.Types.PkgQualData PkgQualDefined in ghc-10.0.0.20260917 · GHC.Types.PkgQualOrd PkgQualDefined in ghc-10.0.0.20260917 · GHC.Types.PkgQualOutputable PkgQualDefined in ghc-10.0.0.20260917 · GHC.Types.PkgQualBinary PkgQualDefined in ghc-10.0.0.20260917 · GHC.Types.PkgQual
Compiling to Core
A CoreModule consists of just the fields of a ModGuts that are needed for the compileToCoreModule interface.
Constructors
CoreModulecm_module :: !ModuleModule name
cm_types :: !TypeEnvType environment for types declared in this module
cm_binds :: CoreProgramDeclarations
cm_safe :: SafeHaskellModeSafe Haskell mode
Instances1Outputable
Outputable CoreModuleDefined in ghc-10.0.0.20260917 · GHC
This is the way to get access to the Core bindings corresponding
to a module. compileToCore parses, typechecks, and
desugars the module, then returns the resulting Core module (consisting of
the module name, type declarations, and function declarations) if
successful.
Like compileToCoreModule, but invokes the simplifier, so as to return simplified and tidied Core.
Inspecting the module structure of the program
22 declarationsA 'ModuleGraph' contains all the nodes from the home package (only). See
'ModuleGraphNode' for information about the nodes.
Modules need to be compiled. hs-boots need to be typechecked before the associated "real" module so modules with {-# SOURCE #-} imports can be built. Instantiations also need to be typechecked to ensure that the module fits the signature. Substantiation typechecking is roughly comparable to the check that the module and its hs-boot agree.
The graph is not necessarily stored in topologically-sorted order. Use
GHC.topSortModuleGraph and flattenSCC to achieve this.
Why do we ever need to construct empty graphs? Is it because of one shot mode?
Map a function f over all the ModSummaries.
To preserve invariants, f can't change the isBoot status.
Construct a module graph. This function should be the only entry point for building a ModuleGraph, since it is supposed to be built once and never modified.
If you ever find the need to build a ModuleGraph iteratively, don't add insert and update functions to the API since they become footguns. Instead, design an API that allows iterative construction without posterior modification, perhaps like what is done for building arrays from mutable arrays.
Look up a non-boot ModSummary in the ModuleGraph.
Careful: Linear in the size of the module graph MP: This should probably be level aware
Data for a module node in a ModuleGraph. Module nodes of the module graph
are one of:
A regular Haskell source module
A hi-boot source module
Constructors
ModSummaryms_mod :: ModuleIdentity of the module
ms_hsc_src :: HscSourceThe module source either plain Haskell, hs-boot, or hsig
ms_location :: ModLocationLocation of the various files belonging to the module
ms_hs_hash :: FingerprintContent hash of source file
ms_obj_date :: Maybe UTCTimeTimestamp of object, if we have one
ms_dyn_obj_date :: !Maybe UTCTimeTimestamp of dynamic object, if we have one
ms_bytecode_date :: Maybe UTCTimeTimestamp of bytecode object, if we have one
ms_iface_date :: Maybe UTCTimeTimestamp of hi file, if we have one See Note [When source is considered modified] and #9243
ms_hie_date :: Maybe UTCTimeTimestamp of hie file, if we have one
ms_srcimps :: [Located ModuleName]Source imports of the module
ms_textual_imps :: [(ImportLevel, PkgQual, Located ModuleName)]Non-source imports of the module from the module *text*
ms_parsed_mod :: Maybe HsParsedModuleThe parsed, nonrenamed source, if we have it. This is also used to support "inline module syntax" in Backpack files.
ms_hspp_file :: FilePathFilename of preprocessed source file
ms_hspp_opts :: DynFlagsCached flags from
OPTIONS,INCLUDEandLANGUAGEpragmas in the modules source codems_hspp_buf :: Maybe StringBufferThe actual preprocessed source, if we have it
Instances1Outputable
Outputable ModSummaryDefined in ghc-10.0.0.20260917 · GHC.Unit.Module.ModSummary
Module Location
Where a module lives on the file system: the actual locations of the .hs, .hi, .dyn_hi, .o, .dyn_o and .hie files, if we have them.
For a module in another unit, the ml_hs_file_ospath and ml_obj_file_ospath components of ModLocation are undefined.
The locations specified by a ModLocation may or may not correspond to actual files yet: for example, even if the object file doesn't exist, the ModLocation still contains the path to where the object file will reside if/when it is created.
The paths of anything which can affect recompilation should be placed inside ModLocation.
When a ModLocation is created none of the filepaths will have -boot suffixes. This is because in --make mode the ModLocation is put in the finder cache which is indexed by ModuleName, when a ModLocation is retrieved from the FinderCache the boot suffixes are appended. The other case is in -c mode, there the ModLocation immediately gets given the boot suffixes in mkOneShotModLocation.
Constructors
OsPathModLocationml_hs_file_ospath :: Maybe OsPathThe source file, if we have one. Package modules probably don't have source files.
ml_hi_file_ospath :: OsPathWhere the .hi file is, whether or not it exists yet. Always of form foo.hi, even if there is an hi-boot file (we add the -boot suffix later)
ml_dyn_hi_file_ospath :: OsPathWhere the .dyn_hi file is, whether or not it exists yet.
ml_obj_file_ospath :: OsPathWhere the .o file is, whether or not it exists yet. (might not exist either because the module hasn't been compiled yet, or because it is part of a unit with a .a file)
ml_dyn_obj_file_ospath :: OsPathWhere the .dyn_o file is, whether or not it exists yet.
ml_hie_file_ospath :: OsPathWhere the .hie file is, whether or not it exists yet.
ml_bytecode_file_ospath :: OsPathWhere the .gbc file is, whether or not it exists yet.
Instances2Show, Outputable
Show ModLocationDefined in ghc-10.0.0.20260917 · GHC.Unit.Module.LocationOutputable ModLocationDefined in ghc-10.0.0.20260917 · GHC.Unit.Module.Location
Return the ModSummary of a module with the given name.
The module must be part of the module graph (see hsc_mod_graph and ModuleGraph). If this is not the case, this function will throw a GhcApiError.
This function ignores boot modules and requires that there is only one non-boot module with the given name.
Get the module dependency graph.
Deprecated. Prefer isLoadedModule and isLoadedHomeModule
Return True <==> module is loaded.
Check whether a ModuleName is found in the HomePackageTable
for the given UnitId.
Check whether Module is part of the HomeUnitGraph.
Similar to isLoadedModule, but for Modules.
topSortModuleGraph :: BoolDrop hi-boot nodes? (see below)
-> ModuleGraph-> Maybe [HomeUnitModule]Root module name. If
Nothing, use the full graph.-> [SCC ModuleGraphNode]
Topological sort of the module graph
Calculate SCCs of the module graph, possibly dropping the hi-boot nodes The resulting list of strongly-connected-components is in topologically sorted order, starting with the module(s) at the bottom of the dependency graph (ie compile them first) and ending with the ones at the top.
Drop hi-boot nodes (first boolean arg)?
False: treat the hi-boot summaries as nodes of the graph, so the graph must be acyclicTrue: eliminate the hi-boot nodes, and instead pretend the a source-import of Foo is an import of Foo The resulting graph has no hi-boot nodes, but can be cyclic
Inspecting modules
47 declarationsContainer for information about a Module.
Request information about a loaded Module
The list of top-level entities defined in a module
Returns the instances defined by the specified module. Warning: currently unimplemented for package modules.
Retrieve module safe haskell mode
Looks up a global name: that is, any top-level name in any visible module. Unlike lookupName, lookupGlobalName does not use the interactive context, and therefore does not require a preceding setContext.
A ModIface summarises everything we know about a compiled module.
See Note [Structure of ModIface] for information about what belongs in each field.
See Note [Strictness in ModIface] to learn about why all the fields are lazy.
See Note [Private fields in ModIface] to learn why we don't export any of the fields.
Instances2Binary, NFData
Binary ModIfaceDefined in ghc-10.0.0.20260917 · GHC.Unit.Module.ModIface(NFData (IfaceAbiHashesExts phase), NFData (IfaceDeclExts phase)) => NFData (ModIface_ phase)Defined in ghc-10.0.0.20260917 · GHC.Unit.Module.ModIface
pattern ModIface :: IfaceModInfo -> Module -> Maybe Module -> HscSource -> Fingerprint -> Dependencies -> IfacePublic_ phase -> [IfaceExport] -> [(OccName, Fixity)] -> IfaceWarnings -> [IfaceAnnotation] -> [IfaceDeclExts phase] -> Maybe IfaceSimplifiedCore -> [IfaceDefault] -> IfaceTopEnv -> [IfaceClsInst] -> [IfaceFamInst] -> [IfaceRule] -> IfaceTrustInfo -> Bool -> [IfaceCompleteMatch] -> Maybe Docs -> IfaceAbiHashesExts phase -> ExtensibleFields -> IfaceBinHandle phase -> Maybe IfaceSelfRecomp -> (OccName -> Maybe Fixity) -> (OccName -> Maybe (OccName, Fingerprint)) -> (OccName -> Maybe (WarningTxt GhcRn)) -> (Name -> Maybe (WarningTxt GhcRn)) -> ModIface_ phaseThe various Safe Haskell modes
Constructors
Sf_Noneinferred unsafe
Sf_Unsafedeclared and checked
Sf_Trustworthydeclared and checked
Sf_Safedeclared and checked
Sf_SafeInferredinferred as safe
Sf_Ignore-fno-safe-haskellstate
Instances4Eq, Show, NFData, Outputable
Eq SafeHaskellModeDefined in ghc-10.0.0.20260917 · GHC.Types.SafeHaskellShow SafeHaskellModeDefined in ghc-10.0.0.20260917 · GHC.Types.SafeHaskellNFData SafeHaskellModeDefined in ghc-10.0.0.20260917 · GHC.Types.SafeHaskellOutputable SafeHaskellModeDefined in ghc-10.0.0.20260917 · GHC.Types.SafeHaskell
Printing
2 declarationsWhen printing code that contains original names, we need to map the original names back to something the user understands. This is the purpose of the triple of functions that gets passed around when rendering SDoc.
Interactive evaluation
0 declarationsExecuting statements
Run a statement in the current interactive context.
Like execStmt, but takes a parsed statement as argument. Useful when doing preprocessing on the AST before execution, e.g. in GHCi (see GHCi.UI.runStmt).
Constructors
ExecOptionsexecSingleStep :: SingleStepstepping mode
execSourceFile :: Stringfilename (for errors)
execLineNumber :: Intline number (for errors)
execWrap :: ForeignHValue -> EvalExpr ForeignHValue
default ExecOptions
Constructors
ExecCompleteExecution is complete with either an exception or the list of user-visible names that were brought into scope.
ExecBreak
Adding new declarations
Run some declarations and return any user-visible names that were brought into scope.
Like runDeclsWithLocation, but takes parsed declarations as argument. Useful when doing preprocessing on the AST before execution, e.g. in GHCi (see GHCi.UI.runStmt).
Get/set the current context
Set the interactive evaluation context.
(setContext imports) sets the ic_imports field (which in turn
determines what is in scope at the prompt) to imports, and
updates the icReaderEnv environment to reflect it.
We retain in scope all the things defined at the prompt, and kept in ic_tythings. (Indeed, they shadow stuff from ic_imports.)
Get the interactive evaluation context, consisting of a pair of the set of modules from which we take the full top-level scope, and the set of modules from which we take just the exports respectively.
Set the monad GHCi lifts user statements into.
Checks that a type (in string form) is an instance of the
GHC.GHCi.GHCiSandboxIO type class. Sets it to be the GHCi monad if it is,
throws an error otherwise.
Get the monad GHCi lifts user statements into.
Inspecting the current context
Return the bindings for the current interactive session.
Return the instances for the current interactive session.
Takes a ModuleName and possibly a UnitId, and consults the
filesystem and package database to find the corresponding Module,
using the algorithm that is used for an import declaration.
Like findModule, but differs slightly when the module refers to a source file, and the file has not been loaded via load. In this case, findModule will throw an error (module not loaded), but lookupModule will check to see whether the module can also be found in a package, and if so, that package Module will be returned. If not, the usual module-not-found error will be thrown.
Lookup the given ModuleName in the HomeUnitGraph.
Returns Nothing if no Module has the given ModuleName. Otherwise, returns all Modules that have the given ModuleName.
A ModuleName is generally not enough to uniquely identify a Module, since there can be multiple units exposing the same ModuleName in the case of multiple home units. Thus, this function may return more than one possible Module. We leave it up to the caller to decide how to handle the ambiguity. For example, GHCi may prompt the user to clarify which Module is the correct one.
Given a ModuleName and PkgQual, lookup all Modules that may fit the criteria.
Identically to lookupLoadedHomeModuleByModuleName, there may be more than one Module in the HomeUnitGraph that has the given ModuleName.
The result is guaranteed to be non-empty, if no Module can be found, this function throws an error.
Check that a module is safe to import (according to Safe Haskell).
We return True to indicate the import is safe and False otherwise although in the False case an error may be thrown first.
Return if a module is trusted and the pkgs it depends on to be trusted.
Returns all names in scope in the current interactive context
Returns all RdrNames in scope in the current interactive context, excluding any that are internally-generated.
get the GlobalRdrEnv for a session
Returns True if the specified module is interpreted, and hence has
its full top-level scope available.
Looks up an identifier in the current interactive context (for :info) Filter the instances by the ones whose tycons (or classes resp) are in scope (qualified or otherwise). Otherwise we list a whole lot too many! The exact choice of which ones to show, and which to hide, is a judgement call. (see #1581)
getNameToInstancesIndex :: GhcMonad m=> [Module]visible modules. An orphan instance will be returned if it is visible from at least one module in the list.
-> Maybe [Module]modules to load. If this is not specified, we load modules for everything that is in scope unqualified.
-> m (Messages TcRnMessage, Maybe (NameEnv ([ClsInst], [FamInst])))
Retrieve all type and family instances in the environment, indexed by Name. Each name's lists will contain every instance in which that name is mentioned in the instance head.
Inspecting types and kinds
Get the type of an expression Returns the type as described by TcRnExprMode
How should we infer a type? See Note [TcRnExprMode]
Constructors
TM_InstInstantiate inferred quantifiers only (:type)
TM_DefaultInstantiate all quantifiers, and do eager defaulting (:type +d)
Get the kind of a type
Looking up a Name
Parses a string as an identifier, and returns the list of Names that the identifier can refer to in the current interactive context.
Compiling expressions
Parse an expression, the parsed expression can be further processed and passed to compileParsedExpr.
Compile an expression, run it, and deliver the resulting HValue.
Compile an expression, run it and return the result as a Dynamic.
Compile an expression, run it, and deliver the resulting HValue.
Compile a parsed expression (before renaming), run it, and deliver the resulting HValue.
Docs
Failure modes for getDocs.
Constructors
NameHasNoModule NamenameModule_maybe returned Nothing.
NoDocsInIface Module BoolThe module was loaded without
-haddock,InteractiveNameThe Name was defined interactively.
Instances1Outputable
Outputable GetDocsFailureDefined in ghc-10.0.0.20260917 · GHC.Runtime.Eval
Other
Initialise the tcg_inst_env with instances from all home modules. This mimics the more selective call to hptInstances in tcRnImports
Returns True if passed string is a statement.
Returns True if passed string has an import declaration.
Returns True if passed string is an import declaration.
Returns True if passed string is a declaration but not a splice.
The debugger
What kind of stepping are we doing?
Constructors
RunToCompletionRunAndLogSteps:trace [expr]
SingleStep:step [expr]
StepOut:stepout
initiatedFrom :: Maybe SrcSpanStep-out locations are filtered to make sure we don't stop at a continuation that is within the function from which step-out was initiated. See Note [Debugger: Step-out]
LocalStep:steplocal [expr]
ModuleStep:stepmodule [expr]
Constructors
ResumeresumeStmt :: StringresumeContext :: ForeignRef (ResumeContext [HValueRef])resumeBindings :: ResumeBindingsresumeFinalIds :: [Id]resumeApStack :: ForeignHValueresumeBreakpointId :: Maybe InternalBreakpointIdthe internal breakpoint we stopped at (Nothing = exception)
resumeSpan :: SrcSpanresumeDecl :: StringresumeCCS :: RemotePtr CostCentreStackresumeHistory :: [History]resumeHistoryIx :: Int
breakpoint identifier
declarations enclosing the breakpoint
All the information about the source-relevant breakpoints for a module
This information is constructed once during desugaring (with mkModBreaks)
from breakpoint ticks and fixed/unchanged from there on forward. It could be
exported as an abstract datatype because it should never be updated after
construction, only queried.
The arrays can be indexed using the int in the corresponding BreakpointId (i.e. the BreakpointId whose Module matches the Module corresponding to these ModBreaks) with the accessors modBreaks_locs, modBreaks_vars, and modBreaks_decls.
Constructors
ModBreaksmodBreaks_locs_ :: !Array BreakTickIndex BinSrcSpanAn array giving the source span of each breakpoint.
modBreaks_vars :: !Array BreakTickIndex [OccName]An array giving the names of the free variables at each breakpoint.
modBreaks_decls :: !Array BreakTickIndex [String]An array giving the names of the declarations enclosing each breakpoint. See Note [Field modBreaks_decls]
modBreaks_ccs :: !Array BreakTickIndex (ShortByteString, ShortByteString)Array pointing to cost centre info for each breakpoint; actual
CostCentreallocation is done at link-time.modBreaks_module :: !ModuleThe module to which this ModBreaks is associated. We also cache this here for internal sanity checks.
Breakpoint tick index newtype BreakTickIndex = BreakTickIndex Int deriving (Eq, Ord, Data, Ix, NFData, Outputable)
Breakpoint identifier.
Indexes into the structures in the created during desugaring
(after inserting the breakpoint ticks in the expressions).
See Note [Breakpoint identifiers]ModBreaks
Constructors
BreakpointIdbi_tick_mod :: !ModuleBreakpoint tick module
bi_tick_index :: !BreakTickIndexBreakpoint tick index
Instances6Eq, Data, Ord, NFData, Outputable, Binary
Eq BreakpointIdDefined in ghc-10.0.0.20260917 · GHC.Types.TickishData BreakpointIdDefined in ghc-10.0.0.20260917 · GHC.Types.TickishOrd BreakpointIdDefined in ghc-10.0.0.20260917 · GHC.Types.TickishNFData BreakpointIdDefined in ghc-10.0.0.20260917 · GHC.Types.TickishOutputable BreakpointIdDefined in ghc-10.0.0.20260917 · GHC.Types.TickishBinary BreakpointIdDefined in ghc-10.0.0.20260917 · GHC.Types.Tickish
Internal breakpoint identifier
Indexes into the structures in the InternalModBreaks produced during ByteCode generation.
See Note [Breakpoint identifiers]
Constructors
InternalBreakpointIdibi_info_mod :: !ModuleBreakpoint info module
ibi_info_index :: !BreakInfoIndexBreakpoint info index
Instances5Eq, Ord, NFData, Outputable, Binary
Eq InternalBreakpointIdDefined in ghc-10.0.0.20260917 · GHC.ByteCode.BreakpointsOrd InternalBreakpointIdDefined in ghc-10.0.0.20260917 · GHC.ByteCode.BreakpointsNFData InternalBreakpointIdDefined in ghc-10.0.0.20260917 · GHC.ByteCode.BreakpointsOutputable InternalBreakpointIdDefined in ghc-10.0.0.20260917 · GHC.ByteCode.BreakpointsBinary InternalBreakpointIdDefined in ghc-10.0.0.20260917 · GHC.ByteCode.Breakpoints
Abstract syntax elements
0 declarationsUnits
Modules
A Module is a pair of a Unit and a ModuleName.
Module name (e.g. A.B.C)
Unit the module belongs to
Names
A unique, unambiguous name for something, containing information about where that thing originated.
Instances16Eq, Data, Ord, NFData, NamedThing, Uniquable, …
Eq NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameData NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameOrd NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameCaution: This instance is implemented via nonDetCmpUnique, which means that the ordering is not stable across deserialization or rebuilds.
See nonDetCmpUnique for further information, and #15240 for a bug caused by improper use of this instance.
NFData NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameNamedThing NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameOutputable NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameUniquable NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameBinary NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameAssumes that the Name is a non-binding one. See putIfaceTopBndr and getIfaceTopBndr for serializing binding Names. See
UserDatafor the rationale for this distinction.OutputableBndr NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameHasOccName NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameModifyState NameDefined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstOutputable (WithUserRdr Name)Defined in ghc-10.0.0.20260917 · GHC.Types.Name.ReaderOutputableBndr (WithUserRdr Name)Defined in ghc-10.0.0.20260917 · GHC.Types.Name.ReaderToHie (Context (Located Name))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located (WithUserRdr Name)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.Asttype Anno Name = SrcSpanAnnNDefined in ghc-10.0.0.20260917 · GHC.Hs.Extension · orphan
print a NamedThing, adding parentheses if the name is an operator.
A class allowing convenient access to the Name of various datatypes
Methods
getOccName :: a -> OccNamegetName :: a -> Name
Instances21NamedThing, …
NamedThing ClassDefined in ghc-10.0.0.20260917 · GHC.Core.ClassNamedThing ConLikeDefined in ghc-10.0.0.20260917 · GHC.Core.ConLikeNamedThing DataConDefined in ghc-10.0.0.20260917 · GHC.Core.DataConNamedThing FamInstDefined in ghc-10.0.0.20260917 · GHC.Core.FamInstEnvNamedThing ClsInstDefined in ghc-10.0.0.20260917 · GHC.Core.InstEnvNamedThing PatSynDefined in ghc-10.0.0.20260917 · GHC.Core.PatSynNamedThing TyConDefined in ghc-10.0.0.20260917 · GHC.Core.TyConNamedThing IfaceClassOpDefined in ghc-10.0.0.20260917 · GHC.Iface.SyntaxNamedThing IfaceConDeclDefined in ghc-10.0.0.20260917 · GHC.Iface.SyntaxNamedThing IfaceDeclDefined in ghc-10.0.0.20260917 · GHC.Iface.SyntaxNamedThing HoleFitCandidateDefined in ghc-10.0.0.20260917 · GHC.Tc.Errors.Hole.FitTypesNamedThing InvalidFamInstQTvDefined in ghc-10.0.0.20260917 · GHC.Tc.Errors.TypesNamedThing ConLikeNameDefined in ghc-10.0.0.20260917 · GHC.Types.GREInfoNamedThing NameDefined in ghc-10.0.0.20260917 · GHC.Types.NameNamedThing TyThingDefined in ghc-10.0.0.20260917 · GHC.Types.TyThingNamedThing VarDefined in ghc-10.0.0.20260917 · GHC.Types.VarNamedThing (CoAxiom br)Defined in ghc-10.0.0.20260917 · GHC.Core.Coercion.AxiomNamedThing a => NamedThing (WithUserRdr a)Defined in ghc-10.0.0.20260917 · GHC.Types.Name.ReaderNamedThing e => NamedThing (Located e)Defined in ghc-10.0.0.20260917 · GHC.Types.NameNamedThing (Located a) => NamedThing (LocatedAn an a)Defined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationNamedThing tv => NamedThing (VarBndr tv flag)Defined in ghc-10.0.0.20260917 · GHC.Types.Var
Reader Name
Do not use the data constructors of RdrName directly: prefer the family of functions that creates them, such as mkRdrUnqual
Note: A Located RdrName will only have API Annotations if it is a compound one, e.g.
`bar`
( ~ )Constructors
Unqual OccNameUnqualified name
Used for ordinary, unqualified occurrences, e.g.
x,yorFoo. Create such a RdrName with mkRdrUnqualQual ModuleName OccName
Instances8Eq, Data, Ord, Outputable, OutputableBndr, HasOccName, …
Eq RdrNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.ReaderData RdrNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.ReaderOrd RdrNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.ReaderOutputable RdrNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.ReaderOutputableBndr RdrNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.ReaderHasOccName RdrNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.ReaderDisambInfixOp RdrNameDefined in ghc-10.0.0.20260917 · GHC.Parser.PostProcesstype Anno RdrName = SrcSpanAnnNDefined in ghc-10.0.0.20260917 · GHC.Hs.Extension · orphan
Identifiers
Identifier
isImplicitId tells whether an Ids info is implied by other declarations, so we don't need to put its signature in an interface file, even if it's mentioned in some other interface unfolding.
isExportedIdVar means "don't throw this away"
Get from either the worker or the wrapper Id to the DataCon. Currently used only in the desugarer.
INVARIANT: idDataCon (dataConWrapId d) = d: remember, dataConWrapId can return either the wrapper or the worker
Returns true if an application to n args diverges or throws an exception See Note [Dead ends] in GHC.Types.Demand.
Type constructors
TyCons represent type constructors. Type constructors are introduced by things such as:
1) Data declarations: data Foo = ... creates the Foo type constructor of
kind Type
2) Type synonyms: type Foo = ... creates the Foo type constructor
3) Newtypes: newtype Foo a = MkFoo ... creates the Foo type constructor
of kind Type -> Type
4) Class declarations: class Foo where creates the Foo type constructor
of kind Constraint
This data type also encodes a number of primitive, built in type constructors such as those for function and tuple types.
If you edit this type, you may need to update the GHC formalism See Note [GHC Formalism] in GHC.Core.Lint
Instances5Eq, Data, NamedThing, Outputable, Uniquable
Eq TyConDefined in ghc-10.0.0.20260917 · GHC.Core.TyConData TyConDefined in ghc-10.0.0.20260917 · GHC.Core.TyConNamedThing TyConDefined in ghc-10.0.0.20260917 · GHC.Core.TyConOutputable TyConDefined in ghc-10.0.0.20260917 · GHC.Core.TyConUniquable TyConDefined in ghc-10.0.0.20260917 · GHC.Core.TyCon
TyVar binders
As tyConDataCons_maybe, but returns the empty list of constructors if no constructors could be found
Arity
Is this TyCon that for a class instance?
Is this a TyCon representing a regular H98 type synonym (type)?
Is this a type family TyCon (whether open or closed)?
Is this TyCon that for a newtype
Does this TyCon represent something that cannot be defined in Haskell?
Is this a TyCon, synonym or otherwise, that defines a family?
Is this a TyCon, synonym or otherwise, that defines a family with instances?
Is this an open type family TyCon?
If this TyCon is that for a class instance, return the class it is for.
Otherwise returns Nothing
Extract the information pertaining to the right hand side of a type synonym
(type) declaration.
Extract the TyVars bound by a vanilla type synonym and the corresponding (unsubstituted) right hand side.
Kind of this TyCon
Equal to mkTyConKind tyConBinders tyConResKind only up to
type synonym expansion, see Note [Preserve user-written TyCon kind]
Type variables
Type or kind Variable
Data constructors
A data constructor
Instances6Eq, Data, NamedThing, Outputable, Uniquable, OutputableBndr
Eq DataConDefined in ghc-10.0.0.20260917 · GHC.Core.DataConData DataConDefined in ghc-10.0.0.20260917 · GHC.Core.DataConNamedThing DataConDefined in ghc-10.0.0.20260917 · GHC.Core.DataConOutputable DataConDefined in ghc-10.0.0.20260917 · GHC.Core.DataConUniquable DataConDefined in ghc-10.0.0.20260917 · GHC.Core.DataConOutputableBndr DataConDefined in ghc-10.0.0.20260917 · GHC.Core.DataCon
The type constructor that we are building via this data constructor
The labels for the fields of this particular DataCon
Should the DataCon be presented infix?
Vanilla DataCons are those that are nice boring Haskell 98 constructors
The user-declared type of the data constructor in the nice-to-read form:
T :: forall a b. a -> b -> T [a]rather than:
T :: forall a c. forall b. (c~[a]) => a -> b -> T cThe type variables are quantified in the order that the user wrote them.
See Note [DataCon user type variable binders].
NB: If the constructor is part of a data instance, the result type mentions the family tycon, not the internal one.
Strictness/unpack annotations, from user; or, for imported DataCons, from the interface file The list is in one-to-one correspondence with the arity of the DataCon
Instances3Eq, Outputable, Binary
Eq StrictnessMarkDefined in ghc-10.0.0.20260917 · GHC.Core.DataConOutputable StrictnessMarkDefined in ghc-10.0.0.20260917 · GHC.Core.DataConBinary StrictnessMarkDefined in ghc-10.0.0.20260917 · GHC.Core.DataCon
Classes
Instances5Eq, Data, NamedThing, Outputable, Uniquable
Eq ClassDefined in ghc-10.0.0.20260917 · GHC.Core.ClassData ClassDefined in ghc-10.0.0.20260917 · GHC.Core.ClassNamedThing ClassDefined in ghc-10.0.0.20260917 · GHC.Core.ClassOutputable ClassDefined in ghc-10.0.0.20260917 · GHC.Core.ClassUniquable ClassDefined in ghc-10.0.0.20260917 · GHC.Core.Class
Instances
A type-class instance. Note that there is some tricky laziness at work here. See Note [ClsInst laziness and the rough-match fields] for more details.
Instances2NamedThing, Outputable
NamedThing ClsInstDefined in ghc-10.0.0.20260917 · GHC.Core.InstEnvOutputable ClsInstDefined in ghc-10.0.0.20260917 · GHC.Core.InstEnv
Pretty-prints a FamInst (type/data family instance) with its defining location.
Instances2NamedThing, Outputable
NamedThing FamInstDefined in ghc-10.0.0.20260917 · GHC.Core.FamInstEnvOutputable FamInstDefined in ghc-10.0.0.20260917 · GHC.Core.FamInstEnv
Types and Kinds
Take a ForAllTy apart, returning the list of tycovars and the result type. This always succeeds, even if it returns only an empty list. Note that the result type returned may have free variables that were bound by a forall.
Extract the function result type and panic if that is not possible
The key type representing kinds in the compiler.
A type of the form p of constraint kind represents a value whose type is
the Haskell predicate p, where a predicate is what occurs before
the => in a Haskell type.
We use PredType as documentation to mark those types that we guarantee to have this kind.
It can be expanded into its representation, but:
The type checker must treat it as opaque
The rest of the compiler treats it as transparent
Consider these examples:
f :: (Eq a) => a -> Int
g :: (?x :: Int -> Int) => a -> Int
h :: (r\l) => {r} => {l::Int | r}Here the Eq a and ?x :: Int -> Int and rl are all called "predicates"
A collection of PredTypes
Entities
A global typecheckable-thing, essentially anything that has a name.
Not to be confused with a TcTyThing, which is also a typecheckable
thing but in the *local* context. See GHC.Tc.Utils.Env for how to retrieve
a TyThing given a Name.
Instances2NamedThing, Outputable
NamedThing TyThingDefined in ghc-10.0.0.20260917 · GHC.Types.TyThingOutputable TyThingDefined in ghc-10.0.0.20260917 · GHC.Types.TyThing
Syntax
module GHC.Hs
Fixities
Instances5Eq, Data, NFData, Outputable, Binary
Eq FixityDirectionDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.BasicData FixityDirectionDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.BasicNFData FixityDirectionDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.BasicOutputable FixityDirectionDefined in ghc-10.0.0.20260917 · GHC.Hs.Basic · orphanBinary FixityDirectionDefined in ghc-10.0.0.20260917 · GHC.Hs.Basic · orphan
Captures the fixity of declarations as they are parsed. This is not necessarily the same as the fixity declaration, as the normal fixity may be overridden using parens or backticks.
Instances3Eq, Data, Outputable
Eq LexicalFixityDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.BasicData LexicalFixityDefined in ghc-10.0.0.20260917 · Language.Haskell.Syntax.BasicOutputable LexicalFixityDefined in ghc-10.0.0.20260917 · GHC.Hs.Basic · orphan
Source locations
Source Location
Constructors
Real Source Location
Represents a single point within a file
Instances4Eq, Ord, Show, Outputable
Eq RealSrcLocDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocOrd RealSrcLocDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocShow RealSrcLocDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocOutputable RealSrcLocDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLoc
Built-in "bad" SrcLoc values for particular locations
Gives the filename of the RealSrcLoc
Raises an error when used on a "bad" SrcLoc
Raises an error when used on a "bad" SrcLoc
Source Span
A SrcSpan identifies either a specific portion of a text file or a human-readable description of a location.
Instances22Eq, Data, Show, NFData, HasAnnotation, HasLoc, …
Eq SrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocData SrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocShow SrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocNFData SrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocHasAnnotation SrcSpanDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationHasLoc SrcSpanDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationOutputable SrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocToJson SrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocNamedThing e => NamedThing (Located e)Defined in ghc-10.0.0.20260917 · GHC.Types.NameOutputable e => Outputable (Located e)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLoc(UnXRec p, Outputable (XRec p FieldLabelString)) => OutputableBndr (Located (FieldLabelStrings p))Defined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphanHiePass p => ToHie (Located (PatSynBind (GhcPass p) (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LHsDoc GhcRn)Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located Name))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located Var))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located NoExtField))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located (WithUserRdr Name)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (IEContext (Located RecFieldInfo))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Located [LocatedAn NoEpAnns (HsDerivingClause GhcRn)])Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHasHaddock (Located (HsModule GhcPs))Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockHasHaddock (Located [LocatedAn NoEpAnns (HsDerivingClause GhcPs)])Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockOutputableBndrId pass => OutputableBndr (GenLocated SrcSpan (FieldOcc (GhcPass pass)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Type · orphan
A RealSrcSpan delimits a portion of a text file. It could be represented by a pair of (line,column) coordinates, but in fact we optimise slightly by using more compact representations for single-line and zero-length spans, both of which are quite common.
The end position is defined to be the column after the end of the span. That is, a span of (1,1)-(1,2) is one character long, and a span of (1,1)-(1,1) is zero characters long.
Real Source Span
Instances8Eq, Data, Ord, Show, NFData, ToJson, …
Eq RealSrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocData RealSrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocOrd RealSrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocShow RealSrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocNFData RealSrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocOutputable RealSrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocToJson RealSrcSpanDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocOutputable e => Outputable (GenLocated RealSrcSpan e)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLoc
Constructors
Instances5Eq, Show, NFData, Binary, ToJson
Eq GeneratedSrcSpanDetailsDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocShow GeneratedSrcSpanDetailsDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocNFData GeneratedSrcSpanDetailsDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLocBinary GeneratedSrcSpanDetailsDefined in ghc-10.0.0.20260917 · GHC.Utils.BinaryToJson GeneratedSrcSpanDetailsDefined in ghc-10.0.0.20260917 · GHC.Types.SrcLoc
Create a SrcSpan between two points in a file
Create a SrcSpan corresponding to a single point
Test if a SrcSpan is "good", i.e. has precise location information
Built-in "bad" SrcSpans for common sources of location uncertainty
Located
We attach SrcSpans to lots of things, so let's have a datatype for it.
Constructors
L l e
Instances187Semigroup, HasAnnotation, NoAnn, Functor, Foldable, Traversable, …
Semigroup EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationHasAnnotation EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationHasLoc EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationNoAnn EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationFunctor (GenLocated l)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLocFoldable (GenLocated l)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLocTraversable (GenLocated l)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLocNamedThing e => NamedThing (Located e)Defined in ghc-10.0.0.20260917 · GHC.Types.NameOutputable e => Outputable (Located e)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLoc(UnXRec p, Outputable (XRec p FieldLabelString)) => OutputableBndr (Located (FieldLabelStrings p))Defined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphanCollectBinders (LocatedA (Pat GhcTc))Defined in ghc-10.0.0.20260917 · GHC.HsToCore.TicksCollectBinders [LocatedA (Stmt GhcTc (LocatedA (HsCmd GhcTc)))]Defined in ghc-10.0.0.20260917 · GHC.HsToCore.TicksCollectBinders [LocatedA (Stmt GhcTc (LocatedA (HsExpr GhcTc)))]Defined in ghc-10.0.0.20260917 · GHC.HsToCore.TicksCollectBinders [LocatedA (Pat GhcTc)]Defined in ghc-10.0.0.20260917 · GHC.HsToCore.TicksHiePass p => ToHie (BindContext (LocatedA (HsBind (GhcPass p))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (RFContext (LocatedA (FieldOcc (GhcPass p))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (RScoped (LocatedA (IPBind (GhcPass p))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (SigContext (LocatedA (Sig (GhcPass p))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedA (HsCmd (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedA (HsExpr (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedA (HsTypedSplice (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedA (HsUntypedSplice (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedA (HsOverLit (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedA (HsQualLit (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedC [LocatedA (HsExpr (GhcPass p))])Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => ToHie (Located (PatSynBind (GhcPass p) (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LHsDoc GhcRn)Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located Name))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located Var))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located NoExtField))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located (WithUserRdr Name)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located a)) => ToHie (Context (LocatedA a))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Context (Located a)) => ToHie (Context (LocatedN a))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (EvBindContext (LocatedA TcEvBinds))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (IEContext (LocatedA ModuleName))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (IEContext (LocatedA (IE GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (IEContext (LocatedA (IEWrappedName GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (IEContext (Located RecFieldInfo))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (RScoped (LocatedAn NoEpAnns (RuleBndr GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (RScoped (LocatedAn NoEpAnns (DerivStrategy GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (RScoped (LocatedAn NoEpAnns (FamilyResultSig GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (TScoped (LocatedA (HsSigType GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (TScoped (FamEqn GhcRn (LocatedA (HsType GhcRn))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (TScoped (HsWildCardBndrs GhcRn (LocatedA (HsSigType GhcRn))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (TScoped (HsWildCardBndrs GhcRn (LocatedA (HsType GhcRn))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA SyntaxExprRn)Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA SyntaxExprTc)Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA HsWrapper)Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (FixitySig GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (AnnDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (ClsInstDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (ConDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (DataFamInstDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (DefaultDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (DerivDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (DocDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (FamilyDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (FunDep GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (InstDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (RoleAnnotDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (RuleDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (RuleDecls GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (SpliceDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (StandaloneKindSig GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (TyClDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (TyFamInstDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (WarnDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (WarnDecls GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (ForeignDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (ImportDecl GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (HsConDeclRecField GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedA (HsType GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedC (DerivClauseTys GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedC [LocatedA (HsType GhcRn)])Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedL [LocatedA (HsConDeclRecField GhcRn)])Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedP (OverlapMode GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (Located [LocatedAn NoEpAnns (HsDerivingClause GhcRn)])Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstData flag => ToHie (TVScoped (LocatedA (HsTyVarBndr flag GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.Ast(HiePass p, Data (body (GhcPass p)), AnnoBody p body, ToHie (LocatedA (body (GhcPass p)))) => ToHie (LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p)))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.Ast(ToHie (RFContext label), ToHie arg, HasLoc arg, Data arg, Data label) => ToHie (RContext (LocatedA (HsFieldBind label arg)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.Ast(ToHie (LocatedA (body (GhcPass p))), AnnoBody p body, HiePass p) => ToHie (RScoped (LocatedA (Stmt (GhcPass p) (LocatedA (body (GhcPass p))))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.Ast(Data (HsModifier (GhcPass p)), HiePass p) => ToHie (PScoped (LocatedA (Pat (GhcPass p))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.Ast(Data (HsModifierOf ty (GhcPass p)), ToHie ty) => ToHie (LocatedA (HsModifierOf ty (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => HasType (LocatedA (HsBind (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHiePass p => HasType (LocatedA (HsExpr (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstThis instance tries to construct HieAST nodes which include the type of the expression. It is not yet possible to do this efficiently for all expression forms, so we skip filling in the type for those inputs.
See Note [Computing the type of every node in the tree]
HiePass p => HasType (LocatedA (Pat (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHasHaddock (LocatedA (ConDecl GhcPs))Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedA (HsDecl GhcPs))Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedA (IE GhcPs))Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedA (HsConDeclRecField GhcPs))Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedA (HsSigType GhcPs))Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedA (HsType GhcPs))Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedC (DerivClauseTys GhcPs))Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedLI [LocatedA (IE GhcPs)])Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockOnly for module exports, not module imports.
module M (a, b, c) where -- use on this [LIE GhcPs] import I (a, b, c) -- do not use here!
Imports cannot have documentation comments anyway.
HasHaddock (Located (HsModule GhcPs))Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockHasHaddock (Located [LocatedAn NoEpAnns (HsDerivingClause GhcPs)])Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.Haddock(Eq l, Eq e) => Eq (GenLocated l e)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLocData (GRHS GhcPs (LocatedA (HsCmd GhcPs)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHS GhcPs (LocatedA (HsExpr GhcPs)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHS GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHS GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHS GhcTc (LocatedA (HsCmd GhcTc)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHS GhcTc (LocatedA (HsExpr GhcTc)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHSs GhcPs (LocatedA (HsCmd GhcPs)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHSs GhcPs (LocatedA (HsExpr GhcPs)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHSs GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHSs GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHSs GhcTc (LocatedA (HsCmd GhcTc)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (GRHSs GhcTc (LocatedA (HsExpr GhcTc)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (Match GhcPs (LocatedA (HsCmd GhcPs)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (Match GhcPs (LocatedA (HsExpr GhcPs)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (Match GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (Match GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (Match GhcTc (LocatedA (HsCmd GhcTc)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (Match GhcTc (LocatedA (HsExpr GhcTc)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (MatchGroup GhcPs (LocatedA (HsCmd GhcPs)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (MatchGroup GhcPs (LocatedA (HsExpr GhcPs)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (MatchGroup GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (MatchGroup GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (MatchGroup GhcTc (LocatedA (HsCmd GhcTc)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (MatchGroup GhcTc (LocatedA (HsExpr GhcTc)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifiedFunArrOf (LocatedA (HsExpr GhcPs)) GhcPs)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifiedFunArrOf (LocatedA (HsExpr GhcRn)) GhcRn)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifiedFunArrOf (LocatedA (HsExpr GhcTc)) GhcTc)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifiedFunArrOf (LocatedA (HsType GhcPs)) GhcPs)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifiedFunArrOf (LocatedA (HsType GhcRn)) GhcRn)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifiedFunArrOf (LocatedA (HsType GhcRn)) GhcTc)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifierOf (LocatedA (HsExpr GhcPs)) GhcPs)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifierOf (LocatedA (HsExpr GhcRn)) GhcRn)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifierOf (LocatedA (HsExpr GhcTc)) GhcTc)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifierOf (LocatedA (HsType GhcPs)) GhcPs)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifierOf (LocatedA (HsType GhcRn)) GhcRn)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (HsModifierOf (LocatedA (HsType GhcRn)) GhcTc)Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphan(Data l, Data e) => Data (GenLocated l e)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLoc(Ord l, Ord e) => Ord (GenLocated l e)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLoc(Show l, Show e) => Show (GenLocated l e)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLoc(NFData l, NFData e) => NFData (GenLocated l e)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLocHasLoc l => HasLoc (GenLocated l a)Defined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationNamedThing (Located a) => NamedThing (LocatedAn an a)Defined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationOutputable (GenLocated NoCommentsLocation EpaComment)Defined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationOutputable e => Outputable (GenLocated EpaLocation e)Defined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationOutputable e => Outputable (GenLocated RealSrcSpan e)Defined in ghc-10.0.0.20260917 · GHC.Types.SrcLoc(Outputable a, Outputable e) => Outputable (GenLocated (EpAnn a) e)Defined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationOutputableBndrId pass => OutputableBndr (GenLocated SrcSpan (FieldOcc (GhcPass pass)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Type · orphan(Outputable a, OutputableBndr e) => OutputableBndr (GenLocated (EpAnn a) e)Defined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationCollectFldBinders e => CollectFldBinders (GenLocated l e)Defined in ghc-10.0.0.20260917 · GHC.HsToCore.TicksHiePass p => ToHie (LocatedAn NoEpAnns (HsCmdTop (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedAn NoEpAnns HsIPName)Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedAn NoEpAnns (HsDerivingClause GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstToHie (LocatedAn NoEpAnns (InjectivityAnn GhcRn))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.Ast(HiePass p, AnnoBody p body, ToHie (LocatedA (body (GhcPass p)))) => ToHie (MatchGroup (GhcPass p) (LocatedA (body (GhcPass p))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.Ast(HiePass p, Data (IdGhcP p)) => ToHie (GenLocated SrcSpanAnnL (BooleanFormula (GhcPass p)))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.Ast(ToHie (LocatedA (body (GhcPass p))), HiePass p, AnnoBody p body) => ToHie (LocatedAn NoEpAnns (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.Ast(ToHie (LocatedA (body (GhcPass p))), HiePass p, AnnoBody p body) => ToHie (GRHSs (GhcPass p) (LocatedA (body (GhcPass p))))Defined in ghc-10.0.0.20260917 · GHC.Iface.Ext.AstHasHaddock (LocatedAn NoEpAnns (HsDerivingClause GhcPs))Defined in ghc-10.0.0.20260917 · GHC.Parser.PostProcess.HaddockData (StmtLR GhcPs GhcPs (LocatedA (HsCmd GhcPs)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (StmtLR GhcPs GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (StmtLR GhcPs GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (StmtLR GhcRn GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (StmtLR GhcRn GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (StmtLR GhcTc GhcTc (LocatedA (HsCmd GhcTc)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphanData (StmtLR GhcTc GhcTc (LocatedA (HsExpr GhcTc)))Defined in ghc-10.0.0.20260917 · GHC.Hs.Instances · orphantype Anno (LocatedA (IE (GhcPass p))) = SrcSpanAnnADefined in ghc-10.0.0.20260917 · GHC.Hs.ImpExp · orphantype Anno (FamEqn p (LocatedA (HsType p))) = SrcSpanAnnADefined in ghc-10.0.0.20260917 · GHC.Hs.Decls · orphantype Anno (GRHS GhcPs (LocatedA (PatBuilder GhcPs))) = EpAnnCODefined in ghc-10.0.0.20260917 · GHC.Parser.Typestype Anno (GRHS (GhcPass p) (LocatedA (HsCmd (GhcPass p)))) = EpAnnCODefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno (GRHS (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) = EpAnnCODefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno (Match GhcPs (LocatedA (PatBuilder GhcPs))) = SrcSpanAnnADefined in ghc-10.0.0.20260917 · GHC.Parser.Typestype Anno (Match (GhcPass p) (LocatedA (HsCmd (GhcPass p)))) = SrcSpanAnnADefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) = SrcSpanAnnADefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs))) = SrcSpanAnnADefined in ghc-10.0.0.20260917 · GHC.Parser.Typestype Anno (StmtLR GhcRn GhcRn (LocatedA (body GhcRn))) = SrcSpanAnnADefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (body (GhcPass pr)))) = SrcSpanAnnADefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno [LocatedA (HsExpr (GhcPass p))] = SrcSpanAnnCDefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno [LocatedA (Match GhcPs (LocatedA (PatBuilder GhcPs)))] = SrcSpanAnnLWDefined in ghc-10.0.0.20260917 · GHC.Parser.Typestype Anno [LocatedA (Match (GhcPass p) (LocatedA (HsCmd (GhcPass p))))] = SrcSpanAnnLWDefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno [LocatedA (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p))))] = SrcSpanAnnLWDefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno [LocatedA (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs)))] = SrcSpanAnnLWDefined in ghc-10.0.0.20260917 · GHC.Parser.Typestype Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (HsCmd (GhcPass pr))))] = SrcSpanAnnLWDefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (HsExpr (GhcPass pr))))] = SrcSpanAnnLWDefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (body (GhcPass pr))))] = SrcSpanAnnLWDefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (body (GhcPass pr))))] = SrcSpanAnnLWDefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno [LocatedA (IE (GhcPass p))] = SrcSpanAnnLIDefined in ghc-10.0.0.20260917 · GHC.Hs.ImpExp · orphantype Anno [LocatedA (Pat (GhcPass p))] = EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Hs.Expr · orphantype Anno [LocatedA (HsConDeclRecField (GhcPass _1))] = SrcSpanAnnLDefined in ghc-10.0.0.20260917 · GHC.Hs.Decls · orphantype Anno [LocatedA (HsType (GhcPass p))] = SrcSpanAnnCDefined in ghc-10.0.0.20260917 · GHC.Hs.Type · orphan
Constructing Located
Deconstructing Located
Combining and comparing Located values
Tests whether the two located things are equal
Tests the ordering of the two located things
Combine locations from two Located things and add them to a third thing
Strategies for ordering SrcSpans
Strategies for ordering SrcSpans
Strategies for ordering SrcSpans
Determines whether a span encloses a given line and column index
isSubspanOf Determines whether a span is enclosed by another one
Exceptions
3 declarationsGHC's own exception type error messages all take the form:
<location>: <error>
If the location is on the command line, or in GHC itself, then <location>="ghc". All of the error types below correspond to a <location> of "ghc", except for ProgramError (where the string is assumed to contain a location already, so we don't print one).
Constructors
Signal IntSome other fatal signal (SIGHUP,SIGTERM)
UsageError StringPrints the short usage msg after the error
CmdLineError StringA problem with the command line arguments, but don't print usage.
Panic StringThe
impossiblehappened.PprPanic String SDocSorry StringThe user tickled something that's known not to work yet, but we're not counting it as a bug.
PprSorry String SDocInstallationError StringAn installation problem.
ProgramError StringAn error in the user's code, probably.
PprProgramError String SDoc
Instances2Show, Exception
Show GhcExceptionDefined in ghc-10.0.0.20260917 · GHC.Utils.PanicException GhcExceptionDefined in ghc-10.0.0.20260917 · GHC.Utils.Panic
Append a description of the given exception to this string.
An error thrown if the GHC API is used in an incorrect fashion.
Constructors
Instances2Show, Exception
Show GhcApiErrorDefined in ghc-10.0.0.20260917 · GHCException GhcApiErrorDefined in ghc-10.0.0.20260917 · GHC
Token stream manipulations
5 declarationsInstances2Show, Outputable
Show TokenDefined in ghc-10.0.0.20260917 · GHC.Parser.LexerOutputable TokenDefined in ghc-10.0.0.20260917 · GHC.Parser.Lexer
Return module source as token stream, including comments.
A Module can be turned into a ModSummary using getModSummary if
your session is fully initialised.
Throws a GHC.Driver.Env.SourceError on parse error.
Give even more information on the source than getTokenStream This function allows reconstructing the source completely with showRichTokenStream.
Take a rich token stream such as produced from getRichTokenStream and return source code almost identical to the original code (except for insignificant whitespace.)
Given a source location and a StringBuffer corresponding to this location, return a rich token stream with the source associated to the tokens.
Pure interface to the parser
1 declarationparser :: StringHaskell module source text (full Unicode is supported)
-> DynFlagsthe flags
-> FilePaththe filename (for source locations)
-> (WarningMessages, Either ErrorMessages (Located (HsModule GhcPs)))
A pure interface to the module parser.
API Annotations
1 declarationConstructors
EpaCommentac_tok :: EpaCommentTokac_prior_tok :: RealSrcSpanThe location of the prior token, used in exact printing. The EpaComment appears as an LEpaComment containing its location. The difference between the end of the prior token and the start of this location is used for the spacing when exact printing the comment.
Instances10Eq, Data, Show, Semigroup, HasAnnotation, HasLoc, …
Eq EpaCommentDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationData EpaCommentDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationShow EpaCommentDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationSemigroup EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationHasAnnotation EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationHasLoc EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationNoAnn EpaLocationDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationOutputable EpaCommentDefined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationOutputable (GenLocated NoCommentsLocation EpaComment)Defined in ghc-10.0.0.20260917 · GHC.Parser.AnnotationOutputable e => Outputable (GenLocated EpaLocation e)Defined in ghc-10.0.0.20260917 · GHC.Parser.Annotation