Tag

object Tag
class Object
trait Matchable
class Any

Type members

Classlikes

final
class TagOf[T] extends NaturalTransformation[Id, @@]
See also

Tag.of

Value members

Concrete methods

@inline
def apply[@specialized A, T](a: A): A @@ T

subst specialized to Id.

subst specialized to Id.

Todo

According to Miles, @specialized doesn't help here. Maybe manually specialize.

def of[T]: TagOf[T]

Variants of apply, subst, and unsubst that require specifying the tag type but are more likely to infer the other type parameters.

Variants of apply, subst, and unsubst that require specifying the tag type but are more likely to infer the other type parameters.

@inline
def subst[A, F[_], T](fa: F[A]): F[A @@ T]

Add a tag T to A.

Add a tag T to A.

NB: It is unwise to subst or unsubst a tag in an F that is sensitive to the A type within. For example, if F is a GADT, rather than a normal ADT, it will be type-correct, but probably not what you expect. For "normal" types like List and function types, it is safe. More broadly, if it is possible to write a ''legal'' scalaz.InvariantFunctor over the parameter, subst of that parameter is safe. This is because subst effectively provides evidence that a type and all its tagged variants are equal; tagging works to discriminate types because that fact is not implicit to the compiler.

We do not have a type role system in Scala with which to declare the exact situations under which subst is safe. If we did, we would declare that subst is safe if and only if the parameter has "representational" or "phantom" role.

def subst1[G[_], F[_[_]], T](fa: F[G]): F[[α] =>> G[α] @@ T]

Add a tag T to G[_]

Add a tag T to G[_]

@inline
def unsubst[A, F[_], T](fa: F[A @@ T]): F[A]

Remove the tag T, leaving A.

Remove the tag T, leaving A.

@inline
def unsubst1[G[_], F[_[_]], T](fa: F[[α] =>> G[α] @@ T]): F[G]

Remove the tag T, leaving G

Remove the tag T, leaving G

@inline
def unwrap[@specialized A, T](a: A @@ T): A

unsubst specialized to Id.

unsubst specialized to Id.

Concrete fields

@inline
val k: TagKind