-
Creates an Ior value of the left type.
Declaration
Swift
public static func left(_ a: A) -> Ior<A, B>Parameters
aA value of the left type.
Return Value
An
Iorof the left type. -
Creates an Ior value of the right type.
Declaration
Swift
public static func right(_ b: B) -> Ior<A, B>Parameters
bA value of the right type.
Return Value
An
Iorof the right type. -
Creates an Ior value with both types.
Declaration
Swift
public static func both(_ a: A, _ b: B) -> Ior<A, B>Parameters
aA value of the left type.
bA value of the right type.
Return Value
An
Iorof both types. -
Creates an Ior value from two optional values.
Declaration
Parameters
maAn optional value of the left type.
mbAn optional value of the right type.
Return Value
An optional
Iorthat is empty if both options are empty, or has a presentIorwith the present values of the options. -
Safe downcast.
Declaration
Swift
public static func fix(_ fa: IorOf<A, B>) -> Ior<A, B>Parameters
faValue in the higher-kind form.
Return Value
Value cast to Ior.
-
Applies the provided closures based on the content of this
Iorvalue.Declaration
Swift
public func fold<C>(_ fa: (A) -> C, _ fb: (B) -> C, _ fab: (A, B) -> C) -> CParameters
faClosure to apply if the contained value in this
Ioris a member of the left type.fbClosure to apply if the contained value in this
Ioris a member of the right type.fabClosure to apply if the contained values in this
Iorare 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
faClosure to transform the left type.
fbClosure to transform the right type.
Return Value
An
Iorvalue 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
fTransforming function.
Return Value
An
Iorvalue 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
Iorwhere the left values are right and vice versa, and both values are swapped. -
Transforms this
Iorto nestedEithervalues representing the possible values wrapped.Return Value
A value where:
Ior.leftis mapped toEither.left(Either.left).Ior.rightis mapped toEither.left(Either.right).Ior.bothis mapped toEither.rightcontaining 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) -> BParameters
defaultValueDefault value for the left case.
Return Value
Right value wrapped in the right and both cases, or the default value if this
Iorcontains 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 }
Install in Dash
Ior Class Reference