haskell-tools-ast-0.2.0.0: Haskell AST for efficient tooling

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.AST.Binds

Contents

Description

Representation of Haskell AST value and function bindings (both local and top-level)

Synopsis

Documentation

data ValueBind dom stage Source #

Value binding for top-level and local bindings

Constructors

SimpleBind

Non-function binding ( v = "12" ) TODO: use one name for a function instead of names in each match

Fields

FunBind

Function binding ( f 0 = 1; f x = x ). All matches must have the same name.

Fields

Instances

type Rep (ValueBind dom stage) Source # 
type Rep (ValueBind dom stage) = D1 (MetaData "ValueBind" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) ((:+:) (C1 (MetaCons "SimpleBind" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_valBindPat") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Pattern dom stage))) ((:*:) (S1 (MetaSel (Just Symbol "_valBindRhs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Rhs dom stage))) (S1 (MetaSel (Just Symbol "_valBindLocals") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnMaybe LocalBinds dom stage)))))) (C1 (MetaCons "FunBind" PrefixI True) (S1 (MetaSel (Just Symbol "_funBindMatches") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList Match dom stage)))))

data Match dom stage Source #

Clause of function (or value) binding

Constructors

Match 

Fields

Instances

type Rep (Match dom stage) Source # 
type Rep (Match dom stage) = D1 (MetaData "Match" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) (C1 (MetaCons "Match" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_matchLhs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann MatchLhs dom stage))) ((:*:) (S1 (MetaSel (Just Symbol "_matchRhs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Rhs dom stage))) (S1 (MetaSel (Just Symbol "_matchBinds") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnMaybe LocalBinds dom stage))))))

data MatchLhs dom stage Source #

Something on the left side of the match

Constructors

NormalLhs 

Fields

InfixLhs 

Fields

Instances

type Rep (MatchLhs dom stage) Source # 
type Rep (MatchLhs dom stage) = D1 (MetaData "MatchLhs" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) ((:+:) (C1 (MetaCons "NormalLhs" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_matchLhsName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Name dom stage))) (S1 (MetaSel (Just Symbol "_matchLhsArgs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList Pattern dom stage))))) (C1 (MetaCons "InfixLhs" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_matchLhsLhs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Pattern dom stage))) (S1 (MetaSel (Just Symbol "_matchLhsOperator") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Operator dom stage)))) ((:*:) (S1 (MetaSel (Just Symbol "_matchLhsRhs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Pattern dom stage))) (S1 (MetaSel (Just Symbol "_matchLhsArgs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList Pattern dom stage)))))))

data LocalBinds dom stage Source #

Local bindings attached to a declaration ( where x = 42 )

Constructors

LocalBinds 

Fields

Instances

type Rep (LocalBinds dom stage) Source # 
type Rep (LocalBinds dom stage) = D1 (MetaData "LocalBinds" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) (C1 (MetaCons "LocalBinds" PrefixI True) (S1 (MetaSel (Just Symbol "_localBinds") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList LocalBind dom stage))))

data LocalBind dom stage Source #

Bindings that are enabled in local blocks (where or let).

Constructors

LocalValBind 

Fields

LocalSignature 

Fields

LocalFixity 

Fields

Instances

BindingElem LocalBind Source # 

Methods

sigBind :: (Functor w, Applicative w, Monad w, Functor r, Applicative r, MonadPlus r, Morph Maybe r) => Reference w r (MU *) (MU *) (LocalBind dom stage) (LocalBind dom stage) (Ann TypeSignature dom stage) (Ann TypeSignature dom stage) Source #

valBind :: (Functor w, Applicative w, Monad w, Functor r, Applicative r, MonadPlus r, Morph Maybe r) => Reference w r (MU *) (MU *) (LocalBind dom stage) (LocalBind dom stage) (Ann ValueBind dom stage) (Ann ValueBind dom stage) Source #

createTypeSig :: Ann TypeSignature dom stage -> LocalBind dom stage Source #

createBinding :: Ann ValueBind dom stage -> LocalBind dom stage Source #

isTypeSig :: LocalBind dom stage -> Bool Source #

isBinding :: LocalBind dom stage -> Bool Source #

type Rep (LocalBind dom stage) Source # 
type Rep (LocalBind dom stage) = D1 (MetaData "LocalBind" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) ((:+:) (C1 (MetaCons "LocalValBind" PrefixI True) (S1 (MetaSel (Just Symbol "_localVal") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann ValueBind dom stage)))) ((:+:) (C1 (MetaCons "LocalSignature" PrefixI True) (S1 (MetaSel (Just Symbol "_localSig") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann TypeSignature dom stage)))) (C1 (MetaCons "LocalFixity" PrefixI True) (S1 (MetaSel (Just Symbol "_localFixity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann FixitySignature dom stage))))))

data TypeSignature dom stage Source #

A type signature ( _f :: Int -> Int )

Constructors

TypeSignature 

Fields

Instances

type Rep (TypeSignature dom stage) Source # 
type Rep (TypeSignature dom stage) = D1 (MetaData "TypeSignature" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) (C1 (MetaCons "TypeSignature" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_tsName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList Name dom stage))) (S1 (MetaSel (Just Symbol "_tsType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Type dom stage)))))

data FixitySignature dom stage Source #

A fixity signature ( infixl 5 +, - ).

Constructors

FixitySignature 

Fields

Instances

type Rep (FixitySignature dom stage) Source # 
type Rep (FixitySignature dom stage) = D1 (MetaData "FixitySignature" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) (C1 (MetaCons "FixitySignature" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_fixityAssoc") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Assoc dom stage))) ((:*:) (S1 (MetaSel (Just Symbol "_fixityPrecedence") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Precedence dom stage))) (S1 (MetaSel (Just Symbol "_fixityOperators") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList Operator dom stage))))))

data Rhs dom stage Source #

Right hand side of a value binding (possible with guards): ( = 3 or | x == 1 = 3; | otherwise = 4 )

Constructors

UnguardedRhs 

Fields

GuardedRhss 

Fields

Instances

type Rep (Rhs dom stage) Source # 
type Rep (Rhs dom stage) = D1 (MetaData "Rhs" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) ((:+:) (C1 (MetaCons "UnguardedRhs" PrefixI True) (S1 (MetaSel (Just Symbol "_rhsExpr") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Expr dom stage)))) (C1 (MetaCons "GuardedRhss" PrefixI True) (S1 (MetaSel (Just Symbol "_rhsGuards") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList GuardedRhs dom stage)))))

data GuardedRhs dom stage Source #

A guarded right-hand side of a value binding ( | x > 3 = 2 )

Constructors

GuardedRhs 

Fields

Instances

type Rep (GuardedRhs dom stage) Source # 
type Rep (GuardedRhs dom stage) = D1 (MetaData "GuardedRhs" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) (C1 (MetaCons "GuardedRhs" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_guardStmts") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList RhsGuard dom stage))) (S1 (MetaSel (Just Symbol "_guardExpr") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Expr dom stage)))))

data RhsGuard dom stage Source #

Guards for value bindings and pattern matches ( Just v x, v 1 )

Constructors

GuardBind 

Fields

GuardLet 

Fields

GuardCheck 

Fields

Instances

type Rep (RhsGuard dom stage) Source # 
type Rep (RhsGuard dom stage) = D1 (MetaData "RhsGuard" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) ((:+:) (C1 (MetaCons "GuardBind" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_guardPat") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Pattern dom stage))) (S1 (MetaSel (Just Symbol "_guardRhs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Expr dom stage))))) ((:+:) (C1 (MetaCons "GuardLet" PrefixI True) (S1 (MetaSel (Just Symbol "_guardBinds") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList LocalBind dom stage)))) (C1 (MetaCons "GuardCheck" PrefixI True) (S1 (MetaSel (Just Symbol "_guardCheck") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Expr dom stage))))))

Pragmas

data TopLevelPragma dom stage Source #

Top level pragmas

Instances

type Rep (TopLevelPragma dom stage) Source # 
type Rep (TopLevelPragma dom stage) = D1 (MetaData "TopLevelPragma" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "RulePragma" PrefixI True) (S1 (MetaSel (Just Symbol "_pragmaRule") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList Rule dom stage)))) (C1 (MetaCons "DeprPragma" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_pragmaObjects") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList Name dom stage))) (S1 (MetaSel (Just Symbol "_pragmaMessage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann StringNode dom stage)))))) ((:+:) (C1 (MetaCons "WarningPragma" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_pragmaObjects") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList Name dom stage))) (S1 (MetaSel (Just Symbol "_pragmaMessage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann StringNode dom stage))))) (C1 (MetaCons "AnnPragma" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_annotationSubject") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann AnnotationSubject dom stage))) (S1 (MetaSel (Just Symbol "_annotateExpr") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Expr dom stage))))))) ((:+:) ((:+:) (C1 (MetaCons "InlinePragma" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_pragmaConlike") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnMaybe ConlikeAnnot dom stage))) ((:*:) (S1 (MetaSel (Just Symbol "_pragmaPhase") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnMaybe PhaseControl dom stage))) (S1 (MetaSel (Just Symbol "_inlineDef") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Name dom stage)))))) (C1 (MetaCons "NoInlinePragma" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_pragmaConlike") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnMaybe ConlikeAnnot dom stage))) ((:*:) (S1 (MetaSel (Just Symbol "_pragmaPhase") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnMaybe PhaseControl dom stage))) (S1 (MetaSel (Just Symbol "_noInlineDef") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Name dom stage))))))) ((:+:) (C1 (MetaCons "InlinablePragma" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_pragmaPhase") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnMaybe PhaseControl dom stage))) (S1 (MetaSel (Just Symbol "_inlinableDef") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Name dom stage))))) ((:+:) (C1 (MetaCons "LinePragma" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_pragmaLineNum") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann LineNumber dom stage))) (S1 (MetaSel (Just Symbol "_pragmaFileName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnMaybe StringNode dom stage))))) (C1 (MetaCons "SpecializePragma" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_pragmaPhase") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnMaybe PhaseControl dom stage))) ((:*:) (S1 (MetaSel (Just Symbol "_specializeDef") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Name dom stage))) (S1 (MetaSel (Just Symbol "_specializeType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList Type dom stage))))))))))

data Rule dom stage Source #

A rewrite rule ( "map/map" forall f g xs. map f (map g xs) = map (f.g) xs )

Constructors

Rule 

Fields

Instances

type Rep (Rule dom stage) Source # 
type Rep (Rule dom stage) = D1 (MetaData "Rule" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) (C1 (MetaCons "Rule" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_ruleName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann StringNode dom stage))) (S1 (MetaSel (Just Symbol "_rulePhase") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnMaybe PhaseControl dom stage)))) ((:*:) (S1 (MetaSel (Just Symbol "_ruleBounded") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList TyVar dom stage))) ((:*:) (S1 (MetaSel (Just Symbol "_ruleLhs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Expr dom stage))) (S1 (MetaSel (Just Symbol "_ruleRhs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Expr dom stage)))))))

data AnnotationSubject dom stage Source #

Annotation allows you to connect an expression to any declaration.

Constructors

NameAnnotation

The definition with the given name is annotated

Fields

TypeAnnotation

A type with the given name is annotated

Fields

ModuleAnnotation

The whole module is annotated

Instances

type Rep (AnnotationSubject dom stage) Source # 
type Rep (AnnotationSubject dom stage) = D1 (MetaData "AnnotationSubject" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) ((:+:) (C1 (MetaCons "NameAnnotation" PrefixI True) (S1 (MetaSel (Just Symbol "_annotateName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Name dom stage)))) ((:+:) (C1 (MetaCons "TypeAnnotation" PrefixI True) (S1 (MetaSel (Just Symbol "_annotateName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Name dom stage)))) (C1 (MetaCons "ModuleAnnotation" PrefixI False) U1)))

data MinimalFormula dom stage Source #

Formulas of minimal annotations declaring which functions should be defined.

Constructors

MinimalName 

Fields

MinimalParen 

Fields

MinimalOr

One of the minimal formulas are needed ( min1 | min2 )

Fields

MinimalAnd

Both of the minimal formulas are needed ( min1 , min2 )

Fields

Instances

type Rep (MinimalFormula dom stage) Source # 
type Rep (MinimalFormula dom stage) = D1 (MetaData "MinimalFormula" "Language.Haskell.Tools.AST.Binds" "haskell-tools-ast-0.2.0.0-5y5XIph7fmGIUhHQZ35OfD" False) ((:+:) ((:+:) (C1 (MetaCons "MinimalName" PrefixI True) (S1 (MetaSel (Just Symbol "_minimalName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann Name dom stage)))) (C1 (MetaCons "MinimalParen" PrefixI True) (S1 (MetaSel (Just Symbol "_minimalInner") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann MinimalFormula dom stage))))) ((:+:) (C1 (MetaCons "MinimalOr" PrefixI True) (S1 (MetaSel (Just Symbol "_minimalOrs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList MinimalFormula dom stage)))) (C1 (MetaCons "MinimalAnd" PrefixI True) (S1 (MetaSel (Just Symbol "_minimalAnds") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AnnList MinimalFormula dom stage))))))