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

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.AST.Gen.Patterns

Description

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, mkVarPat creates the annotated version of the VarPat AST constructor.

Synopsis

Documentation

mkVarPat :: Name dom -> Pattern dom Source #

Pattern name binding

mkLitPat :: Literal dom -> Pattern dom Source #

Literal pattern

mkInfixAppPat :: Pattern dom -> Operator dom -> Pattern dom -> Pattern dom Source #

Infix constructor application pattern ( a :+: b )

mkAppPat :: Name dom -> [Pattern dom] -> Pattern dom Source #

Constructor application pattern ( Point x y )

mkTuplePat :: [Pattern dom] -> Pattern dom Source #

Tuple pattern ( (x,y) )

mkUnboxTuplePat :: [Pattern dom] -> Pattern dom Source #

Unboxed tuple pattern ( (# x, y #) )

mkListPat :: [Pattern dom] -> Pattern dom Source #

List pattern ( [1,2,a,x] )

mkParArrayPat :: [Pattern dom] -> Pattern dom Source #

Parallel array pattern ( [:1,2,a,x:] )

mkParenPat :: Pattern dom -> Pattern dom Source #

Parenthesised patterns

mkRecPat :: Name dom -> [PatternField dom] -> Pattern dom Source #

Record pattern ( Point { x = 3, y } )

mkAsPat :: Name dom -> Pattern dom -> Pattern dom Source #

As-pattern (explicit name binding) ( ls@(hd:_) )

mkWildPat :: Pattern dom Source #

Wildcard pattern: ( _ )

mkIrrefutablePat :: Pattern dom -> Pattern dom Source #

Irrefutable pattern ( ~(x:_) )

mkBangPat :: Pattern dom -> Pattern dom Source #

Bang pattern ( !x )

mkTypeSigPat :: Pattern dom -> Type dom -> Pattern dom Source #

Pattern with explicit type signature ( x :: Int )

mkViewPat :: Expr dom -> Pattern dom -> Pattern dom Source #

View pattern ( f -> Just 1 )

mkSplicePat :: Splice dom -> Pattern dom Source #

Splice patterns: $(generateX inp)

mkQuasiQuotePat :: QuasiQuote dom -> Pattern dom Source #

Quasi-quoted patterns: [| 1 + 2 |]

mkPatternField :: Name dom -> Pattern dom -> PatternField dom Source #

Named field pattern ( p = Point 3 2 )

mkFieldPunPattern :: Name dom -> PatternField dom Source #

Named field pun ( p )

mkFieldWildcardPattern :: PatternField dom Source #

Wildcard field pattern ( .. )