Tag
Type members
Classlikes
Value members
Concrete methods
subst
specialized to Id
.
subst
specialized to Id
.
- Todo
According to Miles, @specialized doesn't help here. Maybe manually specialize.
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.
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.