-
Safe downcast.
Declaration
Swift
public static func fix(_ fa: EitherTOf<F, A, B>) -> EitherT<F, A, B>
Parameters
fa
Value in the higher-kind form.
Return Value
Value cast to EitherT.
-
Applies the provided closures based on the content of the nested
Either
value.Declaration
Swift
public func fold<C>(_ fa: @escaping (A) -> C, _ fb: @escaping (B) -> C) -> Kind<F, C>
Parameters
fa
Closure to apply if the contained value in the nested
Either
is a member of the left type.fb
Closure to apply if the contained value in the nested
Either
is a member of the right type.Return Value
Result of applying the corresponding closure to the nested
Either
, wrapped in the effect. -
Applies the provided closures based on the content of the nested
Either
value.Declaration
Swift
public func cata<C>(_ l: @escaping (A) -> C, _ r: @escaping (B) -> C) -> Kind<F, C>
Parameters
l
Closure to apply if the contained value in the nested
Either
is a member of the left type.r
Closure to apply if the contained value in the nested
Either
is a member of the right type.Return Value
Result of applying the corresponding closure to the nested
Either
, wrapped in the effect. -
Flatmaps the provided function to the nested
Either
.Declaration
Swift
public func subflatMap<C>(_ f: @escaping (B) -> Either<A, C>) -> EitherT<F, A, C>
Parameters
f
Function for the flatmap operation.
Return Value
Result of flatmapping the provided function to the nested
Either
, wrapped in the effect. -
Transforms the left type of the nested
Either
.Declaration
Swift
public func mapLeft<C>(_ f: @escaping (A) -> C) -> EitherT<F, C, B>
Parameters
f
Transforming function.
Return Value
An
EitherT
were the left type has been transformed.
-
Creates an
EitherT
with a nested left value.Declaration
Swift
public static func left(_ a: A) -> EitherT<F, A, B>
Parameters
a
Value for the left case.
Return Value
A left
Either
wrapped in the effect. -
Creates an
EitherT
with a nested right value.Declaration
Swift
public static func right(_ b: B) -> EitherT<F, A, B>
Parameters
b
Value for the right case.
Return Value
A right
Either
wrapped in the effect.
-
Flatmaps a function that produces an effect and lifts it back to
EitherT
Declaration
Swift
public func semiflatMap<C>(_ f: @escaping (B) -> Kind<F, C>) -> EitherT<F, A, C>
Parameters
f
A function producing an effect.
Return Value
Result of flatmapping and lifting the function in this value.