Contains the data types and functions for annotating
an ast and working with annotated trees, including the
representations of SQL data types.
- are attached to some of the ast node data types, but not all of them (yet?);
- types annotations are attached to most nodes;
- type errors are attached to the lowest down node that the type error is detected at;
- nodes who fail the type check or whose type depends on a node with a type error are
given the type TypeCheckFailed;
- each statement has an additional StatementInfo annotation attached to it;
- the parser fills in the source position nodes, but doesn't do a great job yet.
|Annotation type - one of these is attached to most of the
data types used in the ast.
|the elements of an annotation. Source positions are generated by
the parser, the rest come from the separate ast annotation process.
|WrongTypes Type [Type]|
|NoMatchingOperator String [Type]|
|IncompatibleTypes Type Type|
|This is the main annotation attached to each statement. Early days at the moment
but will be expanded to provide any type errors lurking inside a statement, any useful
types, e.g. the types of each select and subselect/sub query in a statement,
any changes to the catalog the statement makes, and possibly much more information.
|Used in Scope and type checking.
|Takes an ast, and adds annotations, including types, type errors,
and statement info. Type checks against defaultScope.
|As annotateAst but you supply an additional scope to add to the
defaultScope to type check against. See Scope module for how to
read a scope from an existing database so you can type check
|Testing utility, mainly used to check an expression for type errors
or to get its type.
|Annotated tree utils
|:: Annotated a|
|=> [a]||the type annotations, this list should be the same
length as the argument
|run through the ast, and pull the type annotation from each
of the top level items.
|:: Annotated a|
|Run through the ast given and return a list of statementinfos
from the top level items.
|runs through the ast given and returns a list of all the type errors
in the ast. Recurses into all ast nodes to find type errors.
This is the function to use to see if an ast has passed the type checking process.
Source position information will be added to the return type at some point
|stripAnnotations :: Annotated a => a -> a||Source|
|strip all the annotations from a tree. E.g. can be used to compare
two asts are the same, ignoring any source position annotation differences.
|Produced by Haddock version 2.6.0|