EnvT

public final class EnvT<E, W, A> : EnvTOf<E, W, A>

The environment Comonad Transformer. This Comonad Transformer extends the context of a value in the base Comonad with a global environment.

  • Safe downcast.

    Declaration

    Swift

    public static func fix(_ value: EnvTOf<E, W, A>) -> EnvT<E, W, A>

    Parameters

    value

    Value in the higher-kind form.

    Return Value

    Value cast to EnvT.

  • Initializes an EnvT with an environment and a value of the base Comonad.

    Declaration

    Swift

    public init(_ e: E, _ wa: Kind<W, A>)

    Parameters

    e

    Environment.

    wa

    Value of the base comonad.

  • Initializes an EnvT with a pair containing an environment and a value of the base Comonad.

    Declaration

    Swift

    public init(_ pair: (E, Kind<W, A>))

    Parameters

    pair

    Tuple with the environment and a value of the base Comonad.

  • Obtains a tuple with the environment and a value of the base Comonad.

    Declaration

    Swift

    public func runT() -> (E, Kind<W, A>)

    Return Value

    A tuple with the environment and a value of the base Comonad.

  • Changes the type of the environment.

    Declaration

    Swift

    public func local<EE>(_ f: @escaping (E) -> EE) -> EnvT<EE, W, A>

    Parameters

    f

    Function to transform the current environment.

  • Obtains the wrapped comonadic value without the environment.

    Declaration

    Swift

    public func lower() -> Kind<W, A>

    Return Value

    Wrapped comonadic value without the environment.

  • Initializes an Env with an environment and a value.

    Declaration

    Swift

    convenience init(_ e: E, _ a: A)

    Parameters

    e

    Environment.

    a

    Value in the base Comonad.

  • Obtains a tuple with the environment and the wrapped value.

    Declaration

    Swift

    func run() -> (E, A)

    Return Value

    A tuple with the environment and the wrapped value.