project-m36-1.0.1: Relational Algebra Engine
Safe HaskellSafe-Inferred
LanguageHaskell2010

ProjectM36.AtomType

Synopsis

Documentation

atomTypeForDataConstructor :: TypeConstructorMapping -> DataConstructorName -> [AtomType] -> Either RelationalError AtomType Source #

Used to determine if the atom arguments can be used with the data constructor. | This is the entry point for type-checking from RelationalExpression.hs

resolveDataConstructorTypeVars :: DataConstructorDef -> [AtomType] -> TypeConstructorMapping -> Either RelationalError TypeVarMap Source #

Walks the data and type constructors to extract the type variable map.

resolveDataConstructorArgTypeVars :: DataConstructorDefArg -> AtomType -> TypeConstructorMapping -> Either RelationalError TypeVarMap Source #

Attempt to match the data constructor argument to a type constructor type variable.

atomTypeForTypeConstructorValidate :: Bool -> TypeConstructor -> TypeConstructorMapping -> TypeVarMap -> Either RelationalError AtomType Source #

Create an atom type iff all type variables are provided. Either Int Text -> ConstructedAtomType Either {Int , Text}

resolveTypeInAtom :: AtomType -> Atom -> TypeConstructorMapping -> Either RelationalError Atom Source #

See notes at resolveTypesInTuple. The typeFromRelation must not include any wildcards.

resolveTypesInTuple :: Attributes -> TypeConstructorMapping -> RelationTuple -> Either RelationalError RelationTuple Source #

When creating a tuple, the data constructor may not complete the type constructor arguments, so the wildcard "TypeVar x" fills in the type constructor's argument. The tuple type must be resolved before it can be part of a relation, however. Example: Nothing does not specify the the argument in "Maybe a", so allow delayed resolution in the tuple before it is added to the relation. Note that this resolution could cause a type error. Hardly a Hindley-Milner system.

validateAtomType :: AtomType -> TypeConstructorMapping -> Either RelationalError () Source #

Validate that the type is provided with complete type variables for type constructors.

atomTypeVerify :: AtomType -> AtomType -> Either RelationalError AtomType Source #

Determine if two types are equal or compatible (including special handling for TypeVar x).

typeVarMapsVerify :: TypeVarMap -> TypeVarMap -> Bool Source #

Determine if two typeVars are logically compatible.