Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Haskell.Tools.Refactor.Builtin.ExtensionOrganizer.Checkers
Synopsis
- chkViewPatterns :: CheckNode Pattern
- chkViewPatterns' :: CheckNode Pattern
- gblChkUndecidableInstances :: CheckNode Module
- gblChkUndecidableInstances' :: CheckNode Module
- chkClsInst :: ClsInst -> ExtMonad ()
- clsInstNeedsUD :: ClsInst -> Bool
- chkFamInst :: FamInst -> ExtMonad ()
- famInstNeedsUD :: FamInst -> Bool
- chkUndecidableInstancesDecl :: CheckNode Decl
- chkUndecidableInstancesDecl' :: CheckNode Decl
- chkUndecidableInstancesDeclMaybe :: Decl -> MaybeT ExtMonad Decl
- chkUnboxedTuplesExpr :: CheckNode Expr
- chkUnboxedTuplesPat :: CheckNode Pattern
- chkUnboxedTuplesType :: CheckNode Type
- chkUnboxedTuplesExpr' :: CheckNode Expr
- chkUnboxedTuplesPat' :: CheckNode Pattern
- chkUnboxedTuplesType' :: CheckNode Type
- chkTypeSynonymInstancesDecl :: CheckNode Decl
- chkInstancesDeclWith :: CheckNode InstanceRule -> CheckNode Decl
- chkInstanceRuleWith :: CheckNode InstanceHead -> CheckNode InstanceRule
- collectTyArgs :: InstanceHead -> [Type]
- chkTypeOperatorsType :: CheckNode Type
- chkTypeOperatorsAssertion :: CheckNode Assertion
- chkTypeOperatorsInstHead :: CheckNode InstanceHead
- chkTypeOperatorsDecl :: CheckNode Decl
- chkTypeOperatorsType' :: CheckNode Type
- chkTypeOperatorsAssertion' :: CheckNode Assertion
- chkTypeOperatorsInstHead' :: CheckNode InstanceHead
- chkTypeOperatorsDecl' :: CheckNode Decl
- isOperatorM :: DeclHead -> ExtMonad Bool
- gblChkQNamesForTypeEq :: CheckNode Module
- chkOperatorForTypeEq :: CheckNode Operator
- chkTypeFamiliesDecl :: CheckNode Decl
- chkTypeFamiliesClassElement :: CheckNode ClassElement
- chkTypeFamiliesInstBodyDecl :: CheckNode InstBodyDecl
- chkTypeFamiliesDecl' :: CheckNode Decl
- chkTypeFamiliesClassElement' :: CheckNode ClassElement
- chkTypeFamiliesInstBodyDecl' :: CheckNode InstBodyDecl
- chkOperatorForTypeEq' :: CheckNode Operator
- chkQNameForTyEqn :: QualifiedName -> MaybeT ExtMonad Bool
- gblChkQNamesForTypeEq' :: CheckNode Module
- chkTupleSections :: CheckNode Expr
- chkTupleSections' :: CheckNode Expr
- chkTemplateHaskellSplice :: CheckNode Splice
- chkTemplateHaskellQuasiQuote :: CheckNode QuasiQuote
- chkTemplateHaskellBracket :: CheckNode Bracket
- chkTemplateHaskellhNamePart :: CheckNode NamePart
- chkTemplateHaskellNamePart' :: CheckNode NamePart
- chkRecursiveDoExpr :: CheckNode Expr
- chkRecursiveDoStmt :: CheckNode Stmt
- chkRecordWildCardsPatField :: CheckNode PatternField
- chkRecordWildCardsFieldUpdate :: CheckNode FieldUpdate
- chkPatternSynonymsSyn :: CheckNode PatternSynonym
- chkPatternSynonymsSyn' :: CheckNode PatternSynonym
- chkPatternSynonymsTypeSig :: CheckNode PatternSignature
- chkParallelListComp :: CheckNode Expr
- chkOverloadedStringsLiteral :: CheckNode Literal
- chkMultiWayIfExpr :: CheckNode Expr
- chkMultiWayIfExpr' :: CheckNode Expr
- chkMultiParamTypeClassesDecl :: CheckNode Decl
- chkMultiParamTypeClassesDecl' :: CheckNode Decl
- collectTyVars :: DeclHead -> [TyVar]
- isMultiParamNeeded :: InstanceHead -> Bool
- chkMagicHashLiteral :: CheckNode Literal
- chkMagicHashNamePart :: CheckNode NamePart
- chkMagicHashKind :: CheckNode Kind
- chkMagicHashLiteral' :: CheckNode Literal
- chkMagicHashNamePart' :: CheckNode NamePart
- chkMagicHashKind' :: CheckNode Kind
- chkLambdaCase :: CheckNode Expr
- chkLambdaCase' :: CheckNode Expr
- chkKindSignaturesKind :: CheckNode Kind
- chkGADTsGadtConDecl :: CheckNode GadtConDecl
- chkConDeclForExistentials :: CheckNode ConDecl
- chkGADTsGadtConDecl' :: CheckNode GadtConDecl
- chkConDeclForExistentials' :: CheckNode ConDecl
- chkFunDeps :: CheckNode FunDepList
- gblChkQNamesForFC :: CheckNode Module
- chkFlexibleContexts :: CheckNode Context
- chkFlexibleContexts' :: CheckNode Context
- chkAssertion :: CheckNode Assertion
- chkFlexibleContextsDecl :: CheckNode Decl
- chkFlexibleContextsDecl' :: CheckNode Decl
- chkClassesInside :: Type -> ExtMonad ()
- chkQNameForFC :: QualifiedName -> ExtMonad Bool
- gblChkQNamesForFC' :: CheckNode Module
- chkFlexibleInstancesDecl :: CheckNode Decl
- refact :: (Data (node dom stage), Data (inner dom stage)) => (inner dom stage -> inner dom stage) -> node dom stage -> node dom stage
- chkInstanceHead :: CheckNode InstanceHead
- chkTypeArg :: Class -> Type -> ExtMonad Type
- chkNormalTypeArg :: CheckNode Type
- rmTypeMisc :: Type -> Type
- tyArgNeedsFI :: Class -> Type -> Bool
- hasOnlyDistinctTyVars :: Type -> Bool
- dropCasts :: Type -> Type
- dropCastsB :: TyVarBinder -> TyVarBinder
- chkExplicitNamespacesIESpec :: CheckNode IESpec
- chkExplicitForAllType :: CheckNode Type
- chkExplicitForAllConDecl :: CheckNode ConDecl
- chkExplicitForAllGadtConDecl :: CheckNode GadtConDecl
- chkQuantifiedTyVarsWith :: HasRange a => (a -> TyVarList) -> CheckNode a
- isStockClass :: Name -> Bool
- stockClasses :: [Name]
- gndNotNeeded :: Name -> Bool
- gndNotNeededClasses :: [Name]
- gndNeeded :: Name -> Bool
- gndNeededClasses :: [Name]
- gndNotAllowed :: Name -> Bool
- gndNotAllowedClasses :: [Name]
- whichExtension :: Name -> Maybe Extension
- nameExtensionMap :: Map Name Extension
- chkDerivings :: CheckNode Decl
- chkDataDecl :: CheckNode Decl
- chkGADTDataDecl :: CheckNode Decl
- chkDataInstance :: CheckNode Decl
- separateByKeyword :: DataOrNewtypeKeyword -> CheckNode Deriving
- getStrategy :: Deriving -> Maybe DeriveStrategy
- addExtension :: (MonadState ExtMap m, HasRange node) => Name -> node -> m node
- addStockExtension :: CheckNode InstanceHead
- chkByStrat :: CheckNode InstanceHead -> CheckNode Deriving
- chkStrat :: DeriveStrategy -> CheckNode InstanceHead
- chkDerivingClause :: CheckNode InstanceHead -> CheckNode Deriving
- nameFromStock :: InstanceHead -> Maybe Name
- chkClassForData :: CheckNode InstanceHead
- chkClassForNewtype :: CheckNode InstanceHead
- skipParens :: InstanceHead -> InstanceHead
- chkStandaloneDeriving :: CheckNode Decl
- decompRule :: InstanceRule -> (InstanceHead, Type)
- getClassCon :: InstanceHead -> InstanceHead
- rightmostType :: InstanceHead -> Type
- isSynNewType :: Type -> ExtMonad Bool
- chkDefaultSigs :: CheckNode ClassElement
- gblChkCPP :: CheckNode Module
- gblChkCPP' :: CheckNode Module
- rmDefaultIncludes :: FilePath -> String -> String
- preprocessedSrc :: ModSummary -> String
- strBufToStr :: StringBuffer -> String
- chkConstrainedClassMethodsDecl :: CheckNode Decl
- chkCCMDeclHead :: CheckNode DeclHead
- chkCCMDeclHead' :: DeclHead -> MaybeT ExtMonad Bool
- classNeedsCCM :: Class -> Bool
- chkConstraintKindsDecl :: CheckNode Decl
- chkConstraintKindsDecl' :: CheckNode Decl
- hasTyVarHeadAsserts :: Context -> Bool
- hasAnyTyVarHeads :: Assertion -> Bool
- chkBangPatterns :: CheckNode Pattern
- chkBangPatterns' :: CheckNode Pattern
- chkArrowsExpr :: CheckNode Expr
- chkArrowsCmd :: CheckNode Cmd
Documentation
gblChkUndecidableInstances :: CheckNode Module Source #
If UndecidableInstances is turned on, it checks whether any type class or type family instances needs UndecidableInstances in the module.
gblChkUndecidableInstances' :: CheckNode Module Source #
Checks whether any type class or type family instances needs UndecidableInstances in the module.
chkClsInst :: ClsInst -> ExtMonad () Source #
If the type class instance requires UndecidableInstances, it adds the occurence with location of the instance.
clsInstNeedsUD :: ClsInst -> Bool Source #
Decides whether a type class instance requires UndecidableInstances.
chkFamInst :: FamInst -> ExtMonad () Source #
If the type class instance requires UndecidableInstances, it adds the occurence with location of the instance.
famInstNeedsUD :: FamInst -> Bool Source #
Decides whether a family instance requires UndecidableInstances. If it is a data family instance, it does not need the extension.
chkUndecidableInstancesDecl :: CheckNode Decl Source #
Checks a declaration whether it needs UndecidableInstances. (If the extension is turned on)
chkUndecidableInstancesDecl' :: CheckNode Decl Source #
Checks a declaration whether it needs UndecidableInstances. If a lookup is not successful, it keeps the extension.
chkUndecidableInstancesDeclMaybe :: Decl -> MaybeT ExtMonad Decl Source #
Checks a class declaration whether it has a type function in its context, or a closed type family declaration needs UndecidableInstances. For more information on the family check, see checkFamInstRhs. May fail on lookup.
chkTypeSynonymInstancesDecl :: CheckNode Decl Source #
We need to check declarations because we want to avoid checking type family instances
chkInstancesDeclWith :: CheckNode InstanceRule -> CheckNode Decl Source #
Checks an instance rule in declaration We need to check declarations because we want to avoid checking type family instances
chkInstanceRuleWith :: CheckNode InstanceHead -> CheckNode InstanceRule Source #
Checks and instance head in an instance rule
collectTyArgs :: InstanceHead -> [Type] Source #
Collects the type arguments in an instance declaration Type arguments are the the types that the class is being instantiated with
chkTypeOperatorsType :: CheckNode Type Source #
Checks a Type whether it contains any DeclHeads that amy need TypeOperators
chkTypeOperatorsAssertion :: CheckNode Assertion Source #
Checks an Assertion whether it contains any DeclHeads that amy need TypeOperators
chkTypeOperatorsInstHead :: CheckNode InstanceHead Source #
Checks an InstanceHEad whether it contains any DeclHeads that amy need TypeOperators
chkTypeOperatorsDecl :: CheckNode Decl Source #
Checks a Decl whether it contains any DeclHeads that amy need TypeOperators We check Decls to avoid getting multiple occurences of the same DeclHead (e.g. we would check it with and without parentheses)
gblChkQNamesForTypeEq :: CheckNode Module Source #
Checks whether any name's corresponding type in the module contains a type equality.
chkOperatorForTypeEq :: CheckNode Operator Source #
Checks an operator for syntactic evidence of a ~ b type equality if TypeFamilies or GADTs is turned on.
chkTypeFamiliesDecl :: CheckNode Decl Source #
Checks a declaration if TypeFamilies is turned on.
chkTypeFamiliesClassElement :: CheckNode ClassElement Source #
Checks a class element if TypeFamilies is turned on.
chkTypeFamiliesInstBodyDecl :: CheckNode InstBodyDecl Source #
Checks an instance body if TypeFamilies is turned on.
chkQNameForTyEqn :: QualifiedName -> MaybeT ExtMonad Bool Source #
Checks whether a given name's has a type equality operator in it. If the type lookup fails, it returns Nothing. If given a type variable, it returns False.
chkMultiParamTypeClassesDecl' :: CheckNode Decl Source #
Decides whether a class or instance declaration needs MultiParamTypeClasses Also handles the NullaryTypeClasses case
collectTyVars :: DeclHead -> [TyVar] Source #
isMultiParamNeeded :: InstanceHead -> Bool Source #
Decides whether an instance declaration needs MultiParamTypeClasses Also handles the NullaryTypeClasses case
chkGADTsGadtConDecl :: CheckNode GadtConDecl Source #
Checks a GADT-style constructor if GADTSyntax is turned on. Sometimes GADTSyntax is sufficient and GADTs is not even needed.
chkConDeclForExistentials :: CheckNode ConDecl Source #
Checks a data constructor declaration if GADTs or ExistentialQuantification is turned on. This function is responsible for checking ExistentialQuantification as well. (there is no separate checker for that extension)
chkGADTsGadtConDecl' :: CheckNode GadtConDecl Source #
Checks whether a GADTs-style constructor declaration requires GADTs. If all data constructors are vanilla Haskell 98 data constructors , then only GADTSyntax is needed. If any constructor's lookup fails , we add MissingInformation.
chkConDeclForExistentials' :: CheckNode ConDecl Source #
Extracts the name from a ConDecl, and checks whether it is a vanilla data constructor. Ifthe lookup fails, adds MissingInformation.
chkClassesInside :: Type -> ExtMonad () Source #
Checks whether all type class applications in a type synonym rhs (that has kind Constraint) have only type variable heads. Returns False if a lookup inside is not succesful. If it isn't applied to a type that has kind Constraint, it may give false positive results.
chkFlexibleInstancesDecl :: CheckNode Decl Source #
We need to check declarations because we want to avoid checking type family instances
refact :: (Data (node dom stage), Data (inner dom stage)) => (inner dom stage -> inner dom stage) -> node dom stage -> node dom stage Source #
chkInstanceHead :: CheckNode InstanceHead Source #
Checks every single type argument in an instance declaration If the class being instantiated could not have been looked up, it keeps FlexibleInstances
chkTypeArg :: Class -> Type -> ExtMonad Type Source #
Checks a type argument of class whether it needs FlexibleInstances First checks the structure of the type argument opaquely Then, for type synonyms, it checks whether their GHC representation itself needs the extension.
Might find false positive occurences for phantom types: > type Phantom a b = [a] > instance C (Phantom a a) > instance C (Phantom a Int)
chkNormalTypeArg :: CheckNode Type Source #
Checks a type argument of class whether it has only (distinct) type variable arguments.
rmTypeMisc :: Type -> Type Source #
hasOnlyDistinctTyVars :: Type -> Bool Source #
Checks whether a GHC.Type is an application, and has only (distinct) type variable arguments Logic from TcValidity.tcInstHeadTyAppAllTyVars
dropCastsB :: TyVarBinder -> TyVarBinder Source #
A local helper function from TcValidity
isStockClass :: Name -> Bool Source #
stockClasses :: [Name] Source #
gndNotNeeded :: Name -> Bool Source #
gndNotNeededClasses :: [Name] Source #
gndNeededClasses :: [Name] Source #
gndNotAllowed :: Name -> Bool Source #
gndNotAllowedClasses :: [Name] Source #
addExtension :: (MonadState ExtMap m, HasRange node) => Name -> node -> m node Source #
nameFromStock :: InstanceHead -> Maybe Name Source #
decompRule :: InstanceRule -> (InstanceHead, Type) Source #
rightmostType :: InstanceHead -> Type Source #
preprocessedSrc :: ModSummary -> String Source #
Returns the preprocessed source code. If it is not present, it returns an empty string.
strBufToStr :: StringBuffer -> String Source #
chkCCMDeclHead :: CheckNode DeclHead Source #
Check a DeclHead for ConstrainedClassMethods. Adds the extension if it is needed or the lookup fails.
classNeedsCCM :: Class -> Bool Source #
Decides whether a class really needs the ConstrainedClassMethods extension A class needs CCM iff at least one of its class methods has a constraint with a non-empty type variable set, that contains only class type variables.
hasTyVarHeadAsserts :: Context -> Bool Source #
hasAnyTyVarHeads :: Assertion -> Bool Source #