| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Haskell.Tools.Rewrite.Create.Binds
Description
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, mkMatch creates the annotated version of the UMatch constructor.
Synopsis
- mkSimpleBind' :: Name -> Expr -> ValueBind
- mkSimpleBind :: Pattern -> Rhs -> Maybe LocalBinds -> ValueBind
- mkFunctionBind :: [Match] -> ValueBind
- mkFunctionBind' :: Name -> [([Pattern], Expr)] -> ValueBind
- mkMatch :: MatchLhs -> Rhs -> Maybe LocalBinds -> Match
- mkMatchLhs :: Name -> [Pattern] -> MatchLhs
- mkInfixLhs :: Pattern -> Operator -> Pattern -> [Pattern] -> MatchLhs
- mkLocalBinds :: [LocalBind] -> MaybeLocalBinds
- mkLocalBinds' :: [LocalBind] -> LocalBinds
- mkLocalValBind :: ValueBind -> LocalBind
- mkLocalTypeSig :: TypeSignature -> LocalBind
- mkLocalFixity :: FixitySignature -> LocalBind
- mkTypeSignature :: Name -> Type -> TypeSignature
- mkInfixL :: Int -> Operator -> FixitySignature
- mkInfixR :: Int -> Operator -> FixitySignature
- mkInfix :: Int -> Operator -> FixitySignature
- mkUnguardedRhs :: Expr -> Rhs
- mkGuardedRhss :: [GuardedRhs] -> Rhs
- mkGuardedRhs :: [RhsGuard] -> Expr -> GuardedRhs
- mkGuardBind :: Pattern -> Expr -> RhsGuard
- mkGuardLet :: [LocalBind] -> RhsGuard
- mkGuardCheck :: Expr -> RhsGuard
Documentation
mkSimpleBind' :: Name -> Expr -> ValueBind Source #
A simplified function to generate simple value bindings without local definitions, guards or complex lhs.
mkSimpleBind :: Pattern -> Rhs -> Maybe LocalBinds -> ValueBind Source #
Creates a value binding ( v = "12" ).
mkFunctionBind :: [Match] -> ValueBind Source #
Creates a function binding ( f 0 = 1; f x = x ). All matches must have the same name.
mkFunctionBind' :: Name -> [([Pattern], Expr)] -> ValueBind Source #
A simplified function for creating function bindings without local definitions or guards.
mkMatch :: MatchLhs -> Rhs -> Maybe LocalBinds -> Match Source #
Creates a clause of function binding
mkMatchLhs :: Name -> [Pattern] -> MatchLhs Source #
Creates a match lhs with the function name and parameter names ( f a b )
mkInfixLhs :: Pattern -> Operator -> Pattern -> [Pattern] -> MatchLhs Source #
Creates an infix match lhs for an operator ( a + b )
mkLocalBinds :: [LocalBind] -> MaybeLocalBinds Source #
Local bindings attached to a declaration ( where x = 42 )
mkLocalBinds' :: [LocalBind] -> LocalBinds Source #
mkLocalValBind :: ValueBind -> LocalBind Source #
Creates a local binding for a value
mkLocalTypeSig :: TypeSignature -> LocalBind Source #
Creates a local type signature
mkLocalFixity :: FixitySignature -> LocalBind Source #
Creates a local fixity declaration
mkTypeSignature :: Name -> Type -> TypeSignature Source #
Creates a type signature ( f :: Int -> Int )
mkInfixL :: Int -> Operator -> FixitySignature Source #
Creates a left-associative fixity declaration ( infixl 5 +, - ).
mkInfixR :: Int -> Operator -> FixitySignature Source #
Creates a right-associative fixity declaration ( infixr 5 +, - ).
mkInfix :: Int -> Operator -> FixitySignature Source #
Creates a non-associative fixity declaration ( infix 5 +, - ).
mkUnguardedRhs :: Expr -> Rhs Source #
Creates an unguarded right-hand-side ( = 3 )
mkGuardedRhss :: [GuardedRhs] -> Rhs Source #
Creates an unguarded right-hand-side ( | x == 1 = 3; | otherwise = 4 )
mkGuardedRhs :: [RhsGuard] -> Expr -> GuardedRhs Source #
Creates a guarded right-hand side of a value binding ( | x > 3 = 2 )
mkGuardBind :: Pattern -> Expr -> RhsGuard Source #
Creates a bind statement in a pattern guard ( Just v <- x )
mkGuardLet :: [LocalBind] -> RhsGuard Source #
Creates a let statement in a pattern guard ( let x = 3 )
mkGuardCheck :: Expr -> RhsGuard Source #
Creates an expression to check for a pattern guard