mapError
Function Signature
('errorInput -> 'errorOutput) -> TaskValidation<'ok, 'errorInput>
-> TaskValidation<'ok, 'errorOutput>Examples
// string -> int
let getErrorCode (message: string) =
match message with
| "bad things happened" -> 1
| _ -> 0Example 1
let result =
TaskValidation.ok "all good" // TaskValidation<string, string>
|> TaskValidation.mapError getErrorCode // TaskValidation<string, int>
// task { Ok "all good" }Example 2
Last updated