-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Facilities for generating new parts of the Haskell-Tools AST
--   
--   Contains utility functions to generate parts of the Haskell-Tools AST.
--   Generates these elements to be compatible with the source annotations
--   that are already present on the AST. The package is divided into
--   modules based on which language elements can the given module
--   generate. This packages should be used during the transformations to
--   generate parts of the new AST.
@package haskell-tools-rewrite
@version 0.8.0.0

module Language.Haskell.Tools.AST.ElementTypes
type AnnList node dom = AnnListG node dom SrcTemplateStage
type AnnMaybe node dom = AnnMaybeG node dom SrcTemplateStage

-- | The representation of a haskell module, that is a separate compilation
--   unit. It may or may not have a header.
type Module dom = Ann UModule dom SrcTemplateStage

-- | Module declaration with name and (optional) exports
type ModuleHead dom = Ann UModuleHead dom SrcTemplateStage

-- | A list of export specifications surrounded by parentheses
type ExportSpecs dom = Ann UExportSpecs dom SrcTemplateStage

-- | Export specifier
type ExportSpec dom = Ann UExportSpec dom SrcTemplateStage

-- | Marks a name to be imported or exported with related names
--   (subspecifier)
type IESpec dom = Ann UIESpec dom SrcTemplateStage

-- | Marks how related names will be imported or exported with a given name
type SubSpec dom = Ann USubSpec dom SrcTemplateStage

-- | Pragmas that must be used after the module head
type ModulePragma dom = Ann UModulePragma dom SrcTemplateStage

-- | Pragmas that must be used before defining the module
type FilePragma dom = Ann UFilePragma dom SrcTemplateStage

-- | An import declaration: <tt>import Module.Name</tt>
type ImportDecl dom = Ann UImportDecl dom SrcTemplateStage

-- | Restriction on the imported names
type ImportSpec dom = Ann UImportSpec dom SrcTemplateStage

-- | Marks the import as qualified: <tt>qualified</tt>
type ImportQualified dom = Ann UImportQualified dom SrcTemplateStage

-- | Marks the import as source: <tt>{-# SOURCE #-}</tt>
type ImportSource dom = Ann UImportSource dom SrcTemplateStage

-- | Marks the import as safe: <tt>safe</tt>
type ImportSafe dom = Ann UImportSafe dom SrcTemplateStage

-- | Marks an imported name to belong to the type namespace: <tt>type</tt>
type TypeNamespace dom = Ann UTypeNamespace dom SrcTemplateStage

-- | Renaming imports (<tt> as A </tt>)
type ImportRenaming dom = Ann UImportRenaming dom SrcTemplateStage

-- | The name of a module
type ModuleName dom = Ann UModuleName dom SrcTemplateStage

-- | The name of the enabled language extension, for example (<tt>
--   LambdaCase </tt>)
type LanguageExtension dom = Ann ULanguageExtension dom SrcTemplateStage

-- | Haskell declaration
type Decl dom = Ann UDecl dom SrcTemplateStage

-- | The list of declarations that can appear in a typeclass
type ClassBody dom = Ann UClassBody dom SrcTemplateStage

-- | Members of a class declaration
type ClassElement dom = Ann UClassElement dom SrcTemplateStage
type DeclHead dom = Ann UDeclHead dom SrcTemplateStage

-- | Instance body is the implementation of the class functions (<tt> where
--   a x = 1; b x = 2 </tt>)
type InstBody dom = Ann UInstBody dom SrcTemplateStage

-- | Declarations inside an instance declaration.
type InstBodyDecl dom = Ann UInstBodyDecl dom SrcTemplateStage

-- | GADT constructor declaration (<tt> D1 :: { val :: Int } -&gt; T String
--   </tt>)
type GadtConDecl dom = Ann UGadtConDecl dom SrcTemplateStage

-- | Type of GADT constructors (can be record types: <tt>{ val :: Int
--   }</tt>)
type GadtConType dom = Ann UGadtConType dom SrcTemplateStage

-- | Marker for a field wildcard. Only needed to attach semantic
--   information in a type-safe way.
type FieldWildcard dom = Ann UFieldWildcard dom SrcTemplateStage

-- | A list of functional dependencies: <tt> | a -&gt; b, c -&gt; d </tt>
--   separated by commas
type FunDeps dom = Ann UFunDeps dom SrcTemplateStage

-- | A functional dependency, given on the form <tt>l1 ... ln -&gt; r1 ...
--   rn</tt>
type FunDep dom = Ann UFunDep dom SrcTemplateStage

-- | A constructor declaration for a datatype
type ConDecl dom = Ann UConDecl dom SrcTemplateStage

-- | The <tt>data</tt> or the <tt>newtype</tt> keyword to define ADTs.
type DataOrNewtypeKeyword dom = Ann UDataOrNewtypeKeyword dom SrcTemplateStage

-- | Field declaration (<tt> fld :: Int </tt>)
type FieldDecl dom = Ann UFieldDecl dom SrcTemplateStage

-- | A deriving clause following a data type declaration. (<tt> deriving
--   Show </tt> or <tt> deriving (Show, Eq) </tt>)
type Deriving dom = Ann UDeriving dom SrcTemplateStage

-- | The instance declaration rule, which is, roughly, the part of the
--   instance declaration before the where keyword.
type InstanceRule dom = Ann UInstanceRule dom SrcTemplateStage

-- | The specification of the class instance declaration
type InstanceHead dom = Ann UInstanceHead dom SrcTemplateStage

-- | Overlap pragmas. Can be applied to class declarations and class
--   instance declarations.
type OverlapPragma dom = Ann UOverlapPragma dom SrcTemplateStage

-- | Type equations as found in closed type families (<tt> T A = S </tt>)
type TypeEqn dom = Ann UTypeEqn dom SrcTemplateStage

-- | Top level pragmas
type TopLevelPragma dom = Ann UTopLevelPragma dom SrcTemplateStage

-- | A rewrite rule (<tt> "map/map" forall f g xs. map f (map g xs) = map
--   (f.g) xs </tt>)
type Rule dom = Ann URule dom SrcTemplateStage

-- | A variable for a rewrite rule. With or without type signature.
type RuleVar dom = Ann URuleVar dom SrcTemplateStage

-- | Annotation allows you to connect an expression to any declaration.
type AnnotationSubject dom = Ann UAnnotationSubject dom SrcTemplateStage

-- | Formulas of minimal annotations declaring which functions should be
--   defined.
type MinimalFormula dom = Ann UMinimalFormula dom SrcTemplateStage

-- | In-AST source ranges (for generated pragmas)
type SourceRange dom = Ann USourceRange dom SrcTemplateStage

-- | Open type and data families
type TypeFamily dom = Ann UTypeFamily dom SrcTemplateStage

-- | Type family specification with kinds specification and injectivity.
type TypeFamilySpec dom = Ann UTypeFamilySpec dom SrcTemplateStage

-- | Injectivity annotation for type families (<tt> = r | r -&gt; a </tt>)
type InjectivityAnn dom = Ann UInjectivityAnn dom SrcTemplateStage

-- | Pattern synonyms: <tt> pattern Arrow t1 t2 = App "-&gt;" [t1, t2]
--   </tt>
type PatternSynonym dom = Ann UPatternSynonym dom SrcTemplateStage

-- | Right-hand side of pattern synonym
type PatSynRhs dom = Ann UPatSynRhs dom SrcTemplateStage

-- | Left hand side of a pattern synonym
type PatSynLhs dom = Ann UPatSynLhs dom SrcTemplateStage

-- | Where clause of pattern synonym (explicit expression direction)
type PatSynWhere dom = Ann UPatSynWhere dom SrcTemplateStage

-- | Pattern type signature declaration (<tt> pattern Succ :: Int -&gt; Int
--   </tt>)
type PatternSignature dom = Ann UPatternTypeSignature dom SrcTemplateStage

-- | Role annotations for types
type Role dom = Ann URole dom SrcTemplateStage

-- | Call conventions of foreign functions
type CallConv dom = Ann UCallConv dom SrcTemplateStage

-- | Safety annotations for foreign calls
type Safety dom = Ann USafety dom SrcTemplateStage

-- | A <tt>CONLIKE</tt> modifier for an <tt>INLINE</tt> pragma.
type ConlikeAnnot dom = Ann UConlikeAnnot dom SrcTemplateStage

-- | Controls the activation of a rewrite rule (<tt> [1] </tt>)
type PhaseControl dom = Ann UPhaseControl dom SrcTemplateStage

-- | Value binding for top-level and local bindings
type ValueBind dom = Ann UValueBind dom SrcTemplateStage

-- | Clause of function binding
type Match dom = Ann UMatch dom SrcTemplateStage

-- | Something on the left side of the match
type MatchLhs dom = Ann UMatchLhs dom SrcTemplateStage

-- | Right hand side of a value binding (possible with guards): (<tt> = 3
--   </tt> or <tt> | x == 1 = 3; | otherwise = 4 </tt>)
type Rhs dom = Ann URhs dom SrcTemplateStage

-- | A guarded right-hand side of a value binding (<tt> | x &gt; 3 = 2
--   </tt>)
type GuardedRhs dom = Ann UGuardedRhs dom SrcTemplateStage

-- | Guards for value bindings and pattern matches (<tt> Just v <a>x, v</a>
--   1 </tt>)
type RhsGuard dom = Ann URhsGuard dom SrcTemplateStage

-- | Bindings that are enabled in local blocks (where or let).
type LocalBind dom = Ann ULocalBind dom SrcTemplateStage

-- | Local bindings attached to a declaration (<tt> where x = 42 </tt>)
type LocalBinds dom = Ann ULocalBinds dom SrcTemplateStage

-- | A fixity signature (<tt> infixl 5 +, - </tt>).
type FixitySignature dom = Ann UFixitySignature dom SrcTemplateStage

-- | A type signature (<tt> f :: Int -&gt; Int </tt>)
type TypeSignature dom = Ann UTypeSignature dom SrcTemplateStage

-- | Haskell types
type Type dom = Ann UType dom SrcTemplateStage

-- | Type variable declarations (with possible kind annotation)
type TyVar dom = Ann UTyVar dom SrcTemplateStage
type Context dom = Ann UContext dom SrcTemplateStage

-- | A single assertion in the context
type Assertion dom = Ann UAssertion dom SrcTemplateStage

-- | Kind constraint (<tt> :: * -&gt; * </tt>)
type KindConstraint dom = Ann UKindConstraint dom SrcTemplateStage

-- | Haskell kinds
type Kind dom = Ann UKind dom SrcTemplateStage

-- | Values promoted to the kind level
type PromotedKind dom = Ann (UPromoted UKind) dom SrcTemplateStage

-- | Haskell expressions
type Expr dom = Ann UExpr dom SrcTemplateStage

-- | Clause of case expression (<tt> Just x -&gt; x + 1 </tt>)
type Alt dom = Ann UAlt dom SrcTemplateStage

-- | Right hand side of a match (possible with guards): (<tt> -&gt; 3 </tt>
--   or <tt> | x == 1 -&gt; 3; | otherwise -&gt; 4 </tt>)
type CaseRhs dom = Ann UCaseRhs dom SrcTemplateStage

-- | A guarded right-hand side of pattern matches binding (<tt> | x &gt; 3
--   -&gt; 2 </tt>)
type GuardedCaseRhs dom = Ann UGuardedCaseRhs dom SrcTemplateStage

-- | Field update expressions
type FieldUpdate dom = Ann UFieldUpdate dom SrcTemplateStage

-- | An element of a tuple section that can be an expression or missing
--   (indicating a value from a parameter)
type TupSecElem dom = Ann UTupSecElem dom SrcTemplateStage

-- | Pragmas that can be applied to expressions
type ExprPragma dom = Ann UExprPragma dom SrcTemplateStage

-- | Special expressions for arrows
type Cmd dom = Ann UCmd dom SrcTemplateStage

-- | Clause of case expression for commands
type CmdAlt dom = Ann UCmdAlt dom SrcTemplateStage

-- | Arrow directions
type ArrowApp dom = Ann UArrowAppl dom SrcTemplateStage

-- | A statement in a do-notation
type Stmt dom = Ann UStmt dom SrcTemplateStage

-- | Keywords <tt>do</tt> or <tt>mdo</tt> to start a do-block
type DoKind dom = Ann UDoKind dom SrcTemplateStage

-- | List comprehension statement
type CompStmt dom = Ann UCompStmt dom SrcTemplateStage

-- | Body of a list comprehension: (<tt> | x &lt;- [1..10] </tt>)
type ListCompBody dom = Ann UListCompBody dom SrcTemplateStage

-- | A do-notation for arrows
type CmdStmt dom = Ann UCmdStmt dom SrcTemplateStage

-- | Representation of patterns for pattern bindings
type Pattern dom = Ann UPattern dom SrcTemplateStage
type PatternField dom = Ann UPatternField dom SrcTemplateStage

-- | A template haskell splice
type Splice dom = Ann USplice dom SrcTemplateStage

-- | Template Haskell bracket expressions
type Bracket dom = Ann UBracket dom SrcTemplateStage

-- | Template haskell quasi-quotation: <tt>[quoter|str]</tt>
type QuasiQuote dom = Ann UQuasiQuote dom SrcTemplateStage

-- | Haskell literals
type Literal dom = Ann ULiteral dom SrcTemplateStage

-- | A definition that functions as an operator
type Operator dom = Ann UOperator dom SrcTemplateStage

-- | A definition that functions as a name
type Name dom = Ann UName dom SrcTemplateStage

-- | Possible qualified names. Contains also implicit names. Linear
--   implicit parameter: <tt>%x</tt>. Non-linear implicit parameter:
--   <tt>?x</tt>.
type QualifiedName dom = Ann UQualifiedName dom SrcTemplateStage

-- | Parts of a qualified name.
type NamePart dom = Ann UNamePart dom SrcTemplateStage

-- | Program elements formatted as string literals (import packages, pragma
--   texts)
type StringNode dom = Ann UStringNode dom SrcTemplateStage
type MaybeContext dom = AnnMaybe UContext dom
type MaybeDeriving dom = AnnMaybe UDeriving dom
type MaybeLocalBinds dom = AnnMaybe ULocalBinds dom
type MaybeTypeFamilySpec dom = AnnMaybe UTypeFamilySpec dom
type MaybeKindConstraint dom = AnnMaybe UKindConstraint dom
type MaybeClassBody dom = AnnMaybe UClassBody dom
type MaybeInstBody dom = AnnMaybe UInstBody dom
type MaybeExpr dom = AnnMaybe UExpr dom
type MaybeExportSpecs dom = AnnMaybe UExportSpecs dom
type MaybeImportQualified dom = AnnMaybe UImportQualified dom
type MaybeImportSource dom = AnnMaybe UImportSource dom
type MaybeImportSafe dom = AnnMaybe UImportSafe dom
type MaybeImportSpec dom = AnnMaybe UImportSpec dom
type MaybeModuleHead dom = AnnMaybe UModuleHead dom
type MaybeModulePragma dom = AnnMaybe UModulePragma dom
type MaybeSubSpec dom = AnnMaybe USubSpec dom
type MaybeStringNode dom = AnnMaybe UStringNode dom
type MaybeImportRenaming dom = AnnMaybe UImportRenaming dom
type MaybeSafety dom = AnnMaybe USafety dom
type MaybePhaseControl dom = AnnMaybe UPhaseControl dom
type MaybeConlikeAnnot dom = AnnMaybe UConlikeAnnot dom
type MaybeFunDeps dom = AnnMaybe UFunDeps dom
type MatchList dom = AnnList UMatch dom
type DeclList dom = AnnList UDecl dom
type PatternList dom = AnnList UPattern dom
type OperatorList dom = AnnList UOperator dom
type NameList dom = AnnList UName dom
type LocalBindList dom = AnnList ULocalBind dom
type IESpecList dom = AnnList UIESpec dom
type RhsGuardList dom = AnnList URhsGuard dom
type GuardedRhsList dom = AnnList UGuardedRhs dom
type GuardedCaseRhsList dom = AnnList UGuardedCaseRhs dom
type ConDeclList dom = AnnList UConDecl dom
type TypeEqnList dom = AnnList UTypeEqn dom
type TypeList dom = AnnList UType dom
type FieldDeclList dom = AnnList UFieldDecl dom
type ExprList dom = AnnList UExpr dom
type FieldUpdateList dom = AnnList UFieldUpdate dom
type GadtConDeclList dom = AnnList UGadtConDecl dom
type ClassElementList dom = AnnList UClassElement dom
type InstBodyDeclList dom = AnnList UInstBodyDecl dom
type InstanceHeadList dom = AnnList UInstanceHead dom
type AltList dom = AnnList UAlt dom
type StmtList dom = AnnList UStmt dom
type KindList dom = AnnList UKind dom
type TyVarList dom = AnnList UTyVar dom
type ListCompBodyList dom = AnnList UListCompBody dom
type ExportSpecList dom = AnnList UExportSpec dom
type FilePragmaList dom = AnnList UFilePragma dom
type ImportDeclList dom = AnnList UImportDecl dom
type PatternFieldList dom = AnnList UPatternField dom
type AssertionList dom = AnnList UAssertion dom
type CompStmtList dom = AnnList UCompStmt dom
type RuleList dom = AnnList URule dom
type RuleVarList dom = AnnList URuleVar dom
type RoleList dom = AnnList URole dom
type MinimalFormulaList dom = AnnList UMinimalFormula dom
type FunDepList dom = AnnList UFunDep dom
type TupSecElemList dom = AnnList UTupSecElem dom
type CmdList dom = AnnList UCmd dom
type CmdAltList dom = AnnList UCmdAlt dom
type CmdStmtList dom = AnnList UCmdStmt dom
type LanguageExtensionList dom = AnnList ULanguageExtension dom
type StringNodeList dom = AnnList UStringNode dom
type NamePartList dom = AnnList UNamePart dom


-- | Generation of declaration-level AST fragments for refactorings. The
--   bindings defined here create a the annotated version of the AST
--   constructor with the same name. For example, <tt>mkTypeSignature</tt>
--   creates the annotated version of the <tt>UTypeSignature</tt> AST
--   constructor.
module Language.Haskell.Tools.AST.Gen.Decls

-- | Creates a type synonym ( <tt>type String = [Char]</tt> )
mkTypeDecl :: DeclHead dom -> Type dom -> Decl dom

-- | Creates a standalone deriving declaration (<tt> deriving instance X T
--   </tt>)
mkStandaloneDeriving :: Maybe (OverlapPragma dom) -> InstanceRule dom -> Decl dom

-- | Creates a fixity declaration (<tt> infixl 5 +, - </tt>)
mkFixityDecl :: FixitySignature dom -> Decl dom

-- | Creates default types (<tt> default (T1, T2) </tt>)
mkDefaultDecl :: [Type dom] -> Decl dom

-- | Creates type signature declaration (<tt> f :: Int -&gt; Int </tt>)
mkTypeSigDecl :: TypeSignature dom -> Decl dom

-- | Creates a function or value binding (<tt> f x = 12 </tt>)
mkValueBinding :: ValueBind dom -> Decl dom

-- | Creates a Template Haskell splice declaration (<tt> $(generateDecls)
--   </tt>)
mkSpliceDecl :: Splice dom -> Decl dom

-- | Creates a data or newtype declaration.
mkDataDecl :: DataOrNewtypeKeyword dom -> Maybe (Context dom) -> DeclHead dom -> [ConDecl dom] -> Maybe (Deriving dom) -> Decl dom

-- | Creates a GADT-style data or newtype declaration.
mkGADTDataDecl :: DataOrNewtypeKeyword dom -> Maybe (Context dom) -> DeclHead dom -> Maybe (KindConstraint dom) -> [GadtConDecl dom] -> Maybe (Deriving dom) -> Decl dom

-- | Creates a GADT constructor declaration (<tt> D1 :: Int -&gt; T String
--   </tt>)
mkGadtConDecl :: [Name dom] -> Type dom -> GadtConDecl dom

-- | Creates a GADT constructor declaration with record syntax (<tt> D1 ::
--   { val :: Int } -&gt; T String </tt>)
mkGadtRecordConDecl :: [Name dom] -> [FieldDecl dom] -> Type dom -> GadtConDecl dom

-- | Creates an ordinary data constructor (<tt> C t1 t2 </tt>)
mkConDecl :: Name dom -> [Type dom] -> ConDecl dom

-- | Creates a record data constructor (<tt> Point { x :: Double, y ::
--   Double } </tt>)
mkRecordConDecl :: Name dom -> [FieldDecl dom] -> ConDecl dom

-- | Creates an infix data constructor (<tt> t1 :+: t2 </tt>)
mkInfixConDecl :: Type dom -> Operator dom -> Type dom -> ConDecl dom

-- | Creates a field declaration (<tt> fld :: Int </tt>) for a constructor
mkFieldDecl :: [Name dom] -> Type dom -> FieldDecl dom

-- | Creates a deriving clause following a data type declaration. (<tt>
--   deriving Show </tt> or <tt> deriving (Show, Eq) </tt>)
mkDeriving :: [InstanceHead dom] -> Deriving dom

-- | The <tt>data</tt> keyword in a type definition
mkDataKeyword :: DataOrNewtypeKeyword dom

-- | The <tt>newtype</tt> keyword in a type definition
mkNewtypeKeyword :: DataOrNewtypeKeyword dom

-- | Creates a type class declaration (<tt> class X a where f = ... </tt>)
mkClassDecl :: Maybe (Context dom) -> DeclHead dom -> [FunDep dom] -> Maybe (ClassBody dom) -> Decl dom

-- | Creates the list of declarations that can appear in a typeclass
mkClassBody :: [ClassElement dom] -> ClassBody dom

-- | Creates a type signature as class element: <tt> f :: A -&gt; B </tt>
mkClassElemSig :: TypeSignature dom -> ClassElement dom

-- | Creates a default binding as class element: <tt> f x = "aaa" </tt>
mkClassElemDef :: ValueBind dom -> ClassElement dom

-- | Creates an associated type synonym in class: <tt> type T y :: * </tt>
mkClassElemTypeFam :: DeclHead dom -> Maybe (TypeFamilySpec dom) -> ClassElement dom

-- | Creates an associated data synonym in class: <tt> data T y :: * </tt>
mkClassElemDataFam :: DeclHead dom -> Maybe (KindConstraint dom) -> ClassElement dom

-- | Creates a default choice for type synonym in class: <tt> type T x = TE
--   </tt> or <tt> type instance T x = TE </tt>
mkClsDefaultType :: DeclHead dom -> Type dom -> ClassElement dom

-- | Creates a default signature (by using <tt>DefaultSignatures</tt>) in
--   class: <tt> default enum :: (Generic a, GEnum (Rep a)) =&gt; [a] </tt>
mkClsDefaultSig :: Name dom -> Type dom -> ClassElement dom

-- | Creates a functional dependency, given on the form <tt>l1 ... ln -&gt;
--   r1 ... rn</tt>
mkFunDep :: [Name dom] -> [Name dom] -> FunDep dom

-- | Minimal pragma: <tt> {-# MINIMAL (==) | (/=) #-} </tt> in a class
mkClsMinimal :: MinimalFormula dom -> ClassElement dom
mkMinimalName :: Name dom -> MinimalFormula dom
mkMinimalParen :: MinimalFormula dom -> MinimalFormula dom

-- | One of the minimal formulas are needed (<tt> min1 | min2 </tt>)
mkMinimalOr :: [MinimalFormula dom] -> MinimalFormula dom

-- | Both of the minimal formulas are needed (<tt> min1 , min2 </tt>)
mkMinimalAnd :: [MinimalFormula dom] -> MinimalFormula dom

-- | Type or class name as a declaration head
mkNameDeclHead :: Name dom -> DeclHead dom

-- | Parenthesized type as a declaration head
mkParenDeclHead :: DeclHead dom -> DeclHead dom

-- | Application in a declaration head
mkDeclHeadApp :: DeclHead dom -> TyVar dom -> DeclHead dom

-- | Infix application of the type/class name to the left operand in a
--   declaration head
mkInfixDeclHead :: TyVar dom -> Operator dom -> TyVar dom -> DeclHead dom

-- | Creates a type class instance declaration (<tt> instance X T [where f
--   = ...] </tt>)
mkInstanceDecl :: Maybe (OverlapPragma dom) -> InstanceRule dom -> Maybe (InstBody dom) -> Decl dom

-- | The instance declaration rule, which is, roughly, the part of the
--   instance declaration before the where keyword.
mkInstanceRule :: Maybe (Context dom) -> InstanceHead dom -> InstanceRule dom

-- | Type or class name as a part of the instance declaration
mkInstanceHead :: Name dom -> InstanceHead dom

-- | Infix application of the type/class name to the left operand as a part
--   of the instance declaration
mkInfixInstanceHead :: Type dom -> Operator dom -> InstanceHead dom

-- | Parenthesized instance head as a part of the instance declaration
mkParenInstanceHead :: InstanceHead dom -> InstanceHead dom

-- | Application to one more type as a part of the instance declaration
mkAppInstanceHead :: InstanceHead dom -> Type dom -> InstanceHead dom

-- | Instance body is the implementation of the class functions (<tt> where
--   a x = 1; b x = 2 </tt>)
mkInstanceBody :: [InstBodyDecl dom] -> InstBody dom

-- | A normal declaration (<tt> f x = 12 </tt>) in a type class instance
mkInstanceBind :: ValueBind dom -> InstBodyDecl dom

-- | Type signature in instance definition with <tt>InstanceSigs</tt>
mkInstanceTypeSig :: TypeSignature dom -> InstBodyDecl dom

-- | An associated type definition (<tt> type A X = B </tt>) in a type
--   class instance
mkInstanceTypeFamilyDef :: TypeEqn dom -> InstBodyDecl dom

-- | An associated data type implementation (<tt> data A X = C1 | C2 </tt>)
--   int a type class instance
mkInstanceDataFamilyDef :: DataOrNewtypeKeyword dom -> InstanceRule dom -> [ConDecl dom] -> Maybe (Deriving dom) -> InstBodyDecl dom

-- | An associated data type implemented using GADT style int a type class
--   instance
mkInstanceDataFamilyGADTDef :: DataOrNewtypeKeyword dom -> InstanceRule dom -> Maybe (KindConstraint dom) -> [GadtConDecl dom] -> Maybe (Deriving dom) -> InstBodyDecl dom

-- | Specialize instance pragma (no phase selection is allowed) in a type
--   class instance
mkInstanceSpecializePragma :: Type dom -> InstBodyDecl dom

-- | <tt>OVERLAP</tt> pragma for type instance definitions
mkEnableOverlap :: OverlapPragma dom

-- | <tt>NO_OVERLAP</tt> pragma for type instance definitions
mkDisableOverlap :: OverlapPragma dom

-- | <tt>OVERLAPPABLE</tt> pragma for type instance definitions
mkOverlappable :: OverlapPragma dom

-- | <tt>OVERLAPPING</tt> pragma for type instance definitions
mkOverlapping :: OverlapPragma dom

-- | <tt>OVERLAPS</tt> pragma for type instance definitions
mkOverlaps :: OverlapPragma dom

-- | <tt>INCOHERENT</tt> pragma for type instance definitions
mkIncoherentOverlap :: OverlapPragma dom

-- | Creates a role annotations (<tt> type role Ptr representational </tt>)
mkRoleDecl :: QualifiedName dom -> [Role dom] -> Decl dom

-- | Marks a given type parameter as <tt>nominal</tt>.
mkNominalRole :: Role dom

-- | Marks a given type parameter as <tt>representational</tt>.
mkRepresentationalRole :: Role dom

-- | Marks a given type parameter as <tt>phantom</tt>.
mkPhantomRole :: Role dom

-- | Creates a foreign import (<tt> foreign import foo :: Int -&gt; IO Int
--   </tt>)
mkForeignImport :: CallConv dom -> Maybe (Safety dom) -> Name dom -> Type dom -> Decl dom

-- | Creates a foreign export (<tt> foreign export ccall foo :: Int -&gt;
--   IO Int </tt>)
mkForeignExport :: CallConv dom -> Name dom -> Type dom -> Decl dom

-- | Specifies <tt>stdcall</tt> calling convention for foreign
--   import/export.
mkStdCall :: CallConv dom

-- | Specifies <tt>ccall</tt> calling convention for foreign import/export.
mkCCall :: CallConv dom

-- | Specifies <tt>capi</tt> calling convention for foreign import/export.
mkCApi :: CallConv dom

-- | Specifies that the given foreign import is <tt>unsafe</tt>.
mkUnsafe :: Safety dom

-- | Creates a type family declaration ( <tt>type family F x</tt> )
mkTypeFamily :: DeclHead dom -> Maybe (TypeFamilySpec dom) -> Decl dom

-- | Creates a closed type family declaration ( <tt>type family F x where F
--   Int = (); F a = Int</tt> )
mkClosedTypeFamily :: DeclHead dom -> Maybe (TypeFamilySpec dom) -> [TypeEqn dom] -> Decl dom

-- | Creates a data family declaration (<tt> data family A a :: * -&gt; *
--   </tt>)
mkDataFamily :: DeclHead dom -> Maybe (KindConstraint dom) -> Decl dom

-- | Specifies the kind of a type family (<tt> :: * -&gt; * </tt>)
mkTypeFamilyKindSpec :: KindConstraint dom -> TypeFamilySpec dom

-- | Specifies the injectivity of a type family (<tt> = r | r -&gt; a
--   </tt>)
mkTypeFamilyInjectivitySpec :: TyVar dom -> [Name dom] -> TypeFamilySpec dom

-- | Type equations as found in closed type families (<tt> T A = S </tt>)
mkTypeEqn :: Type dom -> Type dom -> TypeEqn dom

-- | Creates a type family instance declaration (<tt> type instance Fam T =
--   AssignedT </tt>)
mkTypeInstance :: InstanceRule dom -> Type dom -> Decl dom

-- | Creates a data instance declaration (<tt> data instance Fam T = Con1 |
--   Con2 </tt>)
mkDataInstance :: DataOrNewtypeKeyword dom -> InstanceRule dom -> [ConDecl dom] -> Maybe (Deriving dom) -> Decl dom

-- | Creates a GADT-style data instance declaration (<tt> data instance Fam
--   T where ... </tt>)
mkGadtDataInstance :: DataOrNewtypeKeyword dom -> InstanceRule dom -> Maybe (KindConstraint dom) -> [GadtConDecl dom] -> Decl dom

-- | Creates a pattern synonym (<tt> pattern Arrow t1 t2 = App "-&gt;" [t1,
--   t2] </tt>)
mkPatternSynonym :: PatSynLhs dom -> PatSynRhs dom -> Decl dom

-- | Creates a left hand side of a pattern synonym with a constructor name
--   and arguments (<tt> Arrow t1 t2 </tt>)
mkConPatSyn :: Name dom -> [Name dom] -> PatSynLhs dom

-- | Creates an infix pattern synonym left-hand side (<tt> t1 :+: t2 </tt>)
mkInfixPatSyn :: Name dom -> Operator dom -> Name dom -> PatSynLhs dom

-- | Creates a record-style pattern synonym left-hand side (<tt> Arrow {
--   arrowFrom, arrowTo } </tt>)
mkRecordPatSyn :: Name dom -> [Name dom] -> PatSynLhs dom

-- | Creates an automatically two-way pattern synonym (<tt> = App "Int" []
--   </tt>)
mkSymmetricPatSyn :: Pattern dom -> PatSynRhs dom

-- | Creates a pattern synonym that can be only used for pattenr matching
--   but not for combining (<tt> &lt;- App "Int" [] </tt>)
mkOneWayPatSyn :: Pattern dom -> PatSynRhs dom

-- | Creates a pattern synonym with the other direction explicitly
--   specified (<tt> &lt;- App "Int" [] where Int = App "Int" [] </tt>)
mkTwoWayPatSyn :: Pattern dom -> [Match dom] -> PatSynRhs dom

-- | Creates a pattern type signature declaration (<tt> pattern Succ :: Int
--   -&gt; Int </tt>)
mkPatternSignatureDecl :: PatternSignature dom -> Decl dom
mkPatternSignature :: Name dom -> Type dom -> PatternSignature dom

-- | Creates a top-level pragmas
mkPragmaDecl :: TopLevelPragma dom -> Decl dom

-- | A pragma that introduces source rewrite rules (<tt> {-# RULES
--   "map/map" [2] forall f g xs. map f (map g xs) = map (f.g) xs #-}
--   </tt>)
mkRulePragma :: [Rule dom] -> TopLevelPragma dom

-- | A pragma that marks definitions as deprecated (<tt> {-# DEPRECATED f
--   "f will be replaced by g" #-} </tt>)
mkDeprPragma :: [Name dom] -> String -> TopLevelPragma dom

-- | A pragma that marks definitions as deprecated (<tt> {-# WARNING
--   unsafePerformIO "you should know what you are doing" #-} </tt>)
mkWarningPragma :: [Name dom] -> String -> TopLevelPragma dom

-- | A pragma that annotates a definition with an arbitrary value (<tt> {-#
--   ANN f 42 #-} </tt>)
mkAnnPragma :: AnnotationSubject dom -> Expr dom -> TopLevelPragma dom

-- | A pragma that marks a function for inlining to the compiler (<tt> {-#
--   INLINE thenUs #-} </tt>)
mkInlinePragma :: Maybe (ConlikeAnnot dom) -> Maybe (PhaseControl dom) -> Name dom -> TopLevelPragma dom

-- | A pragma that forbids a function from being inlined by the compiler
--   (<tt> {-# NOINLINE f #-} </tt>)
mkNoInlinePragma :: Name dom -> TopLevelPragma dom

-- | A pragma that marks a function that it may be inlined by the compiler
--   (<tt> {-# INLINABLE thenUs #-} </tt>)
mkInlinablePragma :: Maybe (PhaseControl dom) -> Name dom -> TopLevelPragma dom

-- | A pragma for maintaining line numbers in generated sources (<tt> {-#
--   LINE 123 "somefile" #-} </tt>)
mkLinePragma :: Int -> Maybe (StringNode dom) -> TopLevelPragma dom

-- | A pragma that tells the compiler that a polymorph function should be
--   optimized for a given type (<tt> {-# SPECIALISE f :: Int -&gt; b -&gt;
--   b #-} </tt>)
mkSpecializePragma :: Maybe (PhaseControl dom) -> Name dom -> [Type dom] -> TopLevelPragma dom

-- | Marks that the pragma should be applied from a given compile phase
--   (<tt> [2] </tt>)
mkPhaseControlFrom :: Integer -> PhaseControl dom

-- | Marks that the pragma should be applied until a given compile phase
--   (<tt> [~2] </tt>)
mkPhaseControlUntil :: Integer -> PhaseControl dom

-- | A rewrite rule (<tt> "map/map" forall f g xs. map f (map g xs) = map
--   (f.g) xs </tt>)
mkRewriteRule :: String -> Maybe (PhaseControl dom) -> [RuleVar dom] -> Expr dom -> Expr dom -> Rule dom
mkRuleVar :: Name dom -> RuleVar dom

-- | The definition with the given name is annotated
mkNameAnnotation :: Name dom -> AnnotationSubject dom

-- | A type with the given name is annotated
mkTypeAnnotation :: Name dom -> AnnotationSubject dom

-- | The whole module is annotated
mkModuleAnnotation :: AnnotationSubject dom

-- | A <tt>CONLIKE</tt> modifier for an <tt>INLINE</tt> pragma.
mkConlikeAnnotation :: ConlikeAnnot dom


-- | Generation of expression-level AST fragments for refactorings. The
--   bindings defined here create a the annotated version of the AST
--   constructor with the same name. For example, <tt>mkApp</tt> creates
--   the annotated version of the <tt>App</tt> AST constructor.
module Language.Haskell.Tools.AST.Gen.Exprs

-- | Create a expression for a variable or a data constructor (<tt> a
--   </tt>)
mkVar :: Name dom -> Expr dom

-- | Create a literal expression (<tt> 42 </tt>)
mkLit :: Literal dom -> Expr dom

-- | Create a infix operator application expression (<tt> a + b </tt>)
mkInfixApp :: Expr dom -> Operator dom -> Expr dom -> Expr dom

-- | Create a prefix operator application expression (<tt> -x </tt>)
mkPrefixApp :: Operator dom -> Expr dom -> Expr dom

-- | Create a function application expression (<tt> f 4 </tt>)
mkApp :: Expr dom -> Expr dom -> Expr dom

-- | Create a lambda expression (<tt> \a b -&gt; a + b </tt>)
mkLambda :: [Pattern dom] -> Expr dom -> Expr dom

-- | Create a local binding (<tt> let x = 2; y = 3 in e x y </tt>)
mkLet :: [LocalBind dom] -> Expr dom -> Expr dom

-- | Create a if expression (<tt> if a then b else c </tt>)
mkIf :: Expr dom -> Expr dom -> Expr dom -> Expr dom

-- | Create a multi way if expressions with <tt>MultiWayIf</tt> extension
--   (<tt> if | guard1 -&gt; expr1; guard2 -&gt; expr2 </tt>)
mkMultiIf :: [GuardedCaseRhs dom] -> Expr dom

-- | Create a pattern matching expression (<tt> case expr of pat1 -&gt;
--   expr1; pat2 -&gt; expr2 </tt>)
mkCase :: Expr dom -> [Alt dom] -> Expr dom

-- | Create a do-notation expressions (<tt> do x &lt;- act1; act2 </tt>)
mkDoBlock :: [Stmt dom] -> Expr dom

-- | Create a tuple expression (<tt> (e1, e2, e3) </tt>)
mkTuple :: [Expr dom] -> Expr dom

-- | Create a unboxed tuple expression (<tt> (# e1, e2, e3 #) </tt>)
mkUnboxedTuple :: [Expr dom] -> Expr dom

-- | Create a tuple section, enabled with <tt>TupleSections</tt> (<tt>
--   (a,,b) </tt>). One of the elements must be missing.
mkTupleSection :: [Maybe (Expr dom)] -> Expr dom

-- | Create a unboxed tuple section, enabled with <tt>TupleSections</tt>
--   (<tt> (#a,,b#) </tt>). One of the elements must be missing.
mkTupleUnboxedSection :: [Maybe (Expr dom)] -> Expr dom

-- | Create a list expression: <tt>[1,2,3]</tt>
mkList :: [Expr dom] -> Expr dom

-- | Create a parallel array expression: <tt>[: 1,2,3 :]</tt>
mkParArray :: [Expr dom] -> Expr dom

-- | Create a parenthesized expression: <tt>( a + b )</tt>
mkParen :: Expr dom -> Expr dom

-- | Create a left operator section: <tt>(1+)</tt>
mkLeftSection :: Expr dom -> Operator dom -> Expr dom

-- | Create a right operator section: <tt>(+1)</tt>
mkRightSection :: Operator dom -> Expr dom -> Expr dom

-- | Create a record value construction: <tt>Point { x = 3, y = -2 }</tt>
mkRecCon :: Name dom -> [FieldUpdate dom] -> Expr dom

-- | Create a record value update: <tt>p1 { x = 3, y = -2 }</tt>
mkRecUpdate :: Expr dom -> [FieldUpdate dom] -> Expr dom

-- | Create a enumeration expression (<tt> [1,3..10] </tt>)
mkEnum :: Expr dom -> Maybe (Expr dom) -> Maybe (Expr dom) -> Expr dom

-- | Create a parallel array enumeration (<tt> [: 1,3 .. 10 :] </tt>)
mkParArrayEnum :: Expr dom -> Maybe (Expr dom) -> Expr dom -> Expr dom

-- | Create a list comprehension (<tt> [ (x, y) | x &lt;- xs | y &lt;- ys ]
--   </tt>)
mkListComp :: Expr dom -> [ListCompBody dom] -> Expr dom

-- | Create a parallel array comprehensions <tt> [: (x, y) | x &lt;- xs , y
--   &lt;- ys :] </tt> enabled by <tt>ParallelArrays</tt>
mkParArrayComp :: Expr dom -> [ListCompBody dom] -> Expr dom

-- | Create a explicit type signature (<tt> x :: Int </tt>)
mkExprTypeSig :: Expr dom -> Type dom -> Expr dom

-- | Create a explicit type application (<tt> show @Integer (read "5")
--   </tt>)
mkExplicitTypeApp :: Expr dom -> Type dom -> Expr dom

-- | <tt>'x</tt> for template haskell reifying of expressions
mkVarQuote :: Name dom -> Expr dom

-- | <tt>''T</tt> for template haskell reifying of types
mkTypeQuote :: Name dom -> Expr dom

-- | Create a template haskell bracket expression
mkBracketExpr :: Bracket dom -> Expr dom

-- | Create a template haskell splice expression, for example: <tt>$(gen
--   a)</tt> or <tt>$x</tt>
mkSpliceExpr :: Splice dom -> Expr dom

-- | Create a template haskell quasi quote expression, for example:
--   <tt>[quoter| a + b ]</tt>
mkQuasiQuoteExpr :: QuasiQuote dom -> Expr dom

-- | Creates a pragma that marks an expression.
mkExprPragma :: ExprPragma dom -> Expr dom -> Expr dom

-- | Create a arrow definition: <tt>proc a -&gt; f -&lt; a+1</tt>
mkProcExpr :: Pattern dom -> Cmd dom -> Expr dom

-- | Create a arrow definition: <tt>proc a -&gt; f -&lt; a+1</tt>
mkArrowApp :: Expr dom -> ArrowApp dom -> Expr dom -> Expr dom

-- | Create a lambda case ( <tt>case 0 -&gt; 1; 1 -&gt; 2</tt> )
mkLambdaCase :: [Alt dom] -> Expr dom

-- | Create a static pointer expression (<tt> static e </tt>). The inner
--   expression must be closed (cannot have variables bound outside)
mkStaticPointer :: Expr dom -> Expr dom

-- | Create a update of a field (<tt> x = 1 </tt>)
mkFieldUpdate :: Name dom -> Expr dom -> FieldUpdate dom

-- | Create a update the field to the value of the same name (<tt> x </tt>)
mkFieldPun :: Name dom -> FieldUpdate dom

-- | Create a update the fields of the bounded names to their values (<tt>
--   .. </tt>). Must be the last initializer. Cannot be used in a record
--   update expression.
mkFieldWildcard :: FieldUpdate dom

-- | Create a clause of case expression (<tt> Just x -&gt; x + 1 </tt>)
mkAlt :: Pattern dom -> CaseRhs dom -> Maybe (LocalBinds dom) -> Alt dom

-- | Create a unguarded right-hand side a pattern match (<tt> -&gt; 3
--   </tt>)
mkCaseRhs :: Expr dom -> CaseRhs dom

-- | Create a guarded right-hand sides of a pattern match (<tt> | x == 1
--   -&gt; 3; | otherwise -&gt; 4 </tt>)
mkGuardedCaseRhss :: [GuardedCaseRhs dom] -> CaseRhs dom

-- | Creates a guarded right-hand side of pattern matches binding (<tt> | x
--   &gt; 3 -&gt; 2 </tt>)
mkGuardedCaseRhs :: [RhsGuard dom] -> Expr dom -> GuardedCaseRhs dom

-- | Creates a <tt>CORE</tt> pragma for adding notes to expressions.
mkCorePragma :: String -> ExprPragma dom

-- | Creates an <tt>SCC</tt> pragma for defining cost centers for profiling
mkSccPragma :: String -> ExprPragma dom

-- | Creates a pragma that describes if an expression was generated from a
--   code fragment by an external tool (<tt> {-# GENERATED "Happy.y"
--   1:15-1:25 #-} </tt>)
mkGeneratedPragma :: SourceRange dom -> ExprPragma dom

-- | Create a in-AST source ranges (for generated pragmas)
mkSourceRange :: String -> Integer -> Integer -> Integer -> Integer -> SourceRange dom

-- | An arrow application command (<tt> f -&lt; x + 1 </tt>)
mkArrowAppCmd :: Expr dom -> ArrowApp dom -> Expr dom -> Cmd dom

-- | A form command (<tt> (|untilA (increment -&lt; x+y) (within 0.5 -&lt;
--   x)|) </tt>)
mkArrowFromCmd :: Expr dom -> [Cmd dom] -> Cmd dom

-- | A function application command
mkAppCmd :: Cmd dom -> Expr dom -> Cmd dom

-- | An infix command application
mkInfixCmd :: Cmd dom -> Name dom -> Cmd dom -> Cmd dom

-- | A lambda command
mkLambdaCmd :: [Pattern dom] -> Cmd dom -> Cmd dom

-- | A parenthesized command
mkParenCmd :: Cmd dom -> Cmd dom

-- | A pattern match command
mkCaseCmd :: Expr dom -> [CmdAlt dom] -> Cmd dom

-- | An if command (<tt> if f x y then g -&lt; x+1 else h -&lt; y+2 </tt>)
mkIfCmd :: Expr dom -> Cmd dom -> Cmd dom -> Cmd dom

-- | A local binding command (<tt> let z = x+y </tt>)
mkLetCmd :: [LocalBind dom] -> Cmd dom -> Cmd dom

-- | A do-notation in a command
mkDoCmd :: [CmdStmt dom] -> Cmd dom

-- | Left arrow application: <tt>-&lt;</tt>
mkLeftAppl :: ArrowApp dom

-- | Right arrow application: <tt>&gt;-</tt>
mkRightAppl :: ArrowApp dom

-- | Left arrow high application: <tt>-&lt;&lt;</tt>
mkLeftHighAppl :: ArrowApp dom

-- | Right arrow high application: <tt>&gt;&gt;-</tt>
mkRightHighAppl :: ArrowApp dom


-- | Generation of statement-level AST fragments for refactorings. The
--   bindings defined here are the AST constructor names with an "mk"
--   prefix.
module Language.Haskell.Tools.AST.Gen.Kinds

-- | Kind constraint (<tt> :: * -&gt; * </tt>)
mkKindConstraint :: Kind dom -> KindConstraint dom

-- | <tt>*</tt>, the kind of types
mkKindStar :: Kind dom

-- | <tt>#</tt>, the kind of unboxed types
mkKindUnbox :: Kind dom

-- | <tt>-&gt;</tt>, the kind of type constructor
mkKindFun :: Kind dom -> Kind dom -> Kind dom

-- | A parenthesised kind
mkKindParen :: Kind dom -> Kind dom

-- | Kind variable (using <tt>PolyKinds</tt> extension)
mkKindVar :: Name dom -> Kind dom

-- | Kind application (<tt> k1 k2 </tt>)
mkKindApp :: Kind dom -> Kind dom -> Kind dom

-- | A list kind (<tt> [k] </tt>)
mkKindList :: Kind dom -> Kind dom

-- | Numeric value promoted to the kind level.
mkIntKind :: Integer -> Kind dom

-- | String value promoted to the kind level.
mkStringKind :: String -> Kind dom

-- | A data constructor value promoted to the kind level.
mkConKind :: Name dom -> Kind dom

-- | A list of elements as a kind.
mkListKind :: [Kind dom] -> Kind dom

-- | A tuple of elements as a kind.
mkTupleKind :: [Kind dom] -> Kind dom

-- | Kind of the unit value <tt>()</tt>.
mkUnitKind :: Kind dom


-- | Generation of literals for refactorings. The bindings defined here are
--   the AST constructor names with an "mk" prefix.
module Language.Haskell.Tools.AST.Gen.Literals

-- | Character literal: <tt><tt>c</tt></tt>
mkCharLit :: Char -> Literal dom

-- | String literal: <tt>"abc"</tt>
mkStringLit :: String -> Literal dom

-- | Integer literal: <tt>12</tt>
mkIntLit :: Integer -> Literal dom

-- | Fractional literal: <tt>3.14</tt>
mkFracLit :: Rational -> Literal dom

-- | Primitive integer literal (of type <tt>Int#</tt>): <tt>32#</tt>
mkPrimIntLit :: Integer -> Literal dom

-- | Primitive word literal (of type <tt>Word#</tt>): <tt>32##</tt>
mkPrimWordLit :: Integer -> Literal dom

-- | Primitive float literal (of type <tt>Float#</tt>): <tt>3.14#</tt>
mkPrimFloatLit :: Rational -> Literal dom

-- | Primitive double literal (of type <tt>Double#</tt>): <tt>3.14##</tt>
mkPrimDoubleLit :: Rational -> Literal dom

-- | Primitive character literal (of type <tt>Char#</tt>):
--   <tt><tt>c</tt>#</tt>
mkPrimCharLit :: Char -> Literal dom

-- | Primitive string literal (of type <tt>Addr#</tt>): <tt>"xxx"#</tt>
mkPrimStringLit :: String -> Literal dom


-- | Generation of names for refactorings
module Language.Haskell.Tools.AST.Gen.Names

-- | Creates a simple, unqualified name
mkName :: String -> Name dom
mkQualOp :: [String] -> String -> Operator dom
mkBacktickOp :: [String] -> String -> Operator dom

-- | Creates an annotated qualified operator: <tt>A.B.+</tt> or
--   <tt>`A.B.mod`</tt>.
mkQualOp' :: [String] -> Name -> Operator dom

-- | Creates an annotated unqualified operator: <tt>+</tt> or
--   <tt>`mod`</tt>.
mkUnqualOp' :: Name -> Operator dom
mkUnqualOp :: String -> Operator dom

-- | Creates an annotated qualified (non-operator) binding name:
--   <tt>A.B.f</tt> or <tt>(A.B.+)</tt>
mkQualName' :: [String] -> Name -> Name dom

-- | Creates an annotated unqualified (non-operator) binding name:
--   <tt>f</tt> or <tt>(+)</tt>
mkUnqualName' :: Name -> Name dom
mkNormalName :: QualifiedName dom -> Name dom

-- | Creates a parenthesized name: <tt> foldl (+) 0 </tt>
mkParenName :: QualifiedName dom -> Name dom

-- | Creates an implicit name: <tt> ?var </tt>
mkImplicitName :: QualifiedName dom -> Name dom

-- | Creates an annotated qualified simple name
mkQualifiedName' :: [String] -> Name -> QualifiedName dom
mkQualifiedName :: [String] -> String -> QualifiedName dom

-- | Creates a part of a qualified name.
mkNamePart :: String -> NamePart dom

-- | Creates a simple (unqualified) name
mkSimpleName' :: Name -> QualifiedName dom

-- | Creates a simple (unqualified) name
mkSimpleName :: String -> QualifiedName dom

-- | Creates a quoted text
mkStringNode :: String -> StringNode dom


-- | Generation of UModule-level AST fragments for refactorings. The
--   bindings defined here create a the annotated version of the AST
--   constructor with the same name. For example, <tt>mkModule</tt> creates
--   the annotated version of the <tt>UModule</tt> AST constructor.
module Language.Haskell.Tools.AST.Gen.Modules

-- | The representation of a haskell module, that is a separate compilation
--   unit. It may or may not have a header.
mkModule :: [FilePragma dom] -> Maybe (ModuleHead dom) -> [ImportDecl dom] -> [Decl dom] -> Module dom

-- | Module declaration with name and (optional) exports
mkModuleHead :: ModuleName dom -> Maybe (ModulePragma dom) -> Maybe (ExportSpecs dom) -> ModuleHead dom

-- | A list of export specifications surrounded by parentheses
mkExportSpecs :: [ExportSpec dom] -> ExportSpecs dom

-- | Export a name and related names
mkExportSpec :: IESpec dom -> ExportSpec dom

-- | The export of an imported module (<tt> module A </tt>)
mkModuleExport :: ModuleName dom -> ExportSpec dom

-- | Marks a name to be imported or exported with related names
--   (subspecifier)
mkIESpec :: Name dom -> Maybe (SubSpec dom) -> IESpec dom

-- | Marks a pattern synonym to be imported or exported
mkPatternIESpec :: Name dom -> IESpec dom

-- | <tt>(a,b,c)</tt>: a class exported with some of its methods, or a
--   datatype exported with some of its constructors.
mkSubList :: [Name dom] -> SubSpec dom

-- | <tt>(..)</tt>: a class exported with all of its methods, or a datatype
--   exported with all of its constructors.
mkSubAll :: SubSpec dom

-- | An import declaration: <tt>import Module.Name</tt>
mkImportDecl :: Bool -> Bool -> Bool -> Maybe String -> ModuleName dom -> Maybe (ModuleName dom) -> Maybe (ImportSpec dom) -> ImportDecl dom

-- | Restrict the import definition to ONLY import the listed names
mkImportSpecList :: [IESpec dom] -> ImportSpec dom

-- | Restrict the import definition to DONT import the listed names
mkImportHidingList :: [IESpec dom] -> ImportSpec dom

-- | The name of a module
mkModuleName :: String -> ModuleName dom

-- | <tt>LANGUAGE</tt> pragma, listing the enabled language extensions in
--   that file
mkLanguagePragma :: [String] -> FilePragma dom

-- | <tt>OPTIONS</tt> pragma, possibly qualified with a tool, e.g.
--   OPTIONS_GHC
mkOptionsGHC :: String -> FilePragma dom

-- | A warning pragma attached to the module
mkModuleWarningPragma :: [String] -> ModulePragma dom

-- | A deprecated pragma attached to the module
mkModuleDeprecatedPragma :: [String] -> ModulePragma dom


-- | Generation of pattern-level AST fragments for refactorings. The
--   bindings defined here create a the annotated version of the AST
--   constructor with the same name. For example, <tt>mkVarPat</tt> creates
--   the annotated version of the <tt>VarPat</tt> AST constructor.
module Language.Haskell.Tools.AST.Gen.Patterns

-- | Pattern name binding
mkVarPat :: Name dom -> Pattern dom

-- | Literal pattern
mkLitPat :: Literal dom -> Pattern dom

-- | Infix constructor application pattern (<tt> a :+: b </tt>)
mkInfixAppPat :: Pattern dom -> Operator dom -> Pattern dom -> Pattern dom

-- | Constructor application pattern (<tt> Point x y </tt>)
mkAppPat :: Name dom -> [Pattern dom] -> Pattern dom

-- | Tuple pattern (<tt> (x,y) </tt>)
mkTuplePat :: [Pattern dom] -> Pattern dom

-- | Unboxed tuple pattern (<tt> (# x, y #) </tt>)
mkUnboxTuplePat :: [Pattern dom] -> Pattern dom

-- | List pattern (<tt> [1,2,a,x] </tt>)
mkListPat :: [Pattern dom] -> Pattern dom

-- | Parallel array pattern (<tt> [:1,2,a,x:] </tt>)
mkParArrayPat :: [Pattern dom] -> Pattern dom

-- | Parenthesised patterns
mkParenPat :: Pattern dom -> Pattern dom

-- | Record pattern (<tt> Point { x = 3, y } </tt>)
mkRecPat :: Name dom -> [PatternField dom] -> Pattern dom

-- | As-pattern (explicit name binding) (<tt> ls@(hd:_) </tt>)
mkAsPat :: Name dom -> Pattern dom -> Pattern dom

-- | Wildcard pattern: (<tt> _ </tt>)
mkWildPat :: Pattern dom

-- | Irrefutable pattern (<tt> ~(x:_) </tt>)
mkIrrefutablePat :: Pattern dom -> Pattern dom

-- | Bang pattern (<tt> !x </tt>)
mkBangPat :: Pattern dom -> Pattern dom

-- | Pattern with explicit type signature (<tt> x :: Int </tt>)
mkTypeSigPat :: Pattern dom -> Type dom -> Pattern dom

-- | View pattern (<tt> f -&gt; Just 1 </tt>)
mkViewPat :: Expr dom -> Pattern dom -> Pattern dom

-- | Splice patterns: <tt>$(generateX inp)</tt>
mkSplicePat :: Splice dom -> Pattern dom

-- | Quasi-quoted patterns: <tt>[| 1 + 2 |]</tt>
mkQuasiQuotePat :: QuasiQuote dom -> Pattern dom

-- | Named field pattern (<tt> p = Point 3 2 </tt>)
mkPatternField :: Name dom -> Pattern dom -> PatternField dom

-- | Named field pun (<tt> p </tt>)
mkFieldPunPattern :: Name dom -> PatternField dom

-- | Wildcard field pattern (<tt> .. </tt>)
mkFieldWildcardPattern :: PatternField dom


-- | Generation of binding-level AST fragments for refactorings. The
--   bindings defined here create a the annotated version of the AST
--   constructor with the same name. For example, <tt>mkMatch</tt> creates
--   the annotated version of the <tt>UMatch</tt> constructor.
module Language.Haskell.Tools.AST.Gen.Binds

-- | A simplified function to generate simple value bindings without local
--   definitions, guards or complex lhs.
mkSimpleBind' :: Name dom -> Expr dom -> ValueBind dom

-- | Creates a value binding (<tt> v = "12" </tt>).
mkSimpleBind :: Pattern dom -> Rhs dom -> Maybe (LocalBinds dom) -> ValueBind dom

-- | Creates a function binding (<tt> f 0 = 1; f x = x </tt>). All matches
--   must have the same name.
mkFunctionBind :: [Match dom] -> ValueBind dom

-- | A simplified function for creating function bindings without local
--   definitions or guards.
mkFunctionBind' :: Name dom -> [([Pattern dom], Expr dom)] -> ValueBind dom

-- | Creates a clause of function binding
mkMatch :: MatchLhs dom -> Rhs dom -> Maybe (LocalBinds dom) -> Match dom

-- | Creates a match lhs with the function name and parameter names (<tt> f
--   a b </tt>)
mkMatchLhs :: Name dom -> [Pattern dom] -> MatchLhs dom

-- | Creates an infix match lhs for an operator (<tt> a + b </tt>)
mkInfixLhs :: Pattern dom -> Operator dom -> Pattern dom -> [Pattern dom] -> MatchLhs dom

-- | Local bindings attached to a declaration (<tt> where x = 42 </tt>)
mkLocalBinds :: [LocalBind dom] -> MaybeLocalBinds dom
mkLocalBinds' :: [LocalBind dom] -> LocalBinds dom

-- | Creates a local binding for a value
mkLocalValBind :: ValueBind dom -> LocalBind dom

-- | Creates a local type signature
mkLocalTypeSig :: TypeSignature dom -> LocalBind dom

-- | Creates a local fixity declaration
mkLocalFixity :: FixitySignature dom -> LocalBind dom

-- | Creates a type signature (<tt> f :: Int -&gt; Int </tt>)
mkTypeSignature :: Name dom -> Type dom -> TypeSignature dom

-- | Creates a left-associative fixity declaration (<tt> infixl 5 +, -
--   </tt>).
mkInfixL :: Int -> Operator dom -> FixitySignature dom

-- | Creates a right-associative fixity declaration (<tt> infixr 5 +, -
--   </tt>).
mkInfixR :: Int -> Operator dom -> FixitySignature dom

-- | Creates a non-associative fixity declaration (<tt> infix 5 +, -
--   </tt>).
mkInfix :: Int -> Operator dom -> FixitySignature dom

-- | Creates an unguarded right-hand-side (<tt> = 3 </tt>)
mkUnguardedRhs :: Expr dom -> Rhs dom

-- | Creates an unguarded right-hand-side (<tt> | x == 1 = 3; | otherwise =
--   4 </tt>)
mkGuardedRhss :: [GuardedRhs dom] -> Rhs dom

-- | Creates a guarded right-hand side of a value binding (<tt> | x &gt; 3
--   = 2 </tt>)
mkGuardedRhs :: [RhsGuard dom] -> Expr dom -> GuardedRhs dom

-- | Creates a bind statement in a pattern guard (<tt> Just v &lt;- x
--   </tt>)
mkGuardBind :: Pattern dom -> Expr dom -> RhsGuard dom

-- | Creates a let statement in a pattern guard (<tt> let x = 3 </tt>)
mkGuardLet :: [LocalBind dom] -> RhsGuard dom

-- | Creates an expression to check for a pattern guard
mkGuardCheck :: Expr dom -> RhsGuard dom


-- | Generation of statement-level AST fragments for refactorings. The
--   bindings defined here are the AST constructor names with an "mk"
--   prefix.
module Language.Haskell.Tools.AST.Gen.Stmts

-- | Creates a binding statement (<tt> x &lt;- action </tt>)
mkBindStmt :: Pattern dom -> Expr dom -> Stmt dom

-- | Creates a non-binding statement (<tt> action </tt>)
mkExprStmt :: Expr dom -> Stmt dom

-- | Creates a let statement (<tt> let x = 3; y = 4 </tt>)
mkLetStmt :: [LocalBind dom] -> Stmt dom

-- | Creates a recursive binding statement with (<tt> rec b &lt;- f a c; c
--   &lt;- f b a </tt>)
mkRecStmt :: [Stmt dom] -> Stmt dom

-- | Body of a list comprehension: (<tt> | x &lt;- [1..10] </tt>)
mkListCompBody :: [CompStmt dom] -> ListCompBody dom

-- | Normal monadic statement of a list comprehension
mkCompStmt :: Stmt dom -> CompStmt dom

-- | Then statements by <tt>TransformListComp</tt> (<tt> then sortWith by
--   (x + y) </tt>)
mkThenStmt :: Expr dom -> Maybe (Expr dom) -> CompStmt dom

-- | Grouping statements by <tt>TransformListComp</tt> (<tt> then group by
--   (x + y) using groupWith </tt>)
mkGroupStmt :: Maybe (Expr dom) -> Maybe (Expr dom) -> CompStmt dom

-- | Creates a binding command (<tt> x &lt;- action </tt>)
mkBindCmd :: Pattern dom -> Cmd dom -> CmdStmt dom

-- | Creates a non-binding command (<tt> action </tt>)
mkExprCmd :: Cmd dom -> CmdStmt dom

-- | Creates a let command (<tt> let x = 3; y = 4 </tt>)
mkLetStmtCmd :: [LocalBind dom] -> CmdStmt dom

-- | Creates a recursive binding command with (<tt> rec b &lt;- f a c; c
--   &lt;- f b a </tt>)
mkRecCmd :: [CmdStmt dom] -> CmdStmt dom


-- | Generation of Template Haskell AST fragments for refactorings.
module Language.Haskell.Tools.AST.Gen.TH

-- | A simple name splice: <tt>$generateX</tt>
mkIdSplice :: Name dom -> Splice dom

-- | A splice with parentheses: <tt>$(generate input)</tt>
mkParenSplice :: Expr dom -> Splice dom

-- | Template haskell quasi-quotation: <tt>[quoter|str]</tt>
mkQuasiQuote :: Name dom -> String -> QuasiQuote dom

-- | Expression bracket (<tt> [| x + y |] </tt>)
mkExprBracket :: Expr dom -> Bracket dom

-- | Pattern bracket (<tt> [p| Point x y |] </tt>)
mkPatternBracket :: Pattern dom -> Bracket dom

-- | Type bracket (<tt> [t| (Int,Int) |] </tt>)
mkTypeBracket :: Type dom -> Bracket dom

-- | Declaration bracket (<tt> [d| f :: Int -&gt; Int; f x = x*x |] </tt>)
mkDeclsBracket :: [Decl dom] -> Bracket dom


-- | Generation of type-level AST fragments for refactorings. The bindings
--   defined here create a the annotated version of the AST constructor
--   with the same name. For example, <tt>mkTyForall</tt> creates the
--   annotated version of the <tt>TyForall</tt> AST constructor.
module Language.Haskell.Tools.AST.Gen.Types

-- | Forall types (<tt> forall x y . type </tt>)
mkForallType :: [TyVar dom] -> Type dom -> Type dom

-- | Simplified creation of type variables
mkTypeVar' :: Name -> TyVar dom

-- | Type with a context (<tt> forall x y . type </tt>)
mkCtxType :: Context dom -> Type dom -> Type dom

-- | Function types (<tt> a -&gt; b </tt>)
mkFunctionType :: Type dom -> Type dom -> Type dom

-- | Tuple types (<tt> (a,b) </tt>)
mkTupleType :: [Type dom] -> Type dom

-- | Unboxed tuple types (<tt> (#a,b#) </tt>)
mkUnboxedTupleType :: [Type dom] -> Type dom

-- | List type with special syntax (<tt> [a] </tt>)
mkListType :: Type dom -> Type dom

-- | Parallel array type (<tt> [:a:] </tt>)
mkParArrayType :: Type dom -> Type dom

-- | Type application (<tt> F a </tt>)
mkTypeApp :: Type dom -> Type dom -> Type dom

-- | Infix type constructor (<tt> (a &lt;: b) </tt>)
mkInfixTypeApp :: Type dom -> Operator dom -> Type dom -> Type dom

-- | Type surrounded by parentheses (<tt> (T a) </tt>)
mkParenType :: Type dom -> Type dom

-- | Creates a simple type variable
mkTypeVar :: Name dom -> TyVar dom

-- | Creates a type variable with kind specification (<tt> t :: * </tt>)
mkKindedTypeVar :: Name dom -> Kind dom -> TyVar dom

-- | Type variable or constructor (<tt> a </tt>)
mkVarType :: Name dom -> Type dom

-- | Type with explicit kind signature (<tt> a :: * </tt>)
mkKindedType :: Type dom -> Kind dom -> Type dom

-- | Strict type marked with <tt>!</tt>.
mkBangType :: Type dom -> Type dom

-- | Lazy type marked with <tt>~</tt>. (Should only be used if
--   <tt>Strict</tt> or <tt>StrictData</tt> language extension is used)
mkLazyType :: Type dom -> Type dom

-- | Strict type marked with UNPACK pragma. (Usually contains the bang
--   mark.)
mkUnpackType :: Type dom -> Type dom

-- | Strict type marked with UNPACK pragma. (Usually contains the bang
--   mark.)
mkNoUnpackType :: Type dom -> Type dom

-- | A wildcard type (<tt> _ </tt>) with <tt>-XPartialTypeSignatures</tt>
mkWildcardType :: Type dom

-- | A named wildcard type (<tt> _t </tt>) with
--   <tt>-XPartialTypeSignatures</tt>
mkNamedWildcardType :: Name dom -> Type dom

-- | A Template Haskell splice type (<tt> $(genType) </tt>).
mkSpliceType :: Splice dom -> Type dom

-- | A Template Haskell quasi-quote type (<tt> [quoter| ... ] </tt>).
mkQuasiQuoteType :: QuasiQuote dom -> Type dom

-- | Numeric value promoted to the kind level.
mkPromotedIntType :: Integer -> Type dom

-- | String value promoted to the kind level.
mkPromotedStringType :: String -> Type dom

-- | A data constructor value promoted to the kind level.
mkPromotedConType :: Name dom -> Type dom

-- | A list of elements as a kind.
mkPromotedListType :: [Type dom] -> Type dom

-- | A tuple of elements as a kind.
mkPromotedTupleType :: [Type dom] -> Type dom

-- | Kind of the unit value <tt>()</tt>.
mkPromotedUnitType :: Type dom

-- | Creates a context of assertions (<tt> C a =&gt; ... </tt>)
mkContext :: Assertion dom -> Context dom

-- | Class assertion (<tt>Cls x</tt>)
mkClassAssert :: Name dom -> [Type dom] -> Assertion dom

-- | Infix class assertion, also contains type equations (<tt> a ~ X y
--   </tt>)
mkInfixAssert :: Type dom -> Operator dom -> Type dom -> Assertion dom

-- | Creates an assertion for implicit parameter binding (<tt> ?cmp :: a
--   -&gt; a -&gt; Bool </tt>)
mkImplicitAssert :: Name dom -> Type dom -> Assertion dom

-- | Creates a list of assertions (<tt> (Eq a, Show a) </tt>)
mkTupleAssertion :: [Assertion dom] -> Assertion dom


-- | Public interface for the modules that can be used to generate parts
--   the AST.
module Language.Haskell.Tools.AST.Gen


-- | UPattern matching on binding-level AST fragments for refactorings.
module Language.Haskell.Tools.AST.Match.Binds

-- | Non-function binding (<tt> v = "12" </tt>)

-- | Function binding (<tt> f 0 = 1; f x = x </tt>). All matches must have
--   the same name.

-- | Clause of function binding

-- | A match lhs with the function name and parameter names (<tt> f a b
--   </tt>)

-- | An infix match lhs for an operator (<tt> a + b </tt>)

-- | Local bindings attached to a declaration (<tt> where x = 42 </tt>)

-- | A local binding for a value

-- | A local type signature

-- | A local fixity declaration

-- | A type signature (<tt> f :: Int -&gt; Int </tt>)

-- | A left-associative fixity declaration (<tt> infixl 5 +, - </tt>).

-- | A right-associative fixity declaration (<tt> infixr 5 +, - </tt>).

-- | A non-associative fixity declaration (<tt> infix 5 +, - </tt>).

-- | An unguarded right-hand-side (<tt> = 3 </tt>)

-- | An unguarded right-hand-side (<tt> | x == 1 = 3; | otherwise = 4
--   </tt>)

-- | A guarded right-hand side of a value binding (<tt> | x &gt; 3 = 2
--   </tt>)

-- | A bind statement in a pattern guard (<tt> Just v &lt;- x </tt>)

-- | A let statement in a pattern guard (<tt> let x = 3 </tt>)

-- | An expression to check for a pattern guard


-- | UPattern matching on declaration-level AST fragments for refactorings.
module Language.Haskell.Tools.AST.Match.Decls

-- | A type synonym ( <tt>type String = [Char]</tt> )

-- | Standalone deriving declaration (<tt> deriving instance X T </tt>)

-- | Fixity declaration (<tt> infixl 5 +, - </tt>)

-- | Default types (<tt> default (T1, T2) </tt>)

-- | Type signature declaration (<tt> f :: Int -&gt; Int </tt>)

-- | Function or value binding (<tt> f x = 12 </tt>)

-- | A Template Haskell splice declaration (<tt> $(generateDecls) </tt>)

-- | A data or newtype declaration. Empty data type declarations without
--   where keyword are always belong to DataDecl.

-- | A GADT-style data or newtype declaration.

-- | GADT constructor declaration (<tt> D1 :: Int -&gt; T String </tt>)

-- | GADT constructor declaration with record syntax (<tt> D1 :: { val ::
--   Int } -&gt; T String </tt>)

-- | Ordinary data constructor (<tt> C t1 t2 </tt>)

-- | Creates a record data constructor (<tt> Point { x :: Double, y ::
--   Double } </tt>)

-- | Infix data constructor (<tt> t1 :+: t2 </tt>)

-- | Field declaration (<tt> fld :: Int </tt>)

-- | A deriving clause without parentheses (<tt> deriving Show </tt>.

-- | A deriving clause with parentheses <tt> deriving (Show, Eq) </tt>)

-- | A list of functional dependencies: <tt> | a -&gt; b, c -&gt; d </tt>
--   separated by commas

-- | A functional dependency, given on the form <tt>l1 ... ln -&gt; r1 ...
--   rn</tt>

-- | Type class declaration (<tt> class X a [where f = ...] </tt>)

-- | The list of declarations that can appear in a typeclass

-- | Type signature: <tt> f :: A -&gt; B </tt> as a class member

-- | Default binding: <tt> f x = "aaa" </tt> as a class member

-- | Declaration of an associated type synonym: <tt> type T x :: * </tt> in
--   a class

-- | Declaration of an associated data synonym: <tt> data T x :: * </tt> in
--   a class

-- | Default choice for type synonym: <tt> type T x = TE </tt> or <tt> type
--   instance T x = TE </tt> in a class

-- | Default signature (by using <tt>DefaultSignatures</tt>): <tt> default
--   enum :: (Generic a, GEnum (Rep a)) =&gt; [a] </tt>

-- | Minimal pragma: <tt> {-# MINIMAL (==) | (/=) #-} </tt> in a class

-- | One of the minimal formulas are needed (<tt> min1 | min2 </tt>)

-- | Both of the minimal formulas are needed (<tt> min1 , min2 </tt>)

-- | Type or class name as a declaration head

-- | Parenthesized type as a declaration head

-- | Type application as a declaration head

-- | Infix type application as a declaration head

-- | Instance declaration (<tt> instance X T [where f = ...] </tt>)

-- | Instance body is the implementation of the class functions (<tt> where
--   a x = 1; b x = 2 </tt>)

-- | A normal value binding (<tt> f x = 12 </tt>) inside a class instance

-- | Type signature in instance definition with <tt>InstanceSigs</tt>

-- | An associated type definition (<tt> type A X = B </tt>) in a class
--   instance

-- | An associated data definition (<tt> data A X = B Int | C </tt>) in a
--   class instance

-- | An associated data definition as a GADT (<tt> data A X where B :: Int
--   -&gt; A X </tt>) in a class instance

-- | Specialize instance pragma in a class instance (no phase selection is
--   allowed)

-- | Instance head as an instance rule (<tt> X a =&gt; Y a </tt>)

-- | Type or class name as an instance head

-- | Infix application of the type/class name to the left operand as an
--   instance head

-- | Parenthesized instance head

-- | Type application as an instance head

-- | <tt>OVERLAP</tt> pragma

-- | <tt>NO_OVERLAP</tt> pragma

-- | <tt>OVERLAPPABLE</tt> pragma

-- | <tt>OVERLAPPING</tt> pragma

-- | <tt>OVERLAPS</tt> pragma

-- | <tt>INCOHERENT</tt> pragma

-- | Role annotations (<tt> type role Ptr representational </tt>)

-- | Foreign import (<tt> foreign import foo :: Int -&gt; IO Int </tt>)

-- | Foreign export (<tt> foreign export ccall foo :: Int -&gt; IO Int
--   </tt>)

-- | Specifies <tt>stdcall</tt> calling convention for foreign
--   import/export.

-- | Specifies <tt>ccall</tt> calling convention for foreign import/export.

-- | Specifies <tt>capi</tt> calling convention for foreign import/export.

-- | Specifies that the given foreign import is <tt>unsafe</tt>.

-- | Pattern synonyms (<tt> pattern Arrow t1 t2 = App "-&gt;" [t1, t2]
--   </tt>)

-- | A left hand side with a constructor name and arguments (<tt> Arrow t1
--   t2 </tt>)

-- | An infix pattern synonym left-hand side (<tt> t1 :+: t2 </tt>)

-- | A record-style pattern synonym left-hand side (<tt> Arrow { arrowFrom,
--   arrowTo } </tt>)

-- | An automatically two-way pattern synonym (<tt> = App "Int" [] </tt>)

-- | A pattern synonym that can be only used for pattenr matching but not
--   for combining (<tt> &lt;- App "Int" [] </tt>)

-- | A pattern synonym with the other direction explicitly specified (<tt>
--   &lt;- App "Int" [] where Int = App "Int" [] </tt>)

-- | Pattern type signature declaration (<tt> pattern Succ :: Int -&gt; Int
--   </tt>)

-- | Type family declaration (<tt> type family A a :: * -&gt; * </tt>)

-- | Data family declaration (<tt> data family A a :: * -&gt; * </tt>)

-- | Type family instance declaration (<tt> type instance Fam T = AssignedT
--   </tt>)

-- | Data instance declaration (<tt> data instance Fam T = Con1 | Con2
--   </tt>)

-- | GADT-style data instance declaration (<tt> data instance Fam T where
--   ... </tt>)

-- | A closed type family declaration

-- | Specifies the kind of a type family (<tt> :: * -&gt; * </tt>)

-- | Specifies the injectivity of a type family (<tt> = r | r -&gt; a
--   </tt>)

-- | Type equations as found in closed type families (<tt> T A = S </tt>)

-- | Top-level pragmas

-- | A pragma that introduces source rewrite rules (<tt> {-# RULES
--   "map/map" [2] forall f g xs. map f (map g xs) = map (f.g) xs #-}
--   </tt>)

-- | A pragma that marks definitions as deprecated (<tt> {-# DEPRECATED f
--   "f will be replaced by g" #-} </tt>)

-- | A pragma that marks definitions as deprecated (<tt> {-# WARNING
--   unsafePerformIO "you should know what you are doing" #-} </tt>)

-- | A pragma that annotates a definition with an arbitrary value (<tt> {-#
--   ANN f 42 #-} </tt>)

-- | A pragma that marks a function for inlining to the compiler (<tt> {-#
--   INLINE thenUs #-} </tt>)

-- | A pragma that forbids a function from being inlined by the compiler
--   (<tt> {-# NOINLINE f #-} </tt>)

-- | A pragma that marks a function that it may be inlined by the compiler
--   (<tt> {-# INLINABLE thenUs #-} </tt>)

-- | A pragma for maintaining line numbers in generated sources (<tt> {-#
--   LINE 123 "somefile" #-} </tt>)

-- | A pragma that tells the compiler that a polymorph function should be
--   optimized for a given type (<tt> {-# SPECIALISE f :: Int -&gt; b -&gt;
--   b #-} </tt>)

-- | Marks that the pragma should be applied from a given compile phase
--   (<tt> [2] </tt>)

-- | Marks that the pragma should be applied until a given compile phase
--   (<tt> [~2] </tt>)

-- | A rewrite rule (<tt> "map/map" forall f g xs. map f (map g xs) = map
--   (f.g) xs </tt>)

-- | The definition with the given name is annotated

-- | A type with the given name is annotated

-- | The whole module is annotated

-- | A <tt>CONLIKE</tt> modifier for an <tt>INLINE</tt> pragma.


-- | UPattern matching on statement-level AST fragments for refactorings.
module Language.Haskell.Tools.AST.Match.Kinds

-- | Kind constraint (<tt> :: * -&gt; * </tt>)

-- | <tt>*</tt>, the kind of types

-- | <tt>#</tt>, the kind of unboxed types

-- | <tt>-&gt;</tt>, the kind of type constructor

-- | A parenthesised kind

-- | Kind variable (using <tt>PolyKinds</tt> extension)

-- | Kind application (<tt> k1 k2 </tt>)

-- | A list kind (<tt> [k] </tt>)

-- | Numeric value promoted to the kind level.

-- | String value promoted to the kind level.

-- | A data constructor value promoted to the kind level.

-- | A list of elements as a kind.

-- | A tuple of elements as a kind.

-- | Kind of the unit value <tt>()</tt>.


-- | UPattern matching on literals for refactorings.
module Language.Haskell.Tools.AST.Match.Literals

-- | Character literal: <tt><tt>c</tt></tt>

-- | String literal: <tt>"abc"</tt>

-- | Integer literal: <tt>12</tt>

-- | Fractional literal: <tt>3.14</tt>

-- | Primitive integer literal (of type <tt>Int#</tt>): <tt>32#</tt>

-- | Primitive word literal (of type <tt>Word#</tt>): <tt>32##</tt>

-- | Primitive float literal (of type <tt>Float#</tt>): <tt>3.14#</tt>

-- | Primitive double literal (of type <tt>Double#</tt>): <tt>3.14##</tt>

-- | Primitive character literal (of type <tt>Char#</tt>):
--   <tt><tt>c</tt>#</tt>

-- | Primitive string literal (of type <tt>Addr#</tt>): <tt>"xxx"#</tt>


-- | UPattern matching on UModule-level AST fragments for refactorings.
module Language.Haskell.Tools.AST.Match.Modules

-- | The representation of a haskell module, that is a separate compilation
--   unit. It may or may not have a header.

-- | Module declaration with name and (optional) exports

-- | A list of export specifications surrounded by parentheses

-- | Export a name and related names

-- | The export of an imported module (<tt> module A </tt>)

-- | Marks a name to be imported or exported with related names
--   (subspecifier)

-- | <tt>(..)</tt>: a class exported with all of its methods, or a datatype
--   exported with all of its constructors.

-- | <tt>(a,b,c)</tt>: a class exported with some of its methods, or a
--   datatype exported with some of its constructors.

-- | <tt>LANGUAGE</tt> pragma, listing the enabled language extensions in
--   that file

-- | <tt>OPTIONS</tt> pragma, possibly qualified with a tool, e.g.
--   OPTIONS_GHC

-- | The name of the enabled language extension, for example (<tt>
--   LambdaCase </tt>)

-- | A warning pragma attached to the module

-- | A deprecated pragma attached to the module


-- | Generation of basic AST fragments (names for example) for refactorings
module Language.Haskell.Tools.AST.Match.Names

-- | A normal operator used as an operator.

-- | A normal name used as an operator with backticks: <tt> a `mod` b </tt>

-- | A normal, non-operator name.

-- | Parenthesized name: <tt> foldl (+) 0 </tt>

-- | Creates an implicit name: <tt> ?var </tt>

-- | Program elements formatted as string literals (import packages, pragma
--   texts)

-- | Possibly qualified name.

-- | Parts of a qualified name.


-- | UPattern matching on pattern-level AST fragments for refactorings.
module Language.Haskell.Tools.AST.Match.Patterns

-- | Pattern name binding

-- | Literal pattern

-- | Infix constructor application pattern (<tt> a :+: b </tt>)

-- | Constructor application pattern (<tt> Point x y </tt>)

-- | Tuple pattern (<tt> (x,y) </tt>)

-- | Unboxed tuple pattern (<tt> (# x, y #) </tt>)

-- | List pattern (<tt> [1,2,a,x] </tt>)

-- | Parallel array pattern (<tt> [:1,2,a,x:] </tt>)

-- | Parenthesised patterns

-- | Record pattern (<tt> Point { x = 3, y } </tt>)

-- | As-pattern (explicit name binding) (<tt> ls@(hd:_) </tt>)

-- | Wildcard pattern: (<tt> _ </tt>)

-- | Irrefutable pattern (<tt> ~(x:_) </tt>)

-- | Bang pattern (<tt> !x </tt>)

-- | Pattern with explicit type signature (<tt> x :: Int </tt>)

-- | View pattern (<tt> f -&gt; Just 1 </tt>)

-- | Splice patterns: <tt>$(generateX inp)</tt>

-- | Quasi-quoted patterns: <tt>[| 1 + 2 |]</tt>

-- | Named field pattern (<tt> p = Point 3 2 </tt>)

-- | Named field pun (<tt> p </tt>)

-- | Wildcard field pattern (<tt> .. </tt>)


-- | UPattern matching on statement-level AST fragments for refactorings.
module Language.Haskell.Tools.AST.Match.Stmts

-- | Binding statement (<tt> x &lt;- action </tt>)

-- | Non-binding statement (<tt> action </tt>)

-- | Let statement (<tt> let x = 3; y = 4 </tt>)

-- | A recursive binding statement with (<tt> rec b &lt;- f a c; c &lt;- f
--   b a </tt>)

-- | Body of a list comprehension: (<tt> | x &lt;- [1..10] </tt>)

-- | Normal monadic statement of a list comprehension

-- | Then statements by <tt>TransformListComp</tt> (<tt> then sortWith by
--   (x + y) </tt>)

-- | Grouping statements by <tt>TransformListComp</tt> (<tt> then group by
--   (x + y) using groupWith </tt>)

-- | Binding statement command (<tt> x &lt;- action </tt>)

-- | Non-binding statement command (<tt> action </tt>)

-- | Let statement command (<tt> let x = 3; y = 4 </tt>)

-- | A recursive binding statement command with (<tt> rec b &lt;- f a c; c
--   &lt;- f b a </tt>)


-- | UPattern matching expression-level AST fragments for refactorings.
module Language.Haskell.Tools.AST.Match.Exprs

-- | An expression for a variable or a data constructor (<tt> a </tt>)

-- | A literal expression (<tt> 42 </tt>)

-- | An infix operator application (<tt> a + b </tt>)

-- | Prefix operator application (<tt> -x </tt>)

-- | Function application (<tt> f 4 </tt>)

-- | Lambda expression (<tt> \a b -&gt; a + b </tt>)

-- | Local binding (<tt> let x = 2; y = 3 in e x y </tt>)

-- | If expression (<tt> if a then b else c </tt>)

-- | Multi way if expressions with <tt>MultiWayIf</tt> extension (<tt> if |
--   guard1 -&gt; expr1; guard2 -&gt; expr2 </tt>)

-- | Pattern matching expression (<tt> case expr of pat1 -&gt; expr1; pat2
--   -&gt; expr2 </tt>)

-- | Do-notation expressions (<tt> do x &lt;- act1; act2 </tt>)

-- | Tuple expression (<tt> (e1, e2, e3) </tt>)

-- | Unboxed tuple expression (<tt> (# e1, e2, e3 #) </tt>)

-- | Tuple section, enabled with <tt>TupleSections</tt> (<tt> (a,,b)
--   </tt>). One of the elements must be missing.

-- | Unboxed tuple section enabled with <tt>TupleSections</tt> (<tt> ()
--   </tt>). One of the elements must be missing.

-- | List expression: <tt>[1,2,3]</tt>

-- | Parallel array expression: <tt>[: 1,2,3 :]</tt>

-- | Parenthesized expression: <tt>( a + b )</tt>

-- | Left operator section: <tt>(1+)</tt>

-- | Right operator section: <tt>(+1)</tt>

-- | Record value construction: <tt>Point { x = 3, y = -2 }</tt>

-- | Record value update: <tt>p1 { x = 3, y = -2 }</tt>

-- | Enumeration expression (<tt> [1,3..10] </tt>)

-- | Parallel array enumeration (<tt> [: 1,3 .. 10 :] </tt>)

-- | List comprehension (<tt> [ (x, y) | x &lt;- xs | y &lt;- ys ] </tt>)

-- | Parallel array comprehensions <tt> [: (x, y) | x &lt;- xs , y &lt;- ys
--   :] </tt> enabled by <tt>ParallelArrays</tt>

-- | Explicit type signature (<tt> x :: Int </tt>)

-- | Explicit type application (<tt> show @Integer (read "5") </tt>)

-- | <tt>'x</tt> for template haskell reifying of expressions

-- | <tt>''T</tt> for template haskell reifying of types

-- | Template haskell bracket expression

-- | Template haskell splice expression, for example: <tt>$(gen a)</tt> or
--   <tt>$x</tt>

-- | Template haskell quasi-quotation: <tt>[$quoter|str]</tt>

-- | Template haskell quasi-quotation: <tt>[$quoter|str]</tt>

-- | Arrow definition: <tt>proc a -&gt; f -&lt; a+1</tt>

-- | Arrow definition: <tt>proc a -&gt; f -&lt; a+1</tt>

-- | Lambda case ( <tt>case 0 -&gt; 1; 1 -&gt; 2</tt> )

-- | Static pointer expression (<tt> static e </tt>). The inner expression
--   must be closed (cannot have variables bound outside)

-- | Update of a field (<tt> x = 1 </tt>)

-- | Update the field to the value of the same name (<tt> x </tt>)

-- | Update the fields of the bounded names to their values (<tt> ..
--   </tt>). Must be the last initializer. Cannot be used in a record
--   update expression.

-- | An existing element in a tuple section

-- | A missing element in a tuple section

-- | Clause of case expression (<tt> Just x -&gt; x + 1 </tt>)

-- | Unguarded right-hand side a pattern match (<tt> -&gt; 3 </tt>)

-- | Guarded right-hand sides of a pattern match (<tt> | x == 1 -&gt; 3; |
--   otherwise -&gt; 4 </tt>)

-- | A guarded right-hand side of pattern matches binding (<tt> | x &gt; 3
--   -&gt; 2 </tt>)

-- | A <tt>CORE</tt> pragma for adding notes to expressions.

-- | An <tt>SCC</tt> pragma for defining cost centers for profiling

-- | A pragma that describes if an expression was generated from a code
--   fragment by an external tool (<tt> {--} </tt>)

-- | In-AST source ranges (for generated pragmas)

-- | An arrow application command (<tt> f -&lt; x + 1 </tt>)

-- | A form command (<tt> (|untilA (increment -&lt; x+y) (within 0.5 -&lt;
--   x)|) </tt>)

-- | A function application command

-- | An infix command application

-- | An infix command application

-- | A parenthesized command

-- | A pattern match command

-- | An if command (<tt> if f x y then g -&lt; x+1 else h -&lt; y+2 </tt>)

-- | A local binding command (<tt> let z = x+y </tt>)

-- | A local binding command (<tt> let z = x+y </tt>)

-- | Left arrow application: <tt>-&lt;</tt>

-- | Right arrow application: <tt>&gt;-</tt>

-- | Left arrow high application: <tt>-&lt;&lt;</tt>

-- | Right arrow high application: <tt>&gt;&gt;-</tt>


-- | Pattern matching on Template Haskell AST fragments for refactorings.
module Language.Haskell.Tools.AST.Match.TH

-- | A simple name splice: <tt>$generateX</tt>

-- | A splice with parentheses: <tt>$(generate input)</tt>

-- | Template haskell quasi-quotation: <tt>[quoter|str]</tt>

-- | Expression bracket (<tt> [| x + y |] </tt>)

-- | Pattern bracket (<tt> [p| Point x y |] </tt>)

-- | Type bracket (<tt> [t| (Int,Int) |] </tt>)

-- | Declaration bracket (<tt> [d| f :: Int -&gt; Int; f x = x*x |] </tt>)


-- | UPattern matching on type-level AST fragments for refactorings.
module Language.Haskell.Tools.AST.Match.Types

-- | Forall types (<tt> forall x y . type </tt>)

-- | Type with a context (<tt> forall x y . type </tt>)

-- | Function types (<tt> a -&gt; b </tt>)

-- | Tuple types (<tt> (a,b) </tt>)

-- | Unboxed tuple types (<tt> (#a,b#) </tt>)

-- | List type with special syntax (<tt> [a] </tt>)

-- | Parallel array type (<tt> [:a:] </tt>)

-- | Type application (<tt> F a </tt>)

-- | Infix type constructor (<tt> (a &lt;: b) </tt>)

-- | Type surrounded by parentheses (<tt> (T a) </tt>)

-- | Type variable or constructor (<tt> a </tt>)

-- | Type with explicit kind signature (<tt> a :: * </tt>)

-- | Strict type marked with <tt>!</tt>.

-- | Lazy type marked with <tt>~</tt>. (Should only be used if
--   <tt>Strict</tt> or <tt>StrictData</tt> language extension is used)

-- | Strict type marked with UNPACK pragma. (Usually contains the bang
--   mark.)

-- | Strict type marked with NOUNPACK pragma. (Usually contains the bang
--   mark.)

-- | A wildcard type (<tt> _ </tt>) with <tt>-XPartialTypeSignatures</tt>

-- | A named wildcard type (<tt> _t </tt>) with
--   <tt>-XPartialTypeSignatures</tt>

-- | A Template Haskell splice type (<tt> $(genType) </tt>).

-- | A Template Haskell splice type (<tt> $(genType) </tt>).

-- | Numeric value promoted to the type level.

-- | String value promoted to the type level.

-- | A data constructor value promoted to the type level.

-- | A list of elements as a type.

-- | A tuple of elements as a type.

-- | Kind of the unit value <tt>()</tt>.

-- | Type variable declaration

-- | Kinded type variable declaration (<tt> v :: * </tt>)

-- | A context of assertions (<tt> C a =&gt; ... </tt>)

-- | Class assertion (<tt>Cls x</tt>)

-- | Infix class assertion, also contains type equations (<tt> a ~ X y
--   </tt>)

-- | Assertion for implicit parameter binding (<tt> ?cmp :: a -&gt; a -&gt;
--   Bool </tt>)

-- | A list of assertions (<tt> (Eq a, Show a) </tt>)


-- | Public interface for the modules that can be used to pattern match on
--   the AST.
module Language.Haskell.Tools.AST.Match


-- | Public interface for the modules that can be used to rewrite the AST.
--   Contains modules for constructing parts of the AST and modules for
--   pattern matching (deconstructing) parts of the AST.
module Language.Haskell.Tools.AST.Rewrite
