-- 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 1.1.0.1

module Language.Haskell.Tools.Rewrite.ElementTypes
type AnnList node = AnnListG node IdDom SrcTemplateStage
type AnnMaybe node = AnnMaybeG node IdDom SrcTemplateStage

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

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

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

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

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

-- | Specifies the imported element
type ImportModifier = Ann UImportModifier IdDom SrcTemplateStage

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | A deriving strategy (<tt>stock</tt>, <tt>newtype</tt> or
--   <tt>anyclass</tt>)
type DeriveStrategy = Ann UDeriveStrategy IdDom SrcTemplateStage

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

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

-- | Specialize pragma (<tt> {--} </tt>)
type SpecializePragma = Ann USpecializePragma IdDom SrcTemplateStage

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | Clause of case expression (<tt> Just x -&gt; x + 1 </tt>)
type Alt = Ann UAlt IdDom 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 = Ann UCaseRhs IdDom SrcTemplateStage

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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


-- | 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.Rewrite.Create.Stmts

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

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

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

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

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

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

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

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

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

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

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

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


-- | 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.Rewrite.Create.Patterns

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


-- | Generation of names for refactorings
module Language.Haskell.Tools.Rewrite.Create.Names

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

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

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

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

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

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

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

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

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

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

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

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


-- | 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.Rewrite.Create.Modules

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

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

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

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

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

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

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

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

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

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

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

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

-- | The name of a module
mkModuleName :: String -> ModuleName
mkFilePragmas :: [FilePragma] -> FilePragmaList

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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


-- | 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.Rewrite.Create.Kinds

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

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

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

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

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

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

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

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

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

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

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

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

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

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


-- | 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.Rewrite.Create.Types

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


-- | 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.Rewrite.Create.Exprs

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | 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

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

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

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

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

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

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

-- | 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 -> ExprPragma

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | A hole expression <tt>_</tt>
mkHole :: Expr


-- | 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.Rewrite.Create.Decls

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | 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 -> Type -> ClassElement

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | 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] -> TopLevelPragma

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

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

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

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

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

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

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

-- | 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 -> Name -> [Type] -> TopLevelPragma

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

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

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

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

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

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

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


-- | 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.Rewrite.Create.Binds

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


-- | UPattern matching on binding-level AST fragments for refactorings.
module Language.Haskell.Tools.Rewrite.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.Rewrite.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 without parentheses, with/witohut strategy (<tt>
--   deriving stock Show </tt>.

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

-- | A deriving clause with parentheses, with/witohut strategy (<tt>
--   deriving stock (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.Rewrite.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.Rewrite.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.Rewrite.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.Rewrite.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.Rewrite.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.Rewrite.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.Rewrite.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>)

-- | MDo-notation expressions (<tt> mdo 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>

-- | A hole expression <tt>_</tt>


-- | Pattern matching on Template Haskell AST fragments for refactorings.
module Language.Haskell.Tools.Rewrite.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.Rewrite.Match.Types

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

-- | Type with a context (<tt> C a =&gt; 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>.

-- | An unboxed sum type.

-- | 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.Rewrite.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.Rewrite
