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