Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains a collection of utility functions
- resetAnnotations :: Data a => a -> a
- queryType :: Catalog -> Text -> Maybe Type
- canonicalizeTypeName :: Text -> Text
- canonicalizeTypeNames :: Data a => a -> a
- addExplicitCasts :: Data a => a -> a
- addImplicitCasts :: Data a => Catalog -> a -> a
- tcTreeInfo :: Data a => a -> (Maybe TypeExtra, [([TypeError], Maybe SourcePosition)], [QueryExpr], [ScalarExpr])
- emacsShowErrors :: [([TypeError], Maybe SourcePosition)] -> String
ast utils
resetAnnotations :: Data a => a -> a
replace all the annotations in a tree with emptyAnnotation
queryType :: Catalog -> Text -> Maybe Type
Gets the type of the sql source passed in. Expects the string to contain a query expr
canonicalizeTypeName :: Text -> Text
convert the name of a type to its canonical name. For types without multiple names, it returns the name unchanged
canonicalizeTypeNames :: Data a => a -> a
run canonicalizeTypeName on all the TypeName nodes in an ast
typechecked ast utils
addExplicitCasts :: Data a => a -> a
run on a typechecked tree. Finds all the places where an implicit cast has been used in the typechecking and inserts an explicit cast
addImplicitCasts :: Data a => Catalog -> a -> a
variation of the above, which uses ImplicitCast ctor
tcTreeInfo :: Data a => a -> (Maybe TypeExtra, [([TypeError], Maybe SourcePosition)], [QueryExpr], [ScalarExpr])
Gets some information useful for checking a typechecked tree returns the type of the top level node, a list of type errors from the tree, a list of the queryexpr nodes, and a list of the scalar exprs respectively, which have their type as nothing which indicates that the typechecking didn't complete successfully
emacsShowErrors :: [([TypeError], Maybe SourcePosition)] -> String
show a type error list in emacs format