bind
Function Signature
('okInput -> AsyncValidation<'okOutput, 'error>) -> AsyncValidation<'okInput, 'error> -> AsyncValidation<'okOutput, 'error>Examples
// string -> AsyncValidation<int, string>
let tryParseIntAsync (s: string) =
async {
match System.Int32.TryParse(s) with
| true, i -> return Ok i
| false, _ -> return Error [ $"'%s{s}' is not a valid integer" ]
}Example 1
let result =
AsyncValidation.ok "42"
|> AsyncValidation.bind tryParseIntAsync
// async { Ok 42 }Example 2
Example 3
Last updated