Optional

@_frozen
enum Optional<Wrapped> : ExpressibleByNilLiteral
  • Converts this optional to an Either.right value, providing a default value if it is nil.

    Declaration

    Swift

    func rightIfNotNull<A>(_ f: @autoclosure () -> A) -> Either<A, Wrapped>

    Parameters

    f

    Default value provider.

    Return Value

    A right value containing the wrapped value, or a left with the provided default value.