map2
Last updated
Last updated
Namespace: FsToolkit.ErrorHandling
Function Signature:
Given the following function:
Then using ResultOption.map2
, we can do the following:
Let's assume that we have the following types and functions in addition to what we defined in the :
We can then create a function transforming a CreatePostRequestDto
to a CreatePostRequest
, using Option.traverseResult
, ResultOption.map2
, and Result.map2
:
Note that this example can also be written using the result
and resultOption
computation expressions, which would allow you to skip the map2
functions. See for example the .