Yoneda

public final class Yoneda<F, A> : YonedaOf<F, A> where F : Functor

This type implements the covariant form of the Yoneda lemma, stating that F is naturally isomorphic to Yoneda.

Yoneda can be viewed as the partial application of the map function, where the first argument is fixed:

map :: (F<A>, (A) -> B) -> F<B> Yoneda :: ((A) -> B) -> F<B>

  • Safe downcast.

    Declaration

    Swift

    public static func fix(_ fa: YonedaOf<F, A>) -> Yoneda<F, A>

    Parameters

    fa

    Value in the higher-kind form.

    Return Value

    Value cast to Yoneda.

  • Lifts a value to a Yoneda value.

    Declaration

    Swift

    public static func liftYoneda(_ fa: Kind<F, A>) -> Yoneda<F, A>

    Parameters

    fa

    Functorial value.

    Return Value

    Yoneda value.

  • Initializes a Yoneda value.

    Declaration

    Swift

    public init(_ f: @escaping (@escaping (A) -> /*B*/Any) -> Kind<F, /*B*/Any>)

    Parameters

    f

    Function describing the natural isomorphism.

  • Undocumented

    Declaration

    Swift

    public func toCoyoneda() -> Coyoneda<F, A>
  • Applies a function to this Yoneda value.

    Declaration

    Swift

    public func apply<B>(_ f: @escaping (A) -> B) -> Kind<F, B>

    Parameters

    f

    Transforming function.

    Return Value

    A value in the functorial context wrapped in this Yoneda value.

  • Obtains the value yielding the Yoneda isomorphism.

    Declaration

    Swift

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

    Return Value

    A value in the functorial context.