Package net.hydromatic.morel.type
Class TypeVar
java.lang.Object
net.hydromatic.morel.type.TypeVar
- All Implemented Interfaces:
Type
Type variable (e.g.
'a).-
Nested Class Summary
-
Field Summary
Fields -
Constructor Summary
Constructors -
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.booleaninthashCode()key()Description of the type, e.g.(package private) static Stringname(int i) Generates a name for a type variable.op()Type operator.substitute(TypeSystem typeSystem, List<? extends Type> types) Returns a copy of this type, specialized by substituting type parameters.toString()Returns a string for debugging.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.hydromatic.morel.type.Type
isProgressive, moniker
-
Field Details
-
ALPHAS
private static final char[] ALPHAS -
NAME_CACHE
-
ordinal
public final int ordinal -
name
-
-
Constructor Details
-
TypeVar
public TypeVar(int ordinal) Creates a type variable with a given ordinal.TypeVar.of(0) returns "'a"; TypeVar.of(1) returns "'b", etc.
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
toString
Returns a string for debugging. -
accept
-
name
Generates a name for a type variable.0 → 'a, 1 → 'b, 26 → 'z, 27 → 'ba, 28 → 'bb, 675 → 'zz, 676 → 'baa, etc. (Think of it is a base 26 number, with "a" as 0, "z" as 25.)
-
key
Description copied from interface:TypeDescription of the type, e.g. "int", "int -> int", "NONE | SOME of 'a". -
op
Description copied from interface:TypeType operator. -
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. -
substitute
Description copied from interface:TypeReturns a copy of this type, specialized by substituting type parameters.- Specified by:
substitutein interfaceType
-