Variance<F, R, O, E>Type-level marker encoding the variance of a TypeLambda's type
parameters.
When to use
Use to define variance constraints for a higher-kinded type so that
Gen can correctly infer R, O, and E from yielded values.
Details
F is invariant and must match exactly. R is contravariant in the input
or environment position. O and E are covariant in the output and error
positions. This is a pure type-level construct with no runtime
representation.
Example (Declaring variance for a TypeLambda)
import type { Option, Utils } from "effect"
declare const variance: Utils.Variance<
Option.OptionTypeLambda,
never,
never,
never
>export interface interface Variance<in out F extends TypeLambda, in R, out O, out E>Type-level marker encoding the variance of a TypeLambda's type
parameters.
When to use
Use to define variance constraints for a higher-kinded type so that
Gen
can correctly infer R, O, and E from yielded values.
Details
F is invariant and must match exactly. R is contravariant in the input
or environment position. O and E are covariant in the output and error
positions. This is a pure type-level construct with no runtime
representation.
Example (Declaring variance for a TypeLambda)
import type { Option, Utils } from "effect"
declare const variance: Utils.Variance<
Option.OptionTypeLambda,
never,
never,
never
>
Variance<in out function (type parameter) F in Variance<in out F extends TypeLambda, in R, out O, out E>F extends import TypeLambdaTypeLambda, in function (type parameter) R in Variance<in out F extends TypeLambda, in R, out O, out E>R, out function (type parameter) O in Variance<in out F extends TypeLambda, in R, out O, out E>O, out function (type parameter) E in Variance<in out F extends TypeLambda, in R, out O, out E>E> {
readonly Variance<in out F extends TypeLambda, in R, out O, out E>._F: Types.Invariant<F>_F: import TypesTypes.type Types.Invariant = /*unresolved*/ anyInvariant<function (type parameter) F in Variance<in out F extends TypeLambda, in R, out O, out E>F>
readonly Variance<in out F extends TypeLambda, in R, out O, out E>._R: Types.Contravariant<R>_R: import TypesTypes.type Types.Contravariant = /*unresolved*/ anyContravariant<function (type parameter) R in Variance<in out F extends TypeLambda, in R, out O, out E>R>
readonly Variance<in out F extends TypeLambda, in R, out O, out E>._O: Types.Covariant<O>_O: import TypesTypes.type Types.Covariant = /*unresolved*/ anyCovariant<function (type parameter) O in Variance<in out F extends TypeLambda, in R, out O, out E>O>
readonly Variance<in out F extends TypeLambda, in R, out O, out E>._E: Types.Covariant<E>_E: import TypesTypes.type Types.Covariant = /*unresolved*/ anyCovariant<function (type parameter) E in Variance<in out F extends TypeLambda, in R, out O, out E>E>
}