ApplicativeError
public protocol ApplicativeError : Applicative
An ApplicativeError is an Applicative
that has capabilities to raise and handle error values.
It has an associated type E
to represent the error type that the implementing instance is able to handle.
-
Error type associated to this
ApplicativeError
instanceDeclaration
Swift
associatedtype E
-
Handles an error, potentially recovering from it by mapping it to a value in the context implementing this instance.
Declaration
Parameters
fa
A computation that may have an error.
f
A recovery function.
Return Value
A value where the possible errors have been recovered using the provided function.
-
handleError(_:_:)
Extension methodHandles an error, potentially recovering from it by mapping it to a value.
Declaration
Parameters
fa
A computation that may have an error.
f
A recovery function.
Return Value
A value where the possible errors have been recovered using the provided function.
-
attempt(_:)
Extension methodHandles errors by converting them into
Either
values in the context implementing this instance.Parameters
fa
A computation that may have an error.
Return Value
An either wrapped in the context implementing this instance.
-
fromEither(_:)
Extension method -
fromOption(_:_:)
Extension method -
fromTry(_:_:)
Extension method -
catchError(_:_:)
Extension methodEvaluates a throwing function, catching and mapping errors.
Declaration
Parameters
f
A throwing function.
recover
A function that maps from
Error
to the type that this instance is able to handle.Return Value
A value in the context implementing this instance.
-
catchError(_:)
Extension method