haskell-tools-rewrite-1.1.1.0: Facilities for generating new parts of the Haskell-Tools AST

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.Rewrite.Match.Exprs

Contents

Description

UPattern matching expression-level AST fragments for refactorings.

Synopsis

Expressions

pattern Var :: Name -> Expr Source #

An expression for a variable or a data constructor ( a )

pattern Lit :: Literal -> Expr Source #

A literal expression ( 42 )

pattern InfixApp :: Expr -> Operator -> Expr -> Expr Source #

An infix operator application ( a + b )

pattern PrefixApp :: Operator -> Expr -> Expr Source #

Prefix operator application ( -x )

pattern App :: Expr -> Expr -> Expr Source #

Function application ( f 4 )

pattern Lambda :: PatternList -> Expr -> Expr Source #

Lambda expression ( \a b -> a + b )

pattern Let :: LocalBindList -> Expr -> Expr Source #

Local binding ( let x = 2; y = 3 in e x y )

pattern If :: Expr -> Expr -> Expr -> Expr Source #

If expression ( if a then b else c )

pattern MultiIf :: GuardedCaseRhsList -> Expr Source #

Multi way if expressions with MultiWayIf extension ( if | guard1 -> expr1; guard2 -> expr2 )

pattern Case :: Expr -> AltList -> Expr Source #

Pattern matching expression ( case expr of pat1 -> expr1; pat2 -> expr2 )

pattern Do :: StmtList -> Expr Source #

Do-notation expressions ( do x <- act1; act2 )

pattern MDo :: StmtList -> Expr Source #

MDo-notation expressions ( mdo x <- act1; act2 )

pattern Tuple :: ExprList -> Expr Source #

Tuple expression ( (e1, e2, e3) )

pattern UnboxedTuple :: ExprList -> Expr Source #

Unboxed tuple expression ( (# e1, e2, e3 #) )

pattern TupleSection :: TupSecElemList -> Expr Source #

Tuple section, enabled with TupleSections ( (a,,b) ). One of the elements must be missing.

pattern UnboxedTupleSection :: TupSecElemList -> Expr Source #

Unboxed tuple section enabled with TupleSections ( () ). One of the elements must be missing.

pattern List :: ExprList -> Expr Source #

List expression: [1,2,3]

pattern ParArray :: ExprList -> Expr Source #

Parallel array expression: [: 1,2,3 :]

pattern Paren :: Expr -> Expr Source #

Parenthesized expression: ( a + b )

pattern LeftSection :: Expr -> Operator -> Expr Source #

Left operator section: (1+)

pattern RightSection :: Operator -> Expr -> Expr Source #

Right operator section: (+1)

pattern RecCon :: Name -> FieldUpdateList -> Expr Source #

Record value construction: Point { x = 3, y = -2 }

pattern RecUpdate :: Expr -> FieldUpdateList -> Expr Source #

Record value update: p1 { x = 3, y = -2 }

pattern Enum :: Expr -> MaybeExpr -> MaybeExpr -> Expr Source #

Enumeration expression ( [1,3..10] )

pattern ParArrayEnum :: Expr -> MaybeExpr -> Expr -> Expr Source #

Parallel array enumeration ( [: 1,3 .. 10 :] )

pattern ListComp :: Expr -> ListCompBodyList -> Expr Source #

List comprehension ( [ (x, y) | x <- xs | y <- ys ] )

pattern ParArrayListComp :: Expr -> ListCompBodyList -> Expr Source #

Parallel array comprehensions [: (x, y) | x <- xs , y <- ys :] enabled by ParallelArrays

pattern TypeSig :: Expr -> Type -> Expr Source #

Explicit type signature ( x :: Int )

pattern ExplicitTypeApp :: Expr -> Type -> Expr Source #

Explicit type application ( show @Integer (read "5") )

pattern VarQuote :: Name -> Expr Source #

'x for template haskell reifying of expressions

pattern TypeQuote :: Name -> Expr Source #

''T for template haskell reifying of types

pattern BracketExpr :: Bracket -> Expr Source #

Template haskell bracket expression

pattern SpliceExpr :: Splice -> Expr Source #

Template haskell splice expression, for example: $(gen a) or $x

pattern QuasiQuoteExpr :: QuasiQuote -> Expr Source #

Template haskell quasi-quotation: [$quoter|str]

pattern ExprPragma :: ExprPragma -> Expr -> Expr Source #

Template haskell quasi-quotation: [$quoter|str]

pattern Proc :: Pattern -> Cmd -> Expr Source #

Arrow definition: proc a -> f -< a+1

pattern ArrowApp :: Expr -> ArrowApp -> Expr -> Expr Source #

Arrow definition: proc a -> f -< a+1

pattern LambdaCase :: AltList -> Expr Source #

Lambda case ( case 0 -> 1; 1 -> 2 )

pattern StaticPointer :: Expr -> Expr Source #

Static pointer expression ( static e ). The inner expression must be closed (cannot have variables bound outside)

Field updates

pattern NormalFieldUpdate :: Name -> Expr -> FieldUpdate Source #

Update of a field ( x = 1 )

pattern FieldPun :: Name -> FieldUpdate Source #

Update the field to the value of the same name ( x )

pattern FieldWildcard :: FieldWildcard -> FieldUpdate Source #

Update the fields of the bounded names to their values ( .. ). Must be the last initializer. Cannot be used in a record update expression.

Tuple sections

pattern TupSecPresent :: Expr -> TupSecElem Source #

An existing element in a tuple section

pattern TupSecMissing :: TupSecElem Source #

A missing element in a tuple section

Pattern matching and guards

pattern Alt :: Pattern -> CaseRhs -> MaybeLocalBinds -> Alt Source #

Clause of case expression ( Just x -> x + 1 )

pattern CaseRhs :: Expr -> CaseRhs Source #

Unguarded right-hand side a pattern match ( -> 3 )

pattern GuardedCaseRhss :: GuardedCaseRhsList -> CaseRhs Source #

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

pattern GuardedCaseRhs :: RhsGuardList -> Expr -> GuardedCaseRhs Source #

A guarded right-hand side of pattern matches binding ( | x > 3 -> 2 )

Pragmas that can be applied to expressions

pattern CorePragma :: String -> ExprPragma Source #

A CORE pragma for adding notes to expressions.

pattern SccPragma :: String -> ExprPragma Source #

An SCC pragma for defining cost centers for profiling

pattern GeneratedPragma :: SourceRange -> ExprPragma Source #

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

pattern SourceRange :: String -> Integer -> Integer -> Integer -> Integer -> SourceRange Source #

In-AST source ranges (for generated pragmas)

Commands

pattern ArrowAppCmd :: Expr -> ArrowApp -> Expr -> Cmd Source #

An arrow application command ( f -< x + 1 )

pattern ArrowFormCmd :: Expr -> CmdList -> Cmd Source #

A form command ( (|untilA (increment -< x+y) (within 0.5 -< x)|) )

pattern AppCmd :: Cmd -> Expr -> Cmd Source #

A function application command

pattern InfixCmd :: Cmd -> Name -> Cmd -> Cmd Source #

An infix command application

pattern LambdaCmd :: PatternList -> Cmd -> Cmd Source #

An infix command application

pattern ParenCmd :: Cmd -> Cmd Source #

A parenthesized command

pattern CaseCmd :: Expr -> CmdAltList -> Cmd Source #

A pattern match command

pattern IfCmd :: Expr -> Cmd -> Cmd -> Cmd Source #

An if command ( if f x y then g -< x+1 else h -< y+2 )

pattern LetCmd :: LocalBindList -> Cmd -> Cmd Source #

A local binding command ( let z = x+y )

pattern DoCmd :: CmdStmtList -> Cmd Source #

A local binding command ( let z = x+y )

pattern LeftAppl :: ArrowApp Source #

Left arrow application: -<

pattern RightAppl :: ArrowApp Source #

Right arrow application: >-

pattern LeftHighApp :: ArrowApp Source #

Left arrow high application: -<<

pattern RightHighApp :: ArrowApp Source #

Right arrow high application: >>-

pattern Hole :: Expr Source #

A hole expression _