fold
Namespace: FsToolkit.ErrorHandling
Function Signature
Examples
Example 1
fold
can be used to convert Result
to another similar type, such as Choice
:
Example 2
In a typical web application, if there is any request validation error, we send HTTP 400 Bad Request
as response and HTTP 200 OK
for a successful operation.
Given the following function:
And the following fake HTTP response type:
Then using Result.fold
, we can do the following
Last updated