-
Safe downcast.
Declaration
Swift
public static func fix(_ fa: EitherTOf<F, A, B>) -> EitherT<F, A, B>Parameters
faValue in the higher-kind form.
Return Value
Value cast to EitherT.
-
Applies the provided closures based on the content of the nested
Eithervalue.Declaration
Swift
public func fold<C>(_ fa: @escaping (A) -> C, _ fb: @escaping (B) -> C) -> Kind<F, C>Parameters
faClosure to apply if the contained value in the nested
Eitheris a member of the left type.fbClosure to apply if the contained value in the nested
Eitheris 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
Eithervalue.Declaration
Swift
public func cata<C>(_ l: @escaping (A) -> C, _ r: @escaping (B) -> C) -> Kind<F, C>Parameters
lClosure to apply if the contained value in the nested
Eitheris a member of the left type.rClosure to apply if the contained value in the nested
Eitheris 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
fFunction 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
fTransforming function.
Return Value
An
EitherTwere the left type has been transformed.
-
Creates an
EitherTwith a nested left value.Declaration
Swift
public static func left(_ a: A) -> EitherT<F, A, B>Parameters
aValue for the left case.
Return Value
A left
Eitherwrapped in the effect. -
Creates an
EitherTwith a nested right value.Declaration
Swift
public static func right(_ b: B) -> EitherT<F, A, B>Parameters
bValue for the right case.
Return Value
A right
Eitherwrapped in the effect.
-
Flatmaps a function that produces an effect and lifts it back to
EitherTDeclaration
Swift
public func semiflatMap<C>(_ f: @escaping (B) -> Kind<F, C>) -> EitherT<F, A, C>Parameters
fA function producing an effect.
Return Value
Result of flatmapping and lifting the function in this value.
Install in Dash
EitherT Class Reference