hssqlppp-0.0.10: Sql parser and type checkerSource codeContentsIndex
Annotation functions
Annotated tree utils

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 quite all of them;
  • types annotations are attached to most nodes during type checking;
  • 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 annotation in every annotatable ast node.
annotateAst :: StatementList -> StatementList
annotateAstEnv :: Environment -> StatementList -> StatementList
annotateExpression :: Environment -> Expression -> Expression
annotateAstsEnv :: Environment -> [StatementList] -> [StatementList]
annotateAstEnvEnv :: Environment -> StatementList -> (Environment, StatementList)
getTopLevelTypes :: Data a => [a] -> [Type]
getTopLevelInfos :: Data a => [a] -> [Maybe StatementInfo]
getTopLevelEnvUpdates :: Data a => [a] -> [[EnvironmentUpdate]]
getTypeErrors :: Data a => a -> [(Maybe AnnotationElement, [TypeError])]
getStatementAnnotations :: Data a => a -> [Annotation]
Annotation functions
annotateAst :: StatementList -> StatementListSource
Takes an ast, and adds annotations, including types, type errors, and statement info. Type checks against defaultEnv.
annotateAstEnv :: Environment -> StatementList -> StatementListSource
As annotateAst but you supply an environment to check against. See Environment module for how to read an Environment from an existing database so you can type check against it.
annotateExpression :: Environment -> Expression -> ExpressionSource
Testing utility, mainly used to check an expression for type errors or to get its type.
annotateAstsEnv :: Environment -> [StatementList] -> [StatementList]Source
Type check multiple asts, allowing type checking references in later files to definitions in earlier files.
annotateAstEnvEnv :: Environment -> StatementList -> (Environment, StatementList)Source
Type check an ast, and return the resultant Environment as well as the annotated ast.
Annotated tree utils
getTopLevelTypes :: Data a => [a] -> [Type]Source
run through the ast, and pull the type annotation from each of the top level items.
getTopLevelInfos :: Data a => [a] -> [Maybe StatementInfo]Source
Run through the ast given and return a list of statementinfos from the top level items.
getTopLevelEnvUpdates :: Data a => [a] -> [[EnvironmentUpdate]]Source
getTypeErrors :: Data a => a -> [(Maybe AnnotationElement, [TypeError])]Source
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. Returns a Maybe SourcePos and the list of type errors for each node which has one or more type errors.
getStatementAnnotations :: Data a => a -> [Annotation]Source
Run through the ast and return all the annotations attached to a Statement node.
Produced by Haddock version 2.6.0