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
ConstructorsModifierConstructorDescription(package private)DataType(String name, String moniker, List<? extends Type> arguments, SortedMap<String, Type.Key> typeConstructors) Creates a DataType.protectedDataType(Op op, String name, String moniker, List<? extends Type> arguments, SortedMap<String, Type.Key> typeConstructors) Called only from DataType constructor. -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(TypeVisitor<R> typeVisitor) 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.key()Description of the type, e.g.typeConstructors(TypeSystem typeSystem) Methods inherited from class net.hydromatic.morel.type.ParameterizedType
computeMoniker, moniker, name, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.hydromatic.morel.type.Type
isProgressive, op, substitute
-
Field Details
-
arguments
-
typeConstructors
-
-
Constructor Details
-
DataType
DataType(String name, String moniker, List<? extends Type> arguments, SortedMap<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. -
DataType
protected DataType(Op op, String name, String moniker, List<? extends Type> arguments, SortedMap<String, Type.Key> typeConstructors) Called only from DataType constructor.
-
-
Method Details
-
key
Description copied from interface:TypeDescription of the type, e.g. "int", "int -> int", "NONE | SOME of 'a". -
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
-