CokleisliK

open class CokleisliK<F, B>

CokleisliK represents a function with the signature (Kind<F, A>) -> B that is polymorphic on A, where F and B are fixed. Subclasses of CokleisliK need to implement invoke.

  • Initializer

    Declaration

    Swift

    public init()
  • Invokes this transformation.

    Declaration

    Swift

    open func invoke<A>(_ fa: Kind<F, A>) -> B

    Parameters

    fa

    Input to this function

    Return Value

    Transformed input.

  • Invokes this transformation.

    Declaration

    Swift

    public func callAsFunction<A>(_ fa: Kind<F, A>) -> B

    Parameters

    fa

    Input to this function

    Return Value

    Transformed input.

  • Composes this function with another one.

    Declaration

    Swift

    public func andThen<H>(_ g: Function1<B, H>) -> CokleisliK<F, H>

    Parameters

    g

    Function to compose with this one.

    Return Value

    A function that transform the input with this function and the received one afterwards.

  • Composes this function with another one.

    Declaration

    Swift

    public func andThen<H>(_ g: @escaping (B) -> H) -> CokleisliK<F, H>

    Parameters

    g

    Function to compose with this one.

    Return Value

    A function that transform the input with this function and the received one afterwards.

  • Composes this function with another one.

    Declaration

    Swift

    public func compose<H>(_ g: Function1<B, H>) -> CokleisliK<F, H>

    Parameters

    g

    Function to compose with this one.

    Return Value

    A function that transform the input with the received function and this one afterwards.

  • Composes this function with another one.

    Declaration

    Swift

    public func compose<H>(_ g: @escaping (B) -> H) -> CokleisliK<F, H>

    Parameters

    g

    Function to compose with this one.

    Return Value

    A function that transform the input with the received function and this one afterwards.