A type for hints emitted by GHC. A hint suggests a possible way to deal with a particular warning or error.
Constructors
forall a. (Outputable a, Typeable a) => UnknownHint aAn "unknown" hint. This type constructor allows arbitrary -- hints to be embedded. The typical use case would be GHC plugins -- willing to emit hints alongside their custom diagnostics.
SuggestExtension !LanguageExtensionHintSuggests adding a particular language extension. GHC will do its best trying to guess when the user is using the syntax of a particular language extension without having the relevant extension enabled.
Example: If the user uses the keyword "mdo" (and we are in a monadic block), but the relevant extension is not enabled, GHC will emit a 'SuggestExtension RecursiveDo'.
Test case(s): parsershould_failT12429, parsershould_failT8501c, parsershould_failT18251e, ... (and many more)
SuggestCorrectPragmaName ![String]Suggests possible corrections of a misspelled pragma. Its argument represents all applicable suggestions.
Example: {-# LNGUAGE BangPatterns #-}
Test case(s): parsershould_compileT21589
SuggestMissingDoSuggests that a monadic code block is probably missing a "do" keyword.
Example: main = putStrLn "hello" putStrLn "world"
Test case(s): parsershould_failT8501a, parsershould_failreadFail007, parsershould_failInfixAppPatErr, parsershould_failT984
SuggestLetInDoSuggests that a "let" expression is needed in a "do" block.
Test cases: None (that explicitly test this particular hint is emitted).
SuggestAddSignatureCabalFile !ModuleNameSuggests to add an ".hsig" signature file to the Cabal manifest.
Triggered by: DriverUnexpectedSignature, if Cabal is being used.
Example: See comment of
DriverUnexpectedSignature.Test case(s): driver/T12955
SuggestSignatureInstantiations !ModuleName [InstantiationSuggestion]Suggests to explicitly list the instantiations for the signatures in the GHC invocation command.
Triggered by: DriverUnexpectedSignature, if Cabal is not being used.
Example: See comment of
DriverUnexpectedSignature.Test case(s): driver/T12955
SuggestUseSpacesSuggestUseWhitespaceAfter !OperatorWhitespaceSymbolSuggests adding a whitespace after the given symbol.
Examples: None Test Case(s): parsershould_compileT18834a.hs
SuggestUseWhitespaceAround !String !OperatorWhitespaceOccurrenceSuggests adding a whitespace around the given operator symbol, as it might be repurposed as special syntax by a future language extension. The second parameter is how such operator occurred, if in a prefix, suffix or tight infix position.
Triggered by: PsWarnOperatorWhitespace.
Example: h a b = a+b -- not OK, no spaces around +.
Test Case(s): parsershould_compileT18834b.hs
SuggestParenthesesSuggests wrapping an expression in parentheses
Examples: None Test Case(s): None
SuggestIncreaseMaxPmCheckModelsSuggests to increase the -fmax-pmcheck-models limit for the pattern match checker.
Triggered by: DsMaxPmCheckModelsReached
Test case(s): pmcheckshould_compileTooManyDeltas pmcheckshould_compileTooManyDeltas pmcheckshould_compileT11822
SuggestAddTypeSignatures AvailableBindingsSuggests adding a type signature, typically to resolve ambiguity or help GHC inferring types.
SuggestBindToWildcard !(LHsExpr GhcTc)Suggests to explicitly discard the result of a monadic action by binding the result to the
_wilcard.Example: main = do _ <- getCurrentTime
SuggestAddInlineOrNoInlinePragma !Var !ActivationSuggestAddPhaseToCompetingRule !RuleNameSuggestAddToHSigExportList !Name !(Maybe Module)Suggests adding an identifier to the export list of a signature.
SuggestIncreaseSimplifierIterationsSuggests increasing the limit for the number of iterations in the simplifier.
SuggestUseTypeFromDataKind (Maybe RdrName)Suggests to explicitly import Type from the
Data.Kindmodule, because using "*" to mean Type relies on the StarIsType extension, which will become deprecated in the future.Triggered by: PsWarnStarIsType Example: None Test case(s): wcompat-warnings/WCompatWarningsOn.hs
SuggestQualifiedAfterModuleNameSuggests placing the
qualifiedkeyword after the module name.Triggered by: PsWarnImportPreQualified Example: None Test case(s): module/mod184.hs
SuggestThQuotationSyntaxSuggests using TemplateHaskell quotation syntax.
Triggered by: PsErrEmptyDoubleQuotes only if TemplateHaskell is enabled. Example: None Test case(s): parsershould_failT13450TH.hs
SuggestRoles [Role]Suggests alternative roles in case we found an illegal one.
Triggered by: PsErrIllegalRoleName Example: None Test case(s): rolesshould_failRoles7.hs
SuggestQualifyStarOperatorSuggests qualifying the * operator in modules where StarIsType is enabled.
Triggered by: PsWarnStarBinder Test case(s): warningsshould_compileStarBinder.hs
SuggestTypeSignatureRemoveQualifierSuggests that for a type signature 'M.x :: ...' the qualifier should be omitted in order to be accepted by GHC.
Triggered by: PsErrInvalidTypeSignature Test case(s): module/mod98
SuggestFixOrphanInstSuggests to move an orphan instance (for a typeclass or a type or data family), or to newtype-wrap it.
Triggered by: TcRnOrphanInstance Test cases(s): warningsshould_compileT9178 typecheckshould_compileT4912 indexed-typesshould_compileT22717_fam_orph
SuggestAddStandaloneDerivationSuggests to use a standalone deriving declaration when GHC can't derive a typeclass instance in a trivial way.
Triggered by:
GHC.Tc.Errors.Types.DerivBadErrConstructorTest cases(s): typecheckshould_failtcfail086SuggestAddStandaloneKindSignature NameSuggests to add a standalone kind signature when GHC can't perform kind inference.
Triggered by: TcRnInvisBndrWithoutSig Test case(s): typecheckshould_failT22560_fail_d
SuggestFillInWildcardConstraintSuggests the user to fill in the wildcard constraint to disambiguate which constraint that is.
Example: deriving instance _ => Eq (Foo f a)
Triggered by:
GHC.Tc.Errors.Types.DerivBadErrConstructorTest cases(s): partial-sigsshould_failT13324_fail2SuggestAppropriateTHTick NameSpaceSuggests to use the appropriate Template Haskell tick: a single tick for a term-level NameSpace, or a double tick for a type-level NameSpace.
Triggered by: TcRnIncorrectNameSpace.
SuggestDumpSlicesSuggests enabling -ddump-splices to help debug an issue when a Name is not in scope or is used in multiple different namespaces (e.g. both as a data constructor and a type constructor).
Concomitant with
NoExactNameorSameNameerrors, see e.g. "GHC.Rename.Env.lookupExactOcc_either". Test cases: T5971, T7241, T13937.SuggestAddTick UntickedPromotedThingSuggests adding a tick to refer to something which has been promoted to the type level, e.g. a data constructor.
Test cases: T9778, T19984.
SuggestMoveToDeclarationSite SDoc RdrNameSomething is split off from its corresponding declaration. For example, a datatype is given a role declaration in a different module.
Test cases: T495, T8485, T2713, T5533.
SuggestSimilarNames RdrName (NonEmpty SimilarName)Suggest a similar name that the user might have meant, e.g. suggest traverse when the user has written
travrese.Test case: mod73.
RemindFieldSelectorSuppressedRemind the user that the field selector has been suppressed because of -XNoFieldSelectors.
Test cases: NFSSuppressed, records-nofieldselectors.
ImportSuggestion OccName ImportSuggestionSuggest importing from a module, removing a
hidingclause, or explain to the user that we couldn't find a module with the given ModuleName.Test cases: mod28, mod36, mod87, mod114, ...
SuggestPlacePragmaInHeaderFound a pragma in the body of a module, suggest placing it in the header.
SuggestPatternMatchingSyntaxSuggest using pattern matching syntax for a non-bidirectional pattern synonym
Test cases: patsynshould_failrecord-exquant typecheckshould_failT3176
SuggestSpecialiseVisibilityHints NameSuggest tips for making a definition visible for the purpose of writing a SPECIALISE pragma for it in a different module.
Test cases: none
SuggestRenameTypeVariableSuggest renaming implicitly quantified type variable in case it captures a term's name.
SuggestExplicitBidiPatSyn Name (LPat GhcRn) [LIdP GhcRn]SuggestSafeHaskellSuggest enabling one of the SafeHaskell modes Safe, Unsafe or Trustworthy.
SuggestRemoveRecordWildcardSuggest removing a record wildcard from a pattern when it doesn't bind anything useful.
SuggestMoveNonCanonicalDefinition Name Name StringSuggest moving a method implementation to a different instance to its superclass that defines the canonical version of the method.
SuggestIncreaseReductionDepthSuggest to increase the solver maximum reduction depth
SuggestRemoveNonCanonicalDefinition Name Name StringSuggest removing a method implementation when a superclass defines the canonical version of that method.
SuggestEtaReduceAbsDataTySyn TyConSuggest eta-reducing a type synonym used in the implementation of abstract data.
RemindRecordMissingField FastString Type TypeRemind the user that there is no field of a type and name in the record, constructors are in the usual order $x$, $r$, $a$
SuggestBindTyVarOnLhs RdrNameSuggest binding the type variable on the LHS of the type declaration
SuggestAnonymousWildcardSuggest using an anonymous wildcard instead of a named wildcard
SuggestExplicitQuantification RdrNameSuggest explicitly quantifying a type variable instead of relying on implicit quantification
SuggestBindTyVarExplicitly NameSuggest binding explicitly; e.g data T @k (a :: F k) = ....
Instances1Outputable
Outputable GhcHintDefined in ghc-9.10.3 · GHC.Types.Hint.Ppr · orphan