-
Creates an Ior value of the left type.
Declaration
Swift
public static func left(_ a: A) -> Ior<A, B>
Parameters
a
A value of the left type.
Return Value
An
Ior
of the left type. -
Creates an Ior value of the right type.
Declaration
Swift
public static func right(_ b: B) -> Ior<A, B>
Parameters
b
A value of the right type.
Return Value
An
Ior
of the right type. -
Creates an Ior value with both types.
Declaration
Swift
public static func both(_ a: A, _ b: B) -> Ior<A, B>
Parameters
a
A value of the left type.
b
A value of the right type.
Return Value
An
Ior
of both types. -
Creates an Ior value from two optional values.
Declaration
Parameters
ma
An optional value of the left type.
mb
An optional value of the right type.
Return Value
An optional
Ior
that is empty if both options are empty, or has a presentIor
with the present values of the options. -
Safe downcast.
Declaration
Swift
public static func fix(_ fa: IorOf<A, B>) -> Ior<A, B>
Parameters
fa
Value in the higher-kind form.
Return Value
Value cast to Ior.
-
Applies the provided closures based on the content of this
Ior
value.Declaration
Swift
public func fold<C>(_ fa: (A) -> C, _ fb: (B) -> C, _ fab: (A, B) -> C) -> C
Parameters
fa
Closure to apply if the contained value in this
Ior
is a member of the left type.fb
Closure to apply if the contained value in this
Ior
is a member of the right type.fab
Closure to apply if the contained values in this
Ior
are members of both types.Return Value
Result of aplying the corresponding closure to this value.
-
Checks if this value contains only a value of the left type.
Declaration
Swift
public var isLeft: Bool { get }
-
Checks if this value contains only a value of the right type.
Declaration
Swift
public var isRight: Bool { get }
-
Checks if this value contains values of both left and right types.
Declaration
Swift
public var isBoth: Bool { get }
-
Transforms both type parameters with the provided closures.
Declaration
Swift
public func bimap<C, D>(_ fa: (A) -> C, _ fb: (B) -> D) -> Ior<C, D>
Parameters
fa
Closure to transform the left type.
fb
Closure to transform the right type.
Return Value
An
Ior
value with its type parameters transformed using the provided functions. -
Transforms the left type parameter with the provided closure.
Declaration
Swift
public func mapLeft<C>(_ f: (A) -> C) -> Ior<C, B>
Parameters
f
Transforming function.
Return Value
An
Ior
value with its left type parameter transformed using the provided function. -
Swaps the type parameters.
Declaration
Swift
public func swap() -> Ior<B, A>
Return Value
An
Ior
where the left values are right and vice versa, and both values are swapped. -
Transforms this
Ior
to nestedEither
values representing the possible values wrapped.Return Value
A value where:
Ior.left
is mapped toEither.left(Either.left)
.Ior.right
is mapped toEither.left(Either.right)
.Ior.both
is mapped toEither.right
containing a tuple of the two values.
-
Obtains a value of the right type, or a default if there is none.
Declaration
Swift
public func getOrElse(_ defaultValue: B) -> B
Parameters
defaultValue
Default value for the left case.
Return Value
Right value wrapped in the right and both cases, or the default value if this
Ior
contains a left value.
-
Provides a Fold based on the Foldable instance of this type.
Declaration
Swift
static var fold: Fold<Ior<A, B>, B> { get }
-
Provides a Traversal based on the Traverse instance of this type.
Declaration
Swift
static var traversal: Traversal<Ior<A, B>, B> { get }
-
Undocumented
Declaration
Swift
public typealias EachFoci = B
-
Declaration
Swift
public static var each: Traversal<Ior<A, B>, B> { get }
-
Provides a prism focused on the left side of this Ior.
Declaration
Swift
static var leftPrism: Prism<Ior<A, B>, A> { get }
-
Provides a prism focused on the right side of this Ior.
Declaration
Swift
static var rightPrism: Prism<Ior<A, B>, B> { get }
-
Provides a prism focused on the both side of this Ior.
Declaration
Swift
static var bothPrism: Prism<Ior<A, B>, (A, B)> { get }
-
Declaration
Swift
public var description: String { get }
-
Declaration
Swift
public var debugDescription: String { get }