Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- checkDupRdrNames :: [Located RdrName] -> RnM ()
- checkShadowedRdrNames :: [Located RdrName] -> RnM ()
- checkDupNames :: [Name] -> RnM ()
- checkDupAndShadowedNames :: (GlobalRdrEnv, LocalRdrEnv) -> [Name] -> RnM ()
- dupNamesErr :: Outputable n => (n -> SrcSpan) -> NonEmpty n -> RnM ()
- checkTupSize :: Int -> TcM ()
- checkCTupSize :: Int -> TcM ()
- addFvRn :: FreeVars -> RnM (thing, FreeVars) -> RnM (thing, FreeVars)
- mapFvRn :: (a -> RnM (b, FreeVars)) -> [a] -> RnM ([b], FreeVars)
- mapMaybeFvRn :: (a -> RnM (b, FreeVars)) -> Maybe a -> RnM (Maybe b, FreeVars)
- warnUnusedMatches :: [Name] -> FreeVars -> RnM ()
- warnUnusedTypePatterns :: [Name] -> FreeVars -> RnM ()
- warnUnusedTopBinds :: [GlobalRdrElt] -> RnM ()
- warnUnusedLocalBinds :: [Name] -> FreeVars -> RnM ()
- checkUnusedRecordWildcard :: SrcSpan -> FreeVars -> Maybe [Name] -> RnM ()
- mkFieldEnv :: GlobalRdrEnv -> NameEnv (FieldLabelString, Parent)
- unknownSubordinateErr :: SDoc -> RdrName -> SDoc
- badQualBndrErr :: RdrName -> SDoc
- typeAppErr :: String -> LHsType GhcPs -> SDoc
- data HsDocContext
- = TypeSigCtx SDoc
- | StandaloneKindSigCtx SDoc
- | PatCtx
- | SpecInstSigCtx
- | DefaultDeclCtx
- | ForeignDeclCtx (Located RdrName)
- | DerivDeclCtx
- | RuleCtx FastString
- | TyDataCtx (Located RdrName)
- | TySynCtx (Located RdrName)
- | TyFamilyCtx (Located RdrName)
- | FamPatCtx (Located RdrName)
- | ConDeclCtx [Located Name]
- | ClassDeclCtx (Located RdrName)
- | ExprWithTySigCtx
- | TypBrCtx
- | HsTypeCtx
- | HsTypePatCtx
- | GHCiCtx
- | SpliceTypeCtx (LHsType GhcPs)
- | ClassInstanceCtx
- | GenericCtx SDoc
- pprHsDocContext :: HsDocContext -> SDoc
- inHsDocContext :: HsDocContext -> SDoc
- withHsDocContext :: HsDocContext -> SDoc -> SDoc
- newLocalBndrRn :: Located RdrName -> RnM Name
- newLocalBndrsRn :: [Located RdrName] -> RnM [Name]
- bindLocalNames :: [Name] -> RnM a -> RnM a
- bindLocalNamesFV :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars)
- addNameClashErrRn :: RdrName -> [GlobalRdrElt] -> RnM ()
- extendTyVarEnvFVRn :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars)
- checkInferredVars :: HsDocContext -> Maybe SDoc -> LHsSigType GhcPs -> RnM ()
- noNestedForallsContextsErr :: SDoc -> LHsType GhcRn -> Maybe (SrcSpan, SDoc)
- addNoNestedForallsContextsErr :: HsDocContext -> SDoc -> LHsType GhcRn -> RnM ()
Documentation
checkDupRdrNames :: [Located RdrName] -> RnM () Source #
checkShadowedRdrNames :: [Located RdrName] -> RnM () Source #
checkDupNames :: [Name] -> RnM () Source #
checkDupAndShadowedNames :: (GlobalRdrEnv, LocalRdrEnv) -> [Name] -> RnM () Source #
dupNamesErr :: Outputable n => (n -> SrcSpan) -> NonEmpty n -> RnM () Source #
checkTupSize :: Int -> TcM () Source #
Ensure that a boxed or unboxed tuple has arity no larger than
mAX_TUPLE_SIZE
.
checkCTupSize :: Int -> TcM () Source #
Ensure that a constraint tuple has arity no larger than mAX_CTUPLE_SIZE
.
mapMaybeFvRn :: (a -> RnM (b, FreeVars)) -> Maybe a -> RnM (Maybe b, FreeVars) Source #
warnUnusedMatches :: [Name] -> FreeVars -> RnM () Source #
warnUnusedTypePatterns :: [Name] -> FreeVars -> RnM () Source #
warnUnusedTopBinds :: [GlobalRdrElt] -> RnM () Source #
warnUnusedLocalBinds :: [Name] -> FreeVars -> RnM () Source #
checkUnusedRecordWildcard :: SrcSpan -> FreeVars -> Maybe [Name] -> RnM () Source #
Checks to see if we need to warn for -Wunused-record-wildcards or -Wredundant-record-wildcards
mkFieldEnv :: GlobalRdrEnv -> NameEnv (FieldLabelString, Parent) Source #
Make a map from selector names to field labels and parent tycon names, to be used when reporting unused record fields.
unknownSubordinateErr :: SDoc -> RdrName -> SDoc Source #
badQualBndrErr :: RdrName -> SDoc Source #
typeAppErr :: String -> LHsType GhcPs -> SDoc Source #
data HsDocContext Source #
TypeSigCtx SDoc | |
StandaloneKindSigCtx SDoc | |
PatCtx | |
SpecInstSigCtx | |
DefaultDeclCtx | |
ForeignDeclCtx (Located RdrName) | |
DerivDeclCtx | |
RuleCtx FastString | |
TyDataCtx (Located RdrName) | |
TySynCtx (Located RdrName) | |
TyFamilyCtx (Located RdrName) | |
FamPatCtx (Located RdrName) | |
ConDeclCtx [Located Name] | |
ClassDeclCtx (Located RdrName) | |
ExprWithTySigCtx | |
TypBrCtx | |
HsTypeCtx | |
HsTypePatCtx | |
GHCiCtx | |
SpliceTypeCtx (LHsType GhcPs) | |
ClassInstanceCtx | |
GenericCtx SDoc |
pprHsDocContext :: HsDocContext -> SDoc Source #
inHsDocContext :: HsDocContext -> SDoc Source #
withHsDocContext :: HsDocContext -> SDoc -> SDoc Source #
bindLocalNames :: [Name] -> RnM a -> RnM a Source #
bindLocalNamesFV :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars) Source #
addNameClashErrRn :: RdrName -> [GlobalRdrElt] -> RnM () Source #
extendTyVarEnvFVRn :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars) Source #
:: HsDocContext | |
-> Maybe SDoc | The error msg if the signature is not allowed to contain manually written inferred variables. |
-> LHsSigType GhcPs | |
-> RnM () |
Throw an error message if a user attempts to quantify an inferred type
variable in a place where specificity cannot be observed. For example,
forall {a}. [a] -> [a]
would be rejected to the inferred type variable
{a}
, but forall a. [a] -> [a]
would be accepted.
See Note [Unobservably inferred type variables]
.
noNestedForallsContextsErr :: SDoc -> LHsType GhcRn -> Maybe (SrcSpan, SDoc) Source #
Examines a non-outermost type for forall
s or contexts, which are assumed
to be nested. For example, in the following declaration:
instance forall a. forall b. C (Either a b)
The outermost forall a
is fine, but the nested forall b
is not. We
invoke noNestedForallsContextsErr
on the type forall b. C (Either a b)
to catch the nested forall
and create a suitable error message.
noNestedForallsContextsErr
returns
if such a Just
err_msgforall
or
context is found, and returns Nothing
otherwise.
This is currently used in the following places:
- In GADT constructor types (in
rnConDecl
). SeeNote [GADT abstract syntax] (Wrinkle: No nested foralls or contexts)
in GHC.Hs.Type. - In instance declaration types (in
rnClsIntDecl
andrnSrcDerivDecl
in GHC.Rename.Module andrenameSig
in GHC.Rename.Bind). SeeNote [No nested foralls or contexts in instance types]
in GHC.Hs.Type.
addNoNestedForallsContextsErr :: HsDocContext -> SDoc -> LHsType GhcRn -> RnM () Source #
A common way to invoke noNestedForallsContextsErr
.