hssqlppp-0.5.18: SQL parser and type checker

Safe HaskellNone
LanguageHaskell2010

Database.HsSqlPpp.Annotation

Contents

Description

Contains the annotation data types and a few auxiliary functions.

Synopsis

Annotation data types

data Annotation

Annotation type - one of these is attached to most of the data types used in the ast. the fields in order are:

Constructors

Annotation 

Fields

anSrc :: Maybe SourcePosition

source position for this node

anType :: Maybe TypeExtra

type of the node, Nothing if the tree hasn't been typechecked or if a type error elsewhere prevents determining this node's type

anErrs :: [TypeError]

any type errors

anImplicitCast :: Maybe TypeExtra

if an implicit cast is needed between this node an its parent, this the target type of cast. If no implicit cast is needed, this is Nothing

anCatUpd :: [CatalogUpdate]

any catalog updates that a statement produces, used only for ddl Statements

data TypeExtra

Quick fix to add precision and nullable information to the annotation types. This approach should be revisited, maybe this information should be in the Type type?

Constructors

TypeExtra 

type SourcePosition = (FilePath, Int, Int)

Represents a source file position, usually set by the parser.

getAnnotation :: Data a => a -> Annotation

get the annotation for the root element of the tree passed

updateAnnotation :: Data a => (Annotation -> Annotation) -> a -> a

Update the first annotation in a tree using the function supplied

emptyAnnotation :: Annotation

An annotation value with no information.