Endo

public final class Endo<A> : EndoOf<A>

Endo represents an Endomorphism; i.e., a function where the input and output type is the same.

  • Underlying function describing the endomorphism.

    Declaration

    Swift

    public let run: (A) -> A
  • Safe downcast.

    Declaration

    Swift

    public static func fix(_ fa: EndoOf<A>) -> Endo<A>

    Parameters

    fa

    Value in the higher-kind form.

    Return Value

    Value cast to Endo.

  • Initializes an endomorphism from a plain Swift function.

    Declaration

    Swift

    public init(_ run: @escaping (A) -> A)

    Parameters

    run

    Function describing the endomorphism.

  • Invokes this endo-function.

    Declaration

    Swift

    public func callAsFunction(_ value: A) -> A

    Parameters

    value

    Input to the function.

    Return Value

    Output of the function.

  • Declaration

    Swift

    public func combine(_ other: Endo<A>) -> Endo<A>
  • Declaration

    Swift

    public static func empty() -> Endo<A>