Package net.hydromatic.morel.type
Class DataType
java.lang.Object
net.hydromatic.morel.type.BaseType
net.hydromatic.morel.type.ParameterizedType
net.hydromatic.morel.type.DataType
Algebraic type.
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class net.hydromatic.morel.type.ParameterizedType
moniker, name, parameterTypes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(TypeVisitor<R> typeVisitor) arg(int i) Returns theith type parameter.copy(TypeSystem typeSystem, UnaryOperator<Type> transform) Copies this type, applying a given transform to component types, and returning the original type if the component types are unchanged.describe(StringBuilder buf) Writes out the definition of the datatype.booleanWhether this is a collection type (list or bag).key()Description of the type, e.gbooleanspecializes(Type type) Whether this type is the same as, or a specialization of, a given type.typeConstructors(TypeSystem typeSystem) Methods inherited from class net.hydromatic.morel.type.ParameterizedType
computeMoniker, moniker, name, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.hydromatic.morel.type.Type
canCallArgOf, isFinite, isProgressive, op, substitute, unifyWith
-
Field Details
-
arguments
-
typeConstructors
-
-
Constructor Details
-
DataType
protected DataType(String name, String moniker, com.google.common.collect.ImmutableList<Type> arguments, com.google.common.collect.ImmutableMap<String, Type.Key> typeConstructors) Creates a DataType.Called only from
TypeSystem.dataTypes(List).If the
typeSystemargument is specified, canonizes the types inside type-constructors. This also allows temporary types (necessary while creating self-referential data types) to be replaced with real DataType instances.During replacement, if a type matches
placeholderTypeit is replaced withthis. This allows cyclic graphs to be copied.
-
-
Method Details
-
key
Description copied from interface:TypeDescription of the type, e.g. "int", "int -> int", "NONE | SOME of 'a". -
arg
Description copied from interface:Type -
isCollection
public boolean isCollection()Description copied from interface:TypeWhether this is a collection type (list or bag).If a type is a collection type,
arg(0)returns the element type. -
accept
-
typeConstructors
-
copy
Description copied from interface:TypeCopies this type, applying a given transform to component types, and returning the original type if the component types are unchanged. -
describe
Writes out the definition of the datatype. For example,datatype ('a,'b) tree = Empty | Node of ('a,'b) tree * 'b * 'a * ('a,'b) tree -
specializes
Description copied from interface:TypeWhether this type is the same as, or a specialization of, a given type.For example,
boolspecializesbooland'abut does not specializeintor('a, 'b).
-