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