Function0

public final class Function0<A> : Function0Of<A>

This data type acts as a wrapper over functions that receive no input and produce a value; namely, constant functions. This wrapper gives these functions capabilities to be used as a Higher Kinded Type and conform to typeclasses that have this requirement.

  • Safe downcast.

    Declaration

    Swift

    public static func fix(_ fa: Function0Of<A>) -> Function0<A>

    Parameters

    fa

    Value in the higher-kind form.

    Return Value

    Value cast to Function0.

  • Constructs a value of Function0.

    Declaration

    Swift

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

    Parameters

    f

    A constant function.

  • Invokes the function.

    Declaration

    Swift

    public func invoke() -> A

    Return Value

    Value produced by this function.

  • Invokes the function.

    Declaration

    Swift

    public func callAsFunction() -> A

    Return Value

    Value produced by this function.

  • Declaration

    Swift

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

    Swift

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