Contra

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

A Contravariant relationship. When a TypeTag declares such a relationship, then for all A and B having that TypeTag, if A ⊆ B, then traverse(B) ⊆ traverse(A), where traverse is a function provided by the Contra instance.

Constructors

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

Functions

Link copied to clipboard
open override 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.