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-9.10.3GHC2021
GHC
- 77 types
- 4 classes
- 245 values
- Packageghc-9.10.3
- Exports332
- LanguageGHC2021
- 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-9.10.3 · GHC.Driver.MonadFunctor GhcDefined in ghc-9.10.3 · GHC.Driver.MonadMonadFix GhcDefined in ghc-9.10.3 · GHC.Driver.MonadMonadFail GhcDefined in ghc-9.10.3 · GHC.Driver.MonadApplicative GhcDefined in ghc-9.10.3 · GHC.Driver.MonadMonadIO GhcDefined in ghc-9.10.3 · GHC.Driver.MonadMonadCatch GhcDefined in ghc-9.10.3 · GHC.Driver.MonadMonadMask GhcDefined in ghc-9.10.3 · GHC.Driver.MonadMonadThrow GhcDefined in ghc-9.10.3 · GHC.Driver.MonadGhcMonad GhcDefined in ghc-9.10.3 · GHC.Driver.MonadHasLogger GhcDefined in ghc-9.10.3 · GHC.Driver.MonadHasDynFlags GhcDefined in ghc-9.10.3 · 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-9.10.3 · GHC.Driver.MonadFunctor m => Functor (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadMonadFix m => MonadFix (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadMonadFail m => MonadFail (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadApplicative m => Applicative (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadMonadIO m => MonadIO (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadMonadCatch m => MonadCatch (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadMonadMask m => MonadMask (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadMonadThrow m => MonadThrow (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadExceptionMonad m => GhcMonad (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadMonadIO m => HasLogger (GhcT m)Defined in ghc-9.10.3 · GHC.Driver.MonadMonadIO m => HasDynFlags (GhcT m)Defined in ghc-9.10.3 · 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.
Instances1ContainsDynFlags
ContainsDynFlags HscEnvDefined in ghc-9.10.3 · 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
23 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 :: !FileSettingstargetPlatform :: PlatformtoolSettings :: !ToolSettingsplatformMisc :: !PlatformMiscrawSettings :: [(String, String)]tmpDir :: 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
specConstrThreshold :: 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 :: Set ModuleNametargetWays_ :: WaysTarget way flags from the command line
splitInfo :: Maybe (String, Int)objectDir :: Maybe StringdylibInstallName :: Maybe StringhiDir :: Maybe StringhieDir :: Maybe StringstubDir :: Maybe StringdumpDir :: Maybe StringobjectSuf_ :: StringhcSuf :: StringhiSuf_ :: StringhieSuf :: 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 :: IntflushOut :: 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 StringsseVersion :: Maybe SseVersionMachine dependent flags (-m<blah> stuff)
bmiVersion :: Maybe BmiVersionavx :: Boolavx2 :: Boolavx512cd :: Boolavx512er :: Boolavx512f :: Boolavx512pf :: Boolfma :: BoolEnable FMA 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
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_NoLlvmManglerOpt_FastLlvmOpt_NoTypeableBindsOpt_DistinctConstructorTablesOpt_InfoTableMapOpt_InfoTableMapWithFallbackOpt_InfoTableMapWithStackOpt_WarnIsErrorOpt_ShowWarnGroupsOpt_HideSourcePathsOpt_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_CaseFoldingOpt_UnboxStrictFieldsOpt_UnboxSmallStrictFieldsOpt_DictsCheapOpt_EnableRewriteRulesOpt_EnableThSpliceWarningsOpt_RegsGraphOpt_RegsIterativeOpt_PedanticBottomsOpt_LlvmFillUndefWithGarbageOpt_IrrefutableTuplesOpt_CmmSinkOpt_CmmStaticPredOpt_CmmElimCommonBlocksOpt_CmmControlFlowOpt_AsmShortcuttingOpt_InterModuleFarJumpsOpt_OmitYieldsOpt_FunToThunkOpt_DictsStrictOpt_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_NumConstantFoldingOpt_CoreConstantFoldingOpt_FastPAPCallsOpt_SpecEvalOpt_SpecEvalDictFunOpt_DoTagInferenceChecksOpt_SimplPreInliningOpt_IgnoreInterfacePragmasOpt_OmitInterfacePragmasOpt_ExposeAllUnfoldingsOpt_KeepAutoRulesKeep auto-generated rules even if they seem to have become useless
Opt_WriteInterfaceOpt_WriteHieOpt_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_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_ErrorSpansOpt_DeferDiagnosticsOpt_DiagnosticsAsJSONDump diagnostics as JSON
Opt_DiagnosticsShowCaretOpt_PprCaseAsLetOpt_PprShowTicksOpt_ShowHoleConstraintsOpt_ShowValidHoleFitsOpt_SortValidHoleFitsOpt_SortBySizeHoleFitsOpt_SortBySubsumHoleFitsOpt_AbstractRefHoleFitsOpt_UnclutterValidHoleFitsOpt_ShowTypeAppOfHoleFitsOpt_ShowTypeAppVarsOfHoleFitsOpt_ShowDocsOfHoleFitsOpt_ShowTypeOfHoleFitsOpt_ShowProvOfHoleFitsOpt_ShowMatchesOfHoleFitsOpt_ShowLoadedModulesOpt_HexWordLiteralsOpt_SuppressCoercionsOpt_SuppressCoercionTypesOpt_SuppressVarKindsOpt_SuppressModulePrefixesOpt_SuppressTypeApplicationsOpt_SuppressIdInfoOpt_SuppressUnfoldingsOpt_SuppressTypeSignaturesOpt_SuppressUniquesOpt_SuppressStgExtsOpt_SuppressStgRepsOpt_SuppressTicksOpt_SuppressTimestampsSuppress timestamps in dumps
Opt_SuppressCoreSizesSuppress per binding Core size stats in dumps
Opt_ShowErrorContextOpt_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-9.10.3 · GHC.Driver.FlagsEq GeneralFlagDefined in ghc-9.10.3 · GHC.Driver.FlagsShow GeneralFlagDefined in ghc-9.10.3 · 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
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).
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-9.10.3 · GHC.Driver.DynFlagsOutputable GhcModeDefined in ghc-9.10.3 · GHC.Driver.DynFlags
What to do in the link step, if there is one.
Constructors
NoLinkDon't link at all
LinkBinaryLink object code into a binary
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)
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.
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.
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
8 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-9.10.3 · 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-9.10.3 · GHC.Types.TargetOutputable TargetIdDefined in ghc-9.10.3 · 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
otherwise interpret the string as a module name
Loading/compiling the program
29 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=> [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 HomeUnitModuleLoad only the given module and its dependencies.
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 ModuleNameBring into scope the entire top-level envt of of this module, including the things imported into it.
Instances1Outputable
Outputable InteractiveImportDefined in ghc-9.10.3 · GHC.Runtime.Context
Instances2Semigroup, Outputable
Semigroup SuccessFlagDefined in ghc-9.10.3 · GHC.Types.BasicOutputable SuccessFlagDefined in ghc-9.10.3 · GHC.Types.Basic
type WarnErrLogger = forall (m :: Type -> Type). (HasDynFlags m, 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).
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-9.10.3 · GHC
The result of successful typechecking. It also contains the parser result.
Instances2ParsedMod, TypecheckedMod
ParsedMod TypecheckedModuleDefined in ghc-9.10.3 · GHCTypecheckedMod TypecheckedModuleDefined in ghc-9.10.3 · 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-9.10.3 · GHCParsedMod DesugaredModuleDefined in ghc-9.10.3 · GHCTypecheckedMod DesugaredModuleDefined in ghc-9.10.3 · GHC
Instances2TypecheckedMod
TypecheckedMod DesugaredModuleDefined in ghc-9.10.3 · GHCTypecheckedMod TypecheckedModuleDefined in ghc-9.10.3 · GHC
Instances3ParsedMod
ParsedMod DesugaredModuleDefined in ghc-9.10.3 · GHCParsedMod ParsedModuleDefined in ghc-9.10.3 · GHCParsedMod TypecheckedModuleDefined in ghc-9.10.3 · GHC
Package-qualifier after renaming
Renaming detects if "this" or the unit-id of the home-unit was used as a package qualifier.
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-9.10.3 · 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
14 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.
Map a function f over all the ModSummaries.
To preserve invariants f can't change the isBoot status.
Look up a ModSummary in the ModuleGraph Looks up the non-boot ModSummary Linear in the size of the module graph
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_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 :: [(PkgQual, Located ModuleName)]Source imports of the module
ms_textual_imps :: [(PkgQual, Located ModuleName)]Non-source imports of the module from the module *text*
ms_ghc_prim_import :: !BoolWhether the special module GHC.Prim was imported explicitly
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-9.10.3 · 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 and ml_obj_file 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
ModLocationml_hs_file :: Maybe FilePathThe source file, if we have one. Package modules probably don't have source files.
ml_hi_file :: FilePathWhere 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 :: FilePathWhere the .dyn_hi file is, whether or not it exists yet.
ml_obj_file :: FilePathWhere 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 :: FilePathWhere the .dy file is, whether or not it exists yet.
ml_hie_file :: FilePathWhere the .hie file is, whether or not it exists yet.
Instances2Show, Outputable
Show ModLocationDefined in ghc-9.10.3 · GHC.Unit.Module.LocationOutputable ModLocationDefined in ghc-9.10.3 · 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.
Return True <==> module is loaded.
topSortModuleGraph :: BoolDrop hi-boot nodes? (see below)
-> ModuleGraph-> Maybe HomeUnitModuleRoot 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
18 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 plus a ModDetails summarises everything we know
about a compiled module. The ModIface is the stuff *before* linking,
and can be written out to an interface file. The 'ModDetails is after
linking and can be completely recovered from just the ModIface.
When we read an interface file, we also construct a ModIface from it,
except that we explicitly make the mi_decls and a few other fields empty;
as when reading we consolidate the declarations etc. into a number of indexed
maps and environments in the ExternalPackageState.
See Note [Strictness in ModIface] to learn about why some fields are strict and others are not.
Constructors
ModIfacemi_module :: !ModuleName of the module we are for
mi_sig_of :: !Maybe ModuleAre we a sig of another mod?
mi_hsc_src :: !HscSourceBoot? Signature?
mi_deps :: DependenciesThe dependencies of the module. This is consulted for directly-imported modules, but not for anything else (hence lazy)
mi_usages :: [Usage]Usages; kept sorted so that it's easy to decide whether to write a new iface file (changing usages doesn't affect the hash of this module) NOT STRICT! we read this field lazily from the interface file It is *only* consulted by the recompilation checker
mi_exports :: ![IfaceExport]Exports Kept sorted by (mod,occ), to make version comparisons easier Records the modules that are the declaration points for things exported by this module, and the OccNames of those things
mi_used_th :: !BoolModule required TH splices when it was compiled. This disables recompilation avoidance (see #481).
mi_fixities :: [(OccName, Fixity)]Fixities NOT STRICT! we read this field lazily from the interface file
mi_warns :: IfaceWarningsWarnings NOT STRICT! we read this field lazily from the interface file
mi_anns :: [IfaceAnnotation]Annotations NOT STRICT! we read this field lazily from the interface file
mi_decls :: [IfaceDeclExts phase]Type, class and variable declarations The hash of an Id changes if its fixity or deprecations change (as well as its type of course) Ditto data constructors, class operations, except that the hash of the parent class/tycon changes
mi_extra_decls :: Maybe [IfaceBindingX IfaceMaybeRhs IfaceTopBndrInfo]Extra variable definitions which are **NOT** exposed but when combined with mi_decls allows us to restart code generation. See Note [Interface Files with Core Definitions] and Note [Interface File with Core: Sharing RHSs]
mi_globals :: !Maybe IfGlobalRdrEnvBinds all the things defined at the top level in the original source code for this module. which is NOT the same as mi_exports, nor mi_decls (which may contains declarations for things not actually defined by the user). Used for GHCi and for inspecting the contents of modules via the GHC API only.
(We need the source file to figure out the top-level environment, if we didn't compile this module from source then this field contains
Nothing).Strictly speaking this field should live in the
HomeModInfo, but that leads to more plumbing.mi_insts :: [IfaceClsInst]Sorted class instance
mi_fam_insts :: [IfaceFamInst]Sorted family instances
mi_rules :: [IfaceRule]Sorted rules
mi_hpc :: !AnyHpcUsageTrue if this program uses Hpc at any point in the program.
mi_trust :: !IfaceTrustInfoSafe Haskell Trust information for this module.
mi_trust_pkg :: !BoolDo we require the package this module resides in be trusted to trust this module? This is used for the situation where a module is Safe (so doesn't require the package be trusted itself) but imports some trustworthy modules from its own package (which does require its own package be trusted). See Note [Trust Own Package] in GHC.Rename.Names
mi_complete_matches :: ![IfaceCompleteMatch]mi_docs :: !Maybe DocsDocstrings and related data for use by haddock, the ghci
:doccommand, and other tools.Just _=the module was built with-haddock.mi_final_exts :: !IfaceBackendExts phaseEither
()or ModIfaceBackend for a fully instantiated interface.mi_ext_fields :: !ExtensibleFieldsAdditional optional fields, where the Map key represents the field name, resulting in a (size, serialized data) pair. Because the data is intended to be serialized through the internal Binary class (increasing compatibility with types using Name and
FastString, such as HIE), this format is chosen overByteStrings.mi_src_hash :: !FingerprintHash of the .hs source, used for recompilation checking.
Instances2Binary, NFData
Binary ModIfaceDefined in ghc-9.10.3 · GHC.Unit.Module.ModIface(NFData (IfaceBackendExts phase), NFData (IfaceDeclExts phase)) => NFData (ModIface_ phase)Defined in ghc-9.10.3 · GHC.Unit.Module.ModIface
The 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
Instances3Eq, Show, Outputable
Eq SafeHaskellModeDefined in ghc-9.10.3 · GHC.Types.SafeHaskellShow SafeHaskellModeDefined in ghc-9.10.3 · GHC.Types.SafeHaskellOutputable SafeHaskellModeDefined in ghc-9.10.3 · 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
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.
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-9.10.3 · GHC.Runtime.Eval
Other
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
Constructors
ResumeresumeStmt :: StringresumeContext :: ForeignRef (ResumeContext [HValueRef])resumeBindings :: ResumeBindingsresumeFinalIds :: [Id]resumeApStack :: ForeignHValueresumeBreakpointId :: Maybe InternalBreakpointIdthe 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 breakpoints for a module
Constructors
ModBreaksmodBreaks_flags :: ForeignRef BreakArrayThe array of flags, one per breakpoint, indicating which breakpoints are enabled.
modBreaks_locs :: !Array BreakIndex SrcSpanAn array giving the source span of each breakpoint.
modBreaks_vars :: !Array BreakIndex [OccName]An array giving the names of the free variables at each breakpoint.
modBreaks_decls :: !Array BreakIndex [String]An array giving the names of the declarations enclosing each breakpoint. See Note [Field modBreaks_decls]
modBreaks_ccs :: !Array BreakIndex (RemotePtr CostCentre)Array pointing to cost centre for each breakpoint
modBreaks_breakInfo :: IntMap CgBreakInfoinfo about each breakpoint from the bytecode generator
modBreaks_module :: RemotePtr ModuleName
Breakpoint index
Breakpoint identifier.
See Note [Breakpoint identifiers]
Constructors
BreakpointIdbi_tick_mod :: !ModuleBreakpoint tick module
bi_tick_index :: !IntBreakpoint tick index
Internal breakpoint identifier
See Note [Breakpoint identifiers]
Constructors
InternalBreakpointIdibi_tick_mod :: !ModuleBreakpoint tick module
ibi_tick_index :: !IntBreakpoint tick index
ibi_info_mod :: !ModuleBreakpoint info module
ibi_info_index :: !IntBreakpoint info index
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.
Instances14Eq, Data, Ord, NFData, NamedThing, Outputable, …
Eq NameDefined in ghc-9.10.3 · GHC.Types.NameData NameDefined in ghc-9.10.3 · GHC.Types.NameOrd NameDefined in ghc-9.10.3 · 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-9.10.3 · GHC.Types.NameNamedThing NameDefined in ghc-9.10.3 · GHC.Types.NameOutputable NameDefined in ghc-9.10.3 · GHC.Types.NameUniquable NameDefined in ghc-9.10.3 · GHC.Types.NameBinary NameDefined in ghc-9.10.3 · GHC.Types.NameAssumes that the Name is a non-binding one. See putIfaceTopBndr and getIfaceTopBndr for serializing binding Names. See UserData for the rationale for this distinction.
OutputableBndr NameDefined in ghc-9.10.3 · GHC.Types.NameHasOccName NameDefined in ghc-9.10.3 · GHC.Types.NameModifyState NameDefined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LBooleanFormula (LocatedN Name))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Context (Located Name))Defined in ghc-9.10.3 · GHC.Iface.Ext.Asttype Anno Name = SrcSpanAnnNDefined in ghc-9.10.3 · 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
Instances20NamedThing, …
NamedThing ClassDefined in ghc-9.10.3 · GHC.Core.ClassNamedThing ConLikeDefined in ghc-9.10.3 · GHC.Core.ConLikeNamedThing DataConDefined in ghc-9.10.3 · GHC.Core.DataConNamedThing FamInstDefined in ghc-9.10.3 · GHC.Core.FamInstEnvNamedThing ClsInstDefined in ghc-9.10.3 · GHC.Core.InstEnvNamedThing PatSynDefined in ghc-9.10.3 · GHC.Core.PatSynNamedThing TyConDefined in ghc-9.10.3 · GHC.Core.TyConNamedThing IfaceClassOpDefined in ghc-9.10.3 · GHC.Iface.SyntaxNamedThing IfaceConDeclDefined in ghc-9.10.3 · GHC.Iface.SyntaxNamedThing IfaceDeclDefined in ghc-9.10.3 · GHC.Iface.SyntaxNamedThing HoleFitCandidateDefined in ghc-9.10.3 · GHC.Tc.Errors.Hole.FitTypesNamedThing InvalidFamInstQTvDefined in ghc-9.10.3 · GHC.Tc.Errors.TypesNamedThing NameDefined in ghc-9.10.3 · GHC.Types.NameNamedThing TyThingDefined in ghc-9.10.3 · GHC.Types.TyThingNamedThing VarDefined in ghc-9.10.3 · GHC.Types.VarNamedThing (CoAxiom br)Defined in ghc-9.10.3 · GHC.Core.Coercion.AxiomNamedThing e => NamedThing (Located e)Defined in ghc-9.10.3 · GHC.Types.NameNamedThing (Located a) => NamedThing (LocatedAn an a)Defined in ghc-9.10.3 · GHC.Parser.AnnotationNamedThing (HsTyVarBndr flag GhcRn)Defined in ghc-9.10.3 · GHC.Hs.Type · orphanNamedThing tv => NamedThing (VarBndr tv flag)Defined in ghc-9.10.3 · 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`
( ~ )AnnKeywordId : AnnType, AnnOpen
'('or'['or'[:', AnnClose')'or']'or':]',, AnnBackquote'`', AnnVal AnnTilde,
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-9.10.3 · GHC.Types.Name.ReaderData RdrNameDefined in ghc-9.10.3 · GHC.Types.Name.ReaderOrd RdrNameDefined in ghc-9.10.3 · GHC.Types.Name.ReaderOutputable RdrNameDefined in ghc-9.10.3 · GHC.Types.Name.ReaderOutputableBndr RdrNameDefined in ghc-9.10.3 · GHC.Types.Name.ReaderHasOccName RdrNameDefined in ghc-9.10.3 · GHC.Types.Name.ReaderDisambInfixOp RdrNameDefined in ghc-9.10.3 · GHC.Parser.PostProcesstype Anno RdrName = SrcSpanAnnNDefined in ghc-9.10.3 · 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-9.10.3 · GHC.Core.TyConData TyConDefined in ghc-9.10.3 · GHC.Core.TyConNamedThing TyConDefined in ghc-9.10.3 · GHC.Core.TyConOutputable TyConDefined in ghc-9.10.3 · GHC.Core.TyConUniquable TyConDefined in ghc-9.10.3 · 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
Type variables
Type or kind Variable
Data constructors
A data constructor
Instances6Eq, Data, NamedThing, Outputable, Uniquable, OutputableBndr
Eq DataConDefined in ghc-9.10.3 · GHC.Core.DataConData DataConDefined in ghc-9.10.3 · GHC.Core.DataConNamedThing DataConDefined in ghc-9.10.3 · GHC.Core.DataConOutputable DataConDefined in ghc-9.10.3 · GHC.Core.DataConUniquable DataConDefined in ghc-9.10.3 · GHC.Core.DataConOutputableBndr DataConDefined in ghc-9.10.3 · 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-9.10.3 · GHC.Core.DataConOutputable StrictnessMarkDefined in ghc-9.10.3 · GHC.Core.DataConBinary StrictnessMarkDefined in ghc-9.10.3 · GHC.Core.DataCon
Classes
Instances5Eq, Data, NamedThing, Outputable, Uniquable
Eq ClassDefined in ghc-9.10.3 · GHC.Core.ClassData ClassDefined in ghc-9.10.3 · GHC.Core.ClassNamedThing ClassDefined in ghc-9.10.3 · GHC.Core.ClassOutputable ClassDefined in ghc-9.10.3 · GHC.Core.ClassUniquable ClassDefined in ghc-9.10.3 · 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.
Instances3Data, NamedThing, Outputable
Data ClsInstDefined in ghc-9.10.3 · GHC.Core.InstEnvNamedThing ClsInstDefined in ghc-9.10.3 · GHC.Core.InstEnvOutputable ClsInstDefined in ghc-9.10.3 · GHC.Core.InstEnv
Pretty-prints a FamInst (type/data family instance) with its defining location.
Instances2NamedThing, Outputable
NamedThing FamInstDefined in ghc-9.10.3 · GHC.Core.FamInstEnvOutputable FamInstDefined in ghc-9.10.3 · 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-9.10.3 · GHC.Types.TyThingOutputable TyThingDefined in ghc-9.10.3 · GHC.Types.TyThing
Syntax
module GHC.Hs
Fixities
Instances4Eq, Data, Outputable, Binary
Eq FixityDirectionDefined in ghc-9.10.3 · GHC.Types.FixityData FixityDirectionDefined in ghc-9.10.3 · GHC.Types.FixityOutputable FixityDirectionDefined in ghc-9.10.3 · GHC.Types.FixityBinary FixityDirectionDefined in ghc-9.10.3 · GHC.Types.Fixity
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-9.10.3 · GHC.Types.FixityData LexicalFixityDefined in ghc-9.10.3 · GHC.Types.FixityOutputable LexicalFixityDefined in ghc-9.10.3 · GHC.Types.Fixity
Source locations
Source Location
Constructors
Real Source Location
Represents a single point within a file
Instances4Eq, Ord, Show, Outputable
Eq RealSrcLocDefined in ghc-9.10.3 · GHC.Types.SrcLocOrd RealSrcLocDefined in ghc-9.10.3 · GHC.Types.SrcLocShow RealSrcLocDefined in ghc-9.10.3 · GHC.Types.SrcLocOutputable RealSrcLocDefined in ghc-9.10.3 · 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.
Constructors
Instances22Eq, Data, Show, NFData, HasAnnotation, HasLoc, …
Eq SrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocData SrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocShow SrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocNFData SrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocHasAnnotation SrcSpanDefined in ghc-9.10.3 · GHC.Parser.AnnotationHasLoc SrcSpanDefined in ghc-9.10.3 · GHC.Parser.AnnotationOutputable SrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocToJson SrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocNamedThing e => NamedThing (Located e)Defined in ghc-9.10.3 · GHC.Types.NameOutputable e => Outputable (Located e)Defined in ghc-9.10.3 · GHC.Types.SrcLocOutputableBndr (Located (AmbiguousFieldOcc (GhcPass p)))Defined in ghc-9.10.3 · GHC.Hs.Type · orphan(UnXRec p, Outputable (XRec p FieldLabelString)) => OutputableBndr (Located (FieldLabelStrings p))Defined in ghc-9.10.3 · GHC.Hs.Expr · orphanHiePass p => ToHie (Located (PatSynBind (GhcPass p) (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LHsDoc GhcRn)Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Context (Located Name))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Context (Located Var))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Context (Located NoExtField))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (IEContext (Located RecFieldInfo))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Located [LocatedAn NoEpAnns (HsDerivingClause GhcRn)])Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHasHaddock (Located (HsModule GhcPs))Defined in ghc-9.10.3 · GHC.Parser.PostProcess.HaddockHasHaddock (Located [LocatedAn NoEpAnns (HsDerivingClause GhcPs)])Defined in ghc-9.10.3 · GHC.Parser.PostProcess.Haddock(UnXRec pass, OutputableBndr (XRec pass RdrName)) => OutputableBndr (GenLocated SrcSpan (FieldOcc pass))Defined in ghc-9.10.3 · 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
Instances7Eq, Data, Ord, Show, ToJson, Outputable, …
Eq RealSrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocData RealSrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocOrd RealSrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocShow RealSrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocOutputable RealSrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocToJson RealSrcSpanDefined in ghc-9.10.3 · GHC.Types.SrcLocOutputable e => Outputable (GenLocated RealSrcSpan e)Defined in ghc-9.10.3 · 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
Instances167Semigroup, HasAnnotation, NoAnn, Functor, Foldable, Traversable, …
Semigroup EpaLocationDefined in ghc-9.10.3 · GHC.Parser.AnnotationHasAnnotation EpaLocationDefined in ghc-9.10.3 · GHC.Parser.AnnotationHasLoc EpaLocationDefined in ghc-9.10.3 · GHC.Parser.AnnotationNoAnn EpaLocationDefined in ghc-9.10.3 · GHC.Parser.AnnotationFunctor (GenLocated l)Defined in ghc-9.10.3 · GHC.Types.SrcLocFoldable (GenLocated l)Defined in ghc-9.10.3 · GHC.Types.SrcLocTraversable (GenLocated l)Defined in ghc-9.10.3 · GHC.Types.SrcLocNamedThing e => NamedThing (Located e)Defined in ghc-9.10.3 · GHC.Types.NameOutputable e => Outputable (Located e)Defined in ghc-9.10.3 · GHC.Types.SrcLocOutputableBndr (Located (AmbiguousFieldOcc (GhcPass p)))Defined in ghc-9.10.3 · GHC.Hs.Type · orphan(UnXRec p, Outputable (XRec p FieldLabelString)) => OutputableBndr (Located (FieldLabelStrings p))Defined in ghc-9.10.3 · GHC.Hs.Expr · orphanHiePass p => HasType (LocatedA (HsBind (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => HasType (LocatedA (HsExpr (GhcPass p)))Defined in ghc-9.10.3 · 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-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (BindContext (LocatedA (HsBind (GhcPass p))))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (PScoped (LocatedA (Pat (GhcPass p))))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (RFContext (LocatedA (AmbiguousFieldOcc (GhcPass p))))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (RFContext (LocatedA (FieldOcc (GhcPass p))))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (RScoped (LocatedA (IPBind (GhcPass p))))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (SigContext (LocatedA (Sig (GhcPass p))))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedA (HsCmd (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedA (HsExpr (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedA (HsUntypedSplice (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (LocatedA (HsOverLit (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstHiePass p => ToHie (Located (PatSynBind (GhcPass p) (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LBooleanFormula (LocatedN Name))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LHsDoc GhcRn)Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Context (Located Name))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Context (Located Var))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Context (Located NoExtField))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Context (Located a)) => ToHie (Context (LocatedA a))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Context (Located a)) => ToHie (Context (LocatedN a))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (EvBindContext (LocatedA TcEvBinds))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (IEContext (LocatedA ModuleName))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (IEContext (LocatedA (IE GhcRn)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (IEContext (LocatedA (IEWrappedName GhcRn)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (IEContext (Located RecFieldInfo))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (RScoped (LocatedAn NoEpAnns (DerivStrategy GhcRn)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (RScoped (LocatedAn NoEpAnns (FamilyResultSig GhcRn)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (RScoped (LocatedAn NoEpAnns (RuleBndr GhcRn)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (TScoped (LocatedA (HsSigType GhcRn)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (TScoped (FamEqn GhcRn (LocatedA (HsType GhcRn))))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (TScoped (HsWildCardBndrs GhcRn (LocatedA (HsSigType GhcRn))))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (TScoped (HsWildCardBndrs GhcRn (LocatedA (HsType GhcRn))))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA SyntaxExprRn)Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA SyntaxExprTc)Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA HsWrapper)Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (FixitySig GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (AnnDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (ClsInstDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (ConDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (DataFamInstDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (DefaultDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (DerivDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (DocDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (FamilyDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (ForeignDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (FunDep GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (InstDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (RoleAnnotDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (RuleDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (RuleDecls GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (SpliceDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (StandaloneKindSig GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (TyClDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (TyFamInstDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (WarnDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (WarnDecls GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (ImportDecl GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (ConDeclField GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedA (HsType GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedC (DerivClauseTys GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedC [LocatedA (HsType GhcRn)])Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedL [LocatedA (ConDeclField GhcRn)])Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedP OverlapMode)Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (Located [LocatedAn NoEpAnns (HsDerivingClause GhcRn)])Defined in ghc-9.10.3 · GHC.Iface.Ext.AstData flag => ToHie (TVScoped (LocatedA (HsTyVarBndr flag GhcRn)))Defined in ghc-9.10.3 · 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-9.10.3 · GHC.Iface.Ext.Ast(ToHie (RFContext label), ToHie arg, HasLoc arg, Data arg, Data label) => ToHie (RContext (LocatedA (HsFieldBind label arg)))Defined in ghc-9.10.3 · 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-9.10.3 · GHC.Iface.Ext.AstHasHaddock (LocatedA (ConDecl GhcPs))Defined in ghc-9.10.3 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedA (HsDecl GhcPs))Defined in ghc-9.10.3 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedA (IE GhcPs))Defined in ghc-9.10.3 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedA (HsSigType GhcPs))Defined in ghc-9.10.3 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedA (HsType GhcPs))Defined in ghc-9.10.3 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedC (DerivClauseTys GhcPs))Defined in ghc-9.10.3 · GHC.Parser.PostProcess.HaddockHasHaddock (LocatedL [LocatedA (IE GhcPs)])Defined in ghc-9.10.3 · 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-9.10.3 · GHC.Parser.PostProcess.HaddockHasHaddock (Located [LocatedAn NoEpAnns (HsDerivingClause GhcPs)])Defined in ghc-9.10.3 · GHC.Parser.PostProcess.Haddock(Eq l, Eq e) => Eq (GenLocated l e)Defined in ghc-9.10.3 · GHC.Types.SrcLocData (GRHS GhcPs (LocatedA (HsCmd GhcPs)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHS GhcPs (LocatedA (HsExpr GhcPs)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHS GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHS GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHS GhcTc (LocatedA (HsCmd GhcTc)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHS GhcTc (LocatedA (HsExpr GhcTc)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHSs GhcPs (LocatedA (HsCmd GhcPs)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHSs GhcPs (LocatedA (HsExpr GhcPs)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHSs GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHSs GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHSs GhcTc (LocatedA (HsCmd GhcTc)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (GRHSs GhcTc (LocatedA (HsExpr GhcTc)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (Match GhcPs (LocatedA (HsCmd GhcPs)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (Match GhcPs (LocatedA (HsExpr GhcPs)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (Match GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (Match GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (Match GhcTc (LocatedA (HsCmd GhcTc)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (Match GhcTc (LocatedA (HsExpr GhcTc)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (MatchGroup GhcPs (LocatedA (HsCmd GhcPs)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (MatchGroup GhcPs (LocatedA (HsExpr GhcPs)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (MatchGroup GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (MatchGroup GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (MatchGroup GhcTc (LocatedA (HsCmd GhcTc)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (MatchGroup GhcTc (LocatedA (HsExpr GhcTc)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphan(Data l, Data e) => Data (GenLocated l e)Defined in ghc-9.10.3 · GHC.Types.SrcLoc(Ord l, Ord e) => Ord (GenLocated l e)Defined in ghc-9.10.3 · GHC.Types.SrcLoc(Show l, Show e) => Show (GenLocated l e)Defined in ghc-9.10.3 · GHC.Types.SrcLoc(NFData l, NFData e) => NFData (GenLocated l e)Defined in ghc-9.10.3 · GHC.Types.SrcLocHasLoc l => HasLoc (GenLocated l a)Defined in ghc-9.10.3 · GHC.Parser.AnnotationNamedThing (Located a) => NamedThing (LocatedAn an a)Defined in ghc-9.10.3 · GHC.Parser.AnnotationOutputable (GenLocated NoCommentsLocation EpaComment)Defined in ghc-9.10.3 · GHC.Parser.AnnotationOutputable a => Outputable (GenLocated TokenLocation a)Defined in ghc-9.10.3 · GHC.Parser.AnnotationOutputable e => Outputable (GenLocated EpaLocation e)Defined in ghc-9.10.3 · GHC.Parser.AnnotationOutputable e => Outputable (GenLocated RealSrcSpan e)Defined in ghc-9.10.3 · GHC.Types.SrcLoc(Outputable a, Outputable e) => Outputable (GenLocated (EpAnn a) e)Defined in ghc-9.10.3 · GHC.Parser.Annotation(Outputable a, OutputableBndr e) => OutputableBndr (GenLocated (EpAnn a) e)Defined in ghc-9.10.3 · GHC.Parser.Annotation(UnXRec pass, OutputableBndr (XRec pass RdrName)) => OutputableBndr (GenLocated SrcSpan (FieldOcc pass))Defined in ghc-9.10.3 · GHC.Hs.Type · orphanHiePass p => ToHie (LocatedAn NoEpAnns (HsCmdTop (GhcPass p)))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedAn NoEpAnns HsIPName)Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedAn NoEpAnns (HsDerivingClause GhcRn))Defined in ghc-9.10.3 · GHC.Iface.Ext.AstToHie (LocatedAn NoEpAnns (InjectivityAnn GhcRn))Defined in ghc-9.10.3 · 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-9.10.3 · 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-9.10.3 · 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-9.10.3 · GHC.Iface.Ext.AstHasHaddock (LocatedAn NoEpAnns (HsDerivingClause GhcPs))Defined in ghc-9.10.3 · GHC.Parser.PostProcess.HaddockData (StmtLR GhcPs GhcPs (LocatedA (HsCmd GhcPs)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (StmtLR GhcPs GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (StmtLR GhcPs GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (StmtLR GhcRn GhcRn (LocatedA (HsCmd GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (StmtLR GhcRn GhcRn (LocatedA (HsExpr GhcRn)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (StmtLR GhcTc GhcTc (LocatedA (HsCmd GhcTc)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphanData (StmtLR GhcTc GhcTc (LocatedA (HsExpr GhcTc)))Defined in ghc-9.10.3 · GHC.Hs.Instances · orphantype Anno (LocatedA (IE (GhcPass p))) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Hs.ImpExp · orphantype Anno (FamEqn p (LocatedA (HsType p))) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Hs.Decls · orphantype Anno (GRHS GhcPs (LocatedA (PatBuilder GhcPs))) = EpAnnCODefined in ghc-9.10.3 · GHC.Parser.Typestype Anno (GRHS (GhcPass p) (LocatedA (HsCmd (GhcPass p)))) = EpAnnCODefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno (GRHS (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) = EpAnnCODefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno (Match GhcPs (LocatedA (PatBuilder GhcPs))) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Parser.Typestype Anno (Match (GhcPass p) (LocatedA (HsCmd (GhcPass p)))) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs))) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Parser.Typestype Anno (StmtLR GhcRn GhcRn (LocatedA (body GhcRn))) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (body (GhcPass pr)))) = SrcSpanAnnADefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno [LocatedA (Match GhcPs (LocatedA (PatBuilder GhcPs)))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Parser.Typestype Anno [LocatedA (Match (GhcPass p) (LocatedA (HsCmd (GhcPass p))))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno [LocatedA (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p))))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno [LocatedA (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs)))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Parser.Typestype Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (HsCmd (GhcPass pr))))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (HsCmd (GhcPass pr))))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (HsCmd (GhcPass pr))))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (HsExpr (GhcPass pr))))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (body (GhcPass pr))))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (body (GhcPass pr))))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Hs.Expr · orphantype Anno [LocatedA (IE (GhcPass p))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Hs.ImpExp · orphantype Anno [LocatedA (ConDeclField (GhcPass _1))] = SrcSpanAnnLDefined in ghc-9.10.3 · GHC.Hs.Decls · orphantype Anno [LocatedA (HsType (GhcPass p))] = SrcSpanAnnCDefined in ghc-9.10.3 · 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-9.10.3 · GHC.Utils.PanicException GhcExceptionDefined in ghc-9.10.3 · 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-9.10.3 · GHCException GhcApiErrorDefined in ghc-9.10.3 · GHC
Token stream manipulations
5 declarationsInstances2Show, Outputable
Show TokenDefined in ghc-9.10.3 · GHC.Parser.LexerOutputable TokenDefined in ghc-9.10.3 · 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
2 declarationsExact print annotations exist so that tools can perform source to source conversions of Haskell code. They are used to keep track of the various syntactic keywords that are not otherwise captured in the AST.
The wiki page describing this feature is https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations https://gitlab.haskell.org/ghc/ghc/-/wikis/implementing-trees-that-grow/in-tree-api-annotations
Note: in general the names of these are taken from the corresponding token, unless otherwise noted See Note [exact print annotations] above for details of the usage
Constructors
AnnAnyclassAnnAsAnnBang!AnnBackquote'`'
AnnByAnnCasecase or lambda case
AnnCaseslambda cases
AnnClassAnnClose'#)' or '#-}' etc
AnnCloseB'|)'
AnnCloseBU'|)', unicode variant
AnnCloseC'}'
AnnCloseQ'|]'
AnnCloseQU'|]', unicode variant
AnnCloseP')'
AnnClosePH'#)'
AnnCloseS']'
AnnColonAnnCommaas a list separator
AnnCommaTuplein a RdrName for a tuple
AnnDarrow=>AnnDarrowU=>, unicode variantAnnDataAnnDcolon::AnnDcolonU::, unicode variantAnnDefaultAnnDerivingAnnDoAnnDotAnnDotdot..AnnElseAnnEqualAnnExportAnnFamilyAnnForallAnnForallUUnicode variant
AnnForeignAnnFunIdfor function name in matches where there are multiple equations for the function.
AnnGroupAnnHeaderfor CType
AnnHidingAnnIfAnnImportAnnInAnnInfixinfixorinfixlorinfixrAnnInstanceAnnLamAnnLarrow<-AnnLarrowU<-, unicode variantAnnLetAnnLollyUThe
⊸unicode arrowAnnMdoAnnMinusAnnModuleAnnNewtypeAnnNamewhere a name loses its location in the AST, this carries it
AnnOfAnnOpen'{-# DEPRECATED' etc. Opening of pragmas where the capitalisation of the string can be changed by the user. The actual text used is stored in a
SourceTexton the relevant pragma item.AnnOpenB'(|'
AnnOpenBU'(|', unicode variant
AnnOpenC'{'
AnnOpenE'[e|' or '[e||'
AnnOpenEQ'[|'
AnnOpenEQU'[|', unicode variant
AnnOpenP'('
AnnOpenS'['
AnnOpenPH'(#'
AnnDollarprefix $ -- TemplateHaskell
AnnDollarDollarprefix $$ -- TemplateHaskell
AnnPackageNameAnnPatternAnnPercent%-- for HsExplicitMultAnnPercentOne'%1' -- for HsLinearArrow
AnnProcAnnQualifiedAnnRarrow->AnnRarrowU->, unicode variantAnnRecAnnRoleAnnSafeAnnSemi';'
AnnSimpleQuote'''
AnnSignatureAnnStaticstaticAnnStockAnnThenAnnThTyQuotedouble '''
AnnTildeAnnTypeAnnUnit()for typesAnnUsingAnnVale.g. INTEGER
AnnValStrString value, will need quotes when output
AnnVbar|AnnViaviaAnnWhereAnnlarrowtail-<AnnlarrowtailU-<, unicode variantAnnrarrowtail->AnnrarrowtailU->, unicode variantAnnLarrowtail-<<AnnLarrowtailU-<<, unicode variantAnnRarrowtail>>-AnnRarrowtailU>>-, unicode variant
Instances6Eq, Data, Ord, Show, NoAnn, Outputable
Eq AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.AnnotationData AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.AnnotationOrd AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.AnnotationShow AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.AnnotationNoAnn AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.AnnotationOutputable AnnKeywordIdDefined in ghc-9.10.3 · GHC.Parser.Annotation
Constructors
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-9.10.3 · GHC.Parser.AnnotationData EpaCommentDefined in ghc-9.10.3 · GHC.Parser.AnnotationShow EpaCommentDefined in ghc-9.10.3 · GHC.Parser.AnnotationSemigroup EpaLocationDefined in ghc-9.10.3 · GHC.Parser.AnnotationHasAnnotation EpaLocationDefined in ghc-9.10.3 · GHC.Parser.AnnotationHasLoc EpaLocationDefined in ghc-9.10.3 · GHC.Parser.AnnotationNoAnn EpaLocationDefined in ghc-9.10.3 · GHC.Parser.AnnotationOutputable EpaCommentDefined in ghc-9.10.3 · GHC.Parser.AnnotationOutputable (GenLocated NoCommentsLocation EpaComment)Defined in ghc-9.10.3 · GHC.Parser.AnnotationOutputable e => Outputable (GenLocated EpaLocation e)Defined in ghc-9.10.3 · GHC.Parser.Annotation