hssqlppp-0.0.6: Sql parser and type checkerSource codeContentsIndex
Database.HsSqlPpp.TypeChecking.Scope
Description

This module contains the scope data type and a few helper functions, not really ready for public consumption yet. It serves the following purposes:

  • contains all the catalog information needed to type check against an existing database
  • a copy of the catalog information from a default template1 database is included - defaultScope, at some point this will allow typechecking sql code against this catalog without having an available postgresql install .
  • it is also used internally in the type checker to hold identifiers valid and their types in a given context, and to build the additional catalog information so that e.g. a sql file containing a create table followed by a select from that table will type check ok. (This isn't quite working yet but it's almost there.)
Synopsis
data Scope = Scope {
scopeTypes :: [Type]
scopeTypeNames :: [(String, Type)]
scopeDomainDefs :: [DomainDefinition]
scopeCasts :: [(Type, Type, CastContext)]
scopeTypeCategories :: [(Type, String, Bool)]
scopePrefixOperators :: [FunctionPrototype]
scopePostfixOperators :: [FunctionPrototype]
scopeBinaryOperators :: [FunctionPrototype]
scopeFunctions :: [FunctionPrototype]
scopeAggregates :: [FunctionPrototype]
scopeAllFns :: [FunctionPrototype]
scopeAttrDefs :: [CompositeDef]
scopeAttrSystemColumns :: [CompositeDef]
scopeIdentifierTypes :: [QualifiedScope]
scopeJoinIdentifiers :: [String]
}
type QualifiedScope = (String, ([(String, Type)], [(String, Type)]))
emptyScope :: Scope
combineScopes :: Scope -> Scope -> Scope
readScope :: String -> IO Scope
defaultScope :: Scope
Documentation
data Scope Source
Constructors
Scope
scopeTypes :: [Type]
scopeTypeNames :: [(String, Type)]
scopeDomainDefs :: [DomainDefinition]
scopeCasts :: [(Type, Type, CastContext)]
scopeTypeCategories :: [(Type, String, Bool)]
scopePrefixOperators :: [FunctionPrototype]
scopePostfixOperators :: [FunctionPrototype]
scopeBinaryOperators :: [FunctionPrototype]
scopeFunctions :: [FunctionPrototype]
scopeAggregates :: [FunctionPrototype]
scopeAllFns :: [FunctionPrototype]
scopeAttrDefs :: [CompositeDef]
scopeAttrSystemColumns :: [CompositeDef]
scopeIdentifierTypes :: [QualifiedScope]
scopeJoinIdentifiers :: [String]
show/hide Instances
type QualifiedScope = (String, ([(String, Type)], [(String, Type)]))Source
emptyScope :: ScopeSource
scope containing nothing
combineScopesSource
:: Scopebase scope
-> Scopeadditional scope - this adds to and overrides items in the base scope
-> Scope
combine two scopes, e.g. this can be used to take the default scope and add a few definitions to it before type checking an ast
readScopeSource
:: Stringname of the database to read
-> IO Scope
creates a scope value from the database given
defaultScope :: ScopeSource
Scope value representing the catalog from a default template1 database
Produced by Haddock version 2.6.0