Variant

abstract class Variant(val name: String, val traverse: A_Type.() -> A_Type) : TypeTag.Modifier

The mechanism for expressing covariant and contravariant relationships for types. Each TypeTag that represents a region of the type lattice can define Covariant and Contravariant relations that apply to types that have that TypeTag.

Constructors

Link copied to clipboard
fun Variant(name: String, traverse: A_Type.() -> A_Type)

Functions

Link copied to clipboard
abstract fun applyTo(typeTag: TypeTag)

Adjust the TypeTag to accommodate this modifier.

Properties

Link copied to clipboard
val name: String

The symbolic name of the variant, for descriptive purposes.

Link copied to clipboard
val traverse: A_Type.() -> A_Type

A function that extracts a co-/contravariant type from the original type, where this Variant is applicable. For example, given something with the tag SET_TYPE_TAG (the TypeTag for set types), the set type's element type can be extracted by running the traverse function of the "element" covariant type parameter.

Inheritors

Link copied to clipboard
Link copied to clipboard