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
ApplicativeErrorinstanceDeclaration
Swift
associatedtype E -
Handles an error, potentially recovering from it by mapping it to a value in the context implementing this instance.
Declaration
Parameters
faA computation that may have an error.
fA 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
faA computation that may have an error.
fA 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
Eithervalues in the context implementing this instance.Parameters
faA 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
fA throwing function.
recoverA function that maps from
Errorto the type that this instance is able to handle.Return Value
A value in the context implementing this instance.
-
catchError(_:)Extension method
Install in Dash
ApplicativeError Protocol Reference