Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Haskell.Tools.Rewrite.Match.Decls
Contents
Description
UPattern matching on declaration-level AST fragments for refactorings.
Synopsis
- pattern TypeDecl :: DeclHead -> Type -> Decl
- pattern StandaloneDeriving :: Maybe DeriveStrategy -> Maybe OverlapPragma -> InstanceRule -> Decl
- pattern FixityDecl :: FixitySignature -> Decl
- pattern DefaultDecl :: TypeList -> Decl
- pattern TypeSigDecl :: TypeSignature -> Decl
- pattern ValueBinding :: ValueBind -> Decl
- pattern SpliceDecl :: Splice -> Decl
- pattern DataDecl :: DataOrNewtypeKeyword -> MaybeContext -> DeclHead -> ConDeclList -> DerivingList -> Decl
- pattern GADTDataDecl :: DataOrNewtypeKeyword -> MaybeContext -> DeclHead -> MaybeKindConstraint -> AnnList UGadtConDecl -> DerivingList -> Decl
- pattern GadtConDecl :: NameList -> Type -> GadtConDecl
- pattern GadtRecordConDecl :: NameList -> FieldDeclList -> Type -> GadtConDecl
- pattern ConDecl :: Name -> TypeList -> ConDecl
- pattern RecordConDecl :: Name -> FieldDeclList -> ConDecl
- pattern InfixConDecl :: Type -> Operator -> Type -> ConDecl
- pattern FieldDecl :: NameList -> Type -> FieldDecl
- pattern DerivingOne :: InstanceHead -> Deriving
- pattern DerivingOne' :: MaybeDeriveStrategy -> InstanceHead -> Deriving
- pattern DerivingMulti :: InstanceHeadList -> Deriving
- pattern DerivingMulti' :: MaybeDeriveStrategy -> InstanceHeadList -> Deriving
- pattern DataKeyword :: DataOrNewtypeKeyword
- pattern NewtypeKeyword :: DataOrNewtypeKeyword
- pattern FunDeps :: FunDepList -> FunDeps
- pattern FunDep :: NameList -> NameList -> FunDep
- pattern ClassDecl :: MaybeContext -> DeclHead -> MaybeFunDeps -> MaybeClassBody -> Decl
- pattern ClassBody :: ClassElementList -> ClassBody
- pattern ClassElemSig :: TypeSignature -> ClassElement
- pattern ClassElemDef :: ValueBind -> ClassElement
- pattern ClassElemTypeFam :: DeclHead -> MaybeTypeFamilySpec -> ClassElement
- pattern ClassElemDataFam :: DeclHead -> MaybeKindConstraint -> ClassElement
- pattern ClsDefaultType :: DeclHead -> Type -> ClassElement
- pattern ClsDefaultSig :: Name -> Type -> ClassElement
- pattern ClsMinimal :: MinimalFormula -> ClassElement
- pattern MinimalName :: Name -> MinimalFormula
- pattern MinimalParen :: MinimalFormula -> MinimalFormula
- pattern MinimalOr :: MinimalFormulaList -> MinimalFormula
- pattern MinimalAnd :: MinimalFormulaList -> MinimalFormula
- pattern NameDeclHead :: Name -> DeclHead
- pattern ParenDeclHead :: DeclHead -> DeclHead
- pattern DeclHeadApp :: DeclHead -> TyVar -> DeclHead
- pattern InfixDeclHead :: TyVar -> Operator -> TyVar -> DeclHead
- pattern InstanceDecl :: InstanceRule -> MaybeInstBody -> Decl
- pattern InstanceBody :: InstBodyDeclList -> InstBody
- pattern InstanceBind :: ValueBind -> InstBodyDecl
- pattern InstanceTypeSig :: TypeSignature -> InstBodyDecl
- pattern InstanceTypeFamilyDef :: TypeEqn -> InstBodyDecl
- pattern InstanceDataFamilyDef :: DataOrNewtypeKeyword -> InstanceRule -> ConDeclList -> DerivingList -> InstBodyDecl
- pattern InstanceDataFamilyGADTDef :: DataOrNewtypeKeyword -> InstanceRule -> MaybeKindConstraint -> AnnList UGadtConDecl -> DerivingList -> InstBodyDecl
- pattern InstanceSpecializePragma :: Type -> InstBodyDecl
- pattern InstanceRule :: AnnMaybe (AnnListG UTyVar) -> MaybeContext -> InstanceHead -> InstanceRule
- pattern InstanceHead :: Name -> InstanceHead
- pattern InfixInstanceHead :: Type -> Operator -> InstanceHead
- pattern ParenInstanceHead :: InstanceHead -> InstanceHead
- pattern AppInstanceHead :: InstanceHead -> Type -> InstanceHead
- pattern EnableOverlap :: OverlapPragma
- pattern DisableOverlap :: OverlapPragma
- pattern Overlappable :: OverlapPragma
- pattern Overlapping :: OverlapPragma
- pattern Overlaps :: OverlapPragma
- pattern IncoherentOverlap :: OverlapPragma
- pattern RoleDecl :: QualifiedName -> RoleList -> Decl
- pattern NominalRole :: Role
- pattern RepresentationalRole :: Role
- pattern PhantomRole :: Role
- pattern ForeignImport :: CallConv -> MaybeSafety -> Name -> Type -> Decl
- pattern ForeignExport :: CallConv -> Name -> Type -> Decl
- pattern StdCall :: CallConv
- pattern CCall :: CallConv
- pattern CApi :: CallConv
- pattern Unsafe :: Safety
- pattern PatternSynonym :: PatSynLhs -> PatSynRhs -> Decl
- pattern ConPatSyn :: Name -> NameList -> PatSynLhs
- pattern InfixPatSyn :: Name -> Operator -> Name -> PatSynLhs
- pattern RecordPatSyn :: Name -> NameList -> PatSynLhs
- pattern SymmetricPatSyn :: Pattern -> PatSynRhs
- pattern OneWayPatSyn :: Pattern -> PatSynRhs
- pattern TwoWayPatSyn :: Pattern -> MatchList -> PatSynRhs
- pattern PatternSignatureDecl :: PatternSignature -> Decl
- pattern PatternSignature :: NameList -> Type -> PatternSignature
- pattern TypeFamily :: DeclHead -> MaybeTypeFamilySpec -> Decl
- pattern DataFamily :: DeclHead -> MaybeKindConstraint -> Decl
- pattern TypeInstance :: InstanceRule -> Type -> Decl
- pattern DataInstance :: DataOrNewtypeKeyword -> InstanceRule -> ConDeclList -> DerivingList -> Decl
- pattern GadtDataInstance :: DataOrNewtypeKeyword -> InstanceRule -> MaybeKindConstraint -> GadtConDeclList -> Decl
- pattern ClosedTypeFamily :: DeclHead -> MaybeTypeFamilySpec -> TypeEqnList -> Decl
- pattern TypeFamilyKindSpec :: KindConstraint -> TypeFamilySpec
- pattern TypeFamilyInjectivitySpec :: TyVar -> NameList -> TypeFamilySpec
- pattern TypeEqn :: Type -> Type -> TypeEqn
- pattern PragmaDecl :: TopLevelPragma -> Decl
- pattern RulePragma :: RuleList -> TopLevelPragma
- pattern DeprPragma :: NameList -> String -> TopLevelPragma
- pattern WarningPragma :: NameList -> String -> TopLevelPragma
- pattern AnnPragma :: AnnotationSubject -> Expr -> TopLevelPragma
- pattern InlinePragma :: MaybeConlikeAnnot -> MaybePhaseControl -> Name -> TopLevelPragma
- pattern NoInlinePragma :: Name -> TopLevelPragma
- pattern InlinablePragma :: MaybePhaseControl -> Name -> TopLevelPragma
- pattern LinePragma :: Int -> MaybeStringNode -> TopLevelPragma
- pattern SpecializePragma :: MaybePhaseControl -> Name -> TypeList -> TopLevelPragma
- pattern PhaseControlFrom :: Integer -> PhaseControl
- pattern PhaseControlUntil :: Integer -> PhaseControl
- pattern RewriteRule :: String -> MaybePhaseControl -> RuleVarList -> Expr -> Expr -> Rule
- pattern NameAnnotation :: Name -> AnnotationSubject
- pattern TypeAnnotation :: Name -> AnnotationSubject
- pattern ModuleAnnotation :: AnnotationSubject
- pattern ConlikeAnnotation :: ConlikeAnnot
Declarations
pattern StandaloneDeriving :: Maybe DeriveStrategy -> Maybe OverlapPragma -> InstanceRule -> Decl Source #
Standalone deriving declaration ( deriving instance X T
)
pattern FixityDecl :: FixitySignature -> Decl Source #
Fixity declaration ( infixl 5 +, -
)
pattern DefaultDecl :: TypeList -> Decl Source #
Default types ( default (T1, T2)
)
pattern TypeSigDecl :: TypeSignature -> Decl Source #
Type signature declaration ( f :: Int -> Int
)
pattern ValueBinding :: ValueBind -> Decl Source #
Function or value binding ( f x = 12
)
pattern SpliceDecl :: Splice -> Decl Source #
A Template Haskell splice declaration ( $(generateDecls)
)
Data type definitions
pattern DataDecl :: DataOrNewtypeKeyword -> MaybeContext -> DeclHead -> ConDeclList -> DerivingList -> Decl Source #
A data or newtype declaration. Empty data type declarations without where keyword are always belong to DataDecl.
pattern GADTDataDecl :: DataOrNewtypeKeyword -> MaybeContext -> DeclHead -> MaybeKindConstraint -> AnnList UGadtConDecl -> DerivingList -> Decl Source #
A GADT-style data or newtype declaration.
pattern GadtConDecl :: NameList -> Type -> GadtConDecl Source #
GADT constructor declaration ( D1 :: Int -> T String
)
pattern GadtRecordConDecl :: NameList -> FieldDeclList -> Type -> GadtConDecl Source #
GADT constructor declaration with record syntax ( D1 :: { val :: Int } -> T String
)
pattern RecordConDecl :: Name -> FieldDeclList -> ConDecl Source #
Creates a record data constructor ( Point { x :: Double, y :: Double }
)
pattern InfixConDecl :: Type -> Operator -> Type -> ConDecl Source #
Infix data constructor ( t1 :+: t2
)
pattern DerivingOne :: InstanceHead -> Deriving Source #
A deriving clause without parentheses ( deriving Show
.
pattern DerivingOne' :: MaybeDeriveStrategy -> InstanceHead -> Deriving Source #
A deriving clause without parentheses, with/witohut strategy ( deriving stock Show
.
pattern DerivingMulti :: InstanceHeadList -> Deriving Source #
A deriving clause with parentheses deriving (Show, Eq)
)
pattern DerivingMulti' :: MaybeDeriveStrategy -> InstanceHeadList -> Deriving Source #
A deriving clause with parentheses, with/witohut strategy ( deriving stock (Show, Eq)
.
pattern DataKeyword :: DataOrNewtypeKeyword Source #
pattern NewtypeKeyword :: DataOrNewtypeKeyword Source #
pattern FunDeps :: FunDepList -> FunDeps Source #
A list of functional dependencies: | a -> b, c -> d
separated by commas
pattern FunDep :: NameList -> NameList -> FunDep Source #
A functional dependency, given on the form l1 ... ln -> r1 ... rn
Type class declarations
pattern ClassDecl :: MaybeContext -> DeclHead -> MaybeFunDeps -> MaybeClassBody -> Decl Source #
Type class declaration ( class X a [where f = ...]
)
pattern ClassBody :: ClassElementList -> ClassBody Source #
The list of declarations that can appear in a typeclass
pattern ClassElemSig :: TypeSignature -> ClassElement Source #
Type signature: f :: A -> B
as a class member
pattern ClassElemDef :: ValueBind -> ClassElement Source #
Default binding: f x = "aaa"
as a class member
pattern ClassElemTypeFam :: DeclHead -> MaybeTypeFamilySpec -> ClassElement Source #
Declaration of an associated type synonym: type T x :: *
in a class
pattern ClassElemDataFam :: DeclHead -> MaybeKindConstraint -> ClassElement Source #
Declaration of an associated data synonym: data T x :: *
in a class
pattern ClsDefaultType :: DeclHead -> Type -> ClassElement Source #
Default choice for type synonym: type T x = TE
or type instance T x = TE
in a class
pattern ClsDefaultSig :: Name -> Type -> ClassElement Source #
Default signature (by using DefaultSignatures
): default enum :: (Generic a, GEnum (Rep a)) => [a]
pattern ClsMinimal :: MinimalFormula -> ClassElement Source #
Minimal pragma: {-# MINIMAL (==) | (/=) #-}
in a class
pattern MinimalName :: Name -> MinimalFormula Source #
pattern MinimalParen :: MinimalFormula -> MinimalFormula Source #
pattern MinimalOr :: MinimalFormulaList -> MinimalFormula Source #
One of the minimal formulas are needed ( min1 | min2
)
pattern MinimalAnd :: MinimalFormulaList -> MinimalFormula Source #
Both of the minimal formulas are needed ( min1 , min2
)
Declaration heads
pattern NameDeclHead :: Name -> DeclHead Source #
Type or class name as a declaration head
pattern ParenDeclHead :: DeclHead -> DeclHead Source #
Parenthesized type as a declaration head
pattern InfixDeclHead :: TyVar -> Operator -> TyVar -> DeclHead Source #
Infix type application as a declaration head
Type class instance declarations
pattern InstanceDecl :: InstanceRule -> MaybeInstBody -> Decl Source #
Instance declaration ( instance X T [where f = ...]
)
pattern InstanceBody :: InstBodyDeclList -> InstBody Source #
Instance body is the implementation of the class functions ( where a x = 1; b x = 2
)
pattern InstanceBind :: ValueBind -> InstBodyDecl Source #
A normal value binding ( f x = 12
) inside a class instance
pattern InstanceTypeSig :: TypeSignature -> InstBodyDecl Source #
Type signature in instance definition with InstanceSigs
pattern InstanceTypeFamilyDef :: TypeEqn -> InstBodyDecl Source #
An associated type definition ( type A X = B
) in a class instance
pattern InstanceDataFamilyDef :: DataOrNewtypeKeyword -> InstanceRule -> ConDeclList -> DerivingList -> InstBodyDecl Source #
An associated data definition ( data A X = B Int | C
) in a class instance
pattern InstanceDataFamilyGADTDef :: DataOrNewtypeKeyword -> InstanceRule -> MaybeKindConstraint -> AnnList UGadtConDecl -> DerivingList -> InstBodyDecl Source #
An associated data definition as a GADT ( data A X where B :: Int -> A X
) in a class instance
pattern InstanceSpecializePragma :: Type -> InstBodyDecl Source #
Specialize instance pragma in a class instance (no phase selection is allowed)
pattern InstanceRule :: AnnMaybe (AnnListG UTyVar) -> MaybeContext -> InstanceHead -> InstanceRule Source #
Instance head as an instance rule ( X a => Y a
)
pattern InstanceHead :: Name -> InstanceHead Source #
Type or class name as an instance head
pattern InfixInstanceHead :: Type -> Operator -> InstanceHead Source #
Infix application of the type/class name to the left operand as an instance head
pattern ParenInstanceHead :: InstanceHead -> InstanceHead Source #
Parenthesized instance head
pattern AppInstanceHead :: InstanceHead -> Type -> InstanceHead Source #
Type application as an instance head
pattern EnableOverlap :: OverlapPragma Source #
OVERLAP
pragma
pattern DisableOverlap :: OverlapPragma Source #
NO_OVERLAP
pragma
pattern Overlappable :: OverlapPragma Source #
OVERLAPPABLE
pragma
pattern Overlapping :: OverlapPragma Source #
OVERLAPPING
pragma
pattern Overlaps :: OverlapPragma Source #
OVERLAPS
pragma
pattern IncoherentOverlap :: OverlapPragma Source #
INCOHERENT
pragma
Type roles
pattern RoleDecl :: QualifiedName -> RoleList -> Decl Source #
Role annotations ( type role Ptr representational
)
pattern NominalRole :: Role Source #
pattern RepresentationalRole :: Role Source #
pattern PhantomRole :: Role Source #
Foreign imports and exports
pattern ForeignImport :: CallConv -> MaybeSafety -> Name -> Type -> Decl Source #
Foreign import ( foreign import foo :: Int -> IO Int
)
pattern ForeignExport :: CallConv -> Name -> Type -> Decl Source #
Foreign export ( foreign export ccall foo :: Int -> IO Int
)
Pattern synonyms
pattern PatternSynonym :: PatSynLhs -> PatSynRhs -> Decl Source #
Pattern synonyms ( pattern Arrow t1 t2 = App "->" [t1, t2]
)
pattern ConPatSyn :: Name -> NameList -> PatSynLhs Source #
A left hand side with a constructor name and arguments ( Arrow t1 t2
)
pattern InfixPatSyn :: Name -> Operator -> Name -> PatSynLhs Source #
An infix pattern synonym left-hand side ( t1 :+: t2
)
pattern RecordPatSyn :: Name -> NameList -> PatSynLhs Source #
A record-style pattern synonym left-hand side ( Arrow { arrowFrom, arrowTo }
)
pattern SymmetricPatSyn :: Pattern -> PatSynRhs Source #
An automatically two-way pattern synonym ( = App "Int" []
)
pattern OneWayPatSyn :: Pattern -> PatSynRhs Source #
A pattern synonym that can be only used for pattenr matching but not for combining ( <- App "Int" []
)
pattern TwoWayPatSyn :: Pattern -> MatchList -> PatSynRhs Source #
A pattern synonym with the other direction explicitly specified ( <- App "Int" [] where Int = App "Int" []
)
pattern PatternSignatureDecl :: PatternSignature -> Decl Source #
Pattern type signature declaration ( pattern Succ :: Int -> Int
)
pattern PatternSignature :: NameList -> Type -> PatternSignature Source #
Type families
pattern TypeFamily :: DeclHead -> MaybeTypeFamilySpec -> Decl Source #
Type family declaration ( type family A a :: * -> *
)
pattern DataFamily :: DeclHead -> MaybeKindConstraint -> Decl Source #
Data family declaration ( data family A a :: * -> *
)
pattern TypeInstance :: InstanceRule -> Type -> Decl Source #
Type family instance declaration ( type instance Fam T = AssignedT
)
pattern DataInstance :: DataOrNewtypeKeyword -> InstanceRule -> ConDeclList -> DerivingList -> Decl Source #
Data instance declaration ( data instance Fam T = Con1 | Con2
)
pattern GadtDataInstance :: DataOrNewtypeKeyword -> InstanceRule -> MaybeKindConstraint -> GadtConDeclList -> Decl Source #
GADT-style data instance declaration ( data instance Fam T where ...
)
pattern ClosedTypeFamily :: DeclHead -> MaybeTypeFamilySpec -> TypeEqnList -> Decl Source #
A closed type family declaration
pattern TypeFamilyKindSpec :: KindConstraint -> TypeFamilySpec Source #
Specifies the kind of a type family ( :: * -> *
)
pattern TypeFamilyInjectivitySpec :: TyVar -> NameList -> TypeFamilySpec Source #
Specifies the injectivity of a type family ( = r | r -> a
)
pattern TypeEqn :: Type -> Type -> TypeEqn Source #
Type equations as found in closed type families ( T A = S
)
Top level pragmas
pattern PragmaDecl :: TopLevelPragma -> Decl Source #
Top-level pragmas
pattern RulePragma :: RuleList -> TopLevelPragma Source #
A pragma that introduces source rewrite rules ( {-# RULES "map/map" [2] forall f g xs. map f (map g xs) = map (f.g) xs #-}
)
pattern DeprPragma :: NameList -> String -> TopLevelPragma Source #
A pragma that marks definitions as deprecated ( {-# DEPRECATED f "f will be replaced by g" #-}
)
pattern WarningPragma :: NameList -> String -> TopLevelPragma Source #
A pragma that marks definitions as deprecated ( {-# WARNING unsafePerformIO "you should know what you are doing" #-}
)
pattern AnnPragma :: AnnotationSubject -> Expr -> TopLevelPragma Source #
A pragma that annotates a definition with an arbitrary value ( {-# ANN f 42 #-}
)
pattern InlinePragma :: MaybeConlikeAnnot -> MaybePhaseControl -> Name -> TopLevelPragma Source #
A pragma that marks a function for inlining to the compiler ( {-# INLINE thenUs #-}
)
pattern NoInlinePragma :: Name -> TopLevelPragma Source #
A pragma that forbids a function from being inlined by the compiler ( {-# NOINLINE f #-}
)
pattern InlinablePragma :: MaybePhaseControl -> Name -> TopLevelPragma Source #
A pragma that marks a function that it may be inlined by the compiler ( {-# INLINABLE thenUs #-}
)
pattern LinePragma :: Int -> MaybeStringNode -> TopLevelPragma Source #
A pragma for maintaining line numbers in generated sources ( {-# LINE 123 "somefile" #-}
)
pattern SpecializePragma :: MaybePhaseControl -> Name -> TypeList -> TopLevelPragma Source #
A pragma that tells the compiler that a polymorph function should be optimized for a given type ( {-# SPECIALISE f :: Int -> b -> b #-}
)
pattern PhaseControlFrom :: Integer -> PhaseControl Source #
Marks that the pragma should be applied from a given compile phase ( [2]
)
pattern PhaseControlUntil :: Integer -> PhaseControl Source #
Marks that the pragma should be applied until a given compile phase ( [~2]
)
pattern RewriteRule :: String -> MaybePhaseControl -> RuleVarList -> Expr -> Expr -> Rule Source #
A rewrite rule ( "map/map" forall f g xs. map f (map g xs) = map (f.g) xs
)
pattern NameAnnotation :: Name -> AnnotationSubject Source #
The definition with the given name is annotated
pattern TypeAnnotation :: Name -> AnnotationSubject Source #
A type with the given name is annotated
pattern ModuleAnnotation :: AnnotationSubject Source #
The whole module is annotated
pattern ConlikeAnnotation :: ConlikeAnnot Source #
A CONLIKE
modifier for an INLINE
pragma.