Namespace: FsToolkit.ErrorHandling
Function Signature:
('a -> Job<'b>) -> Job<'b> -> Job<'a option> -> Job<'b>Runs onSome if the job-wrapped option is Some, otherwise runs onNone.
let tryFindUser : string -> Job<User option>
// Job<string>
tryFindUser "alice"
|> JobOption.either
(fun user -> Job.singleton (sprintf "Found user: %s" user.Name))
(Job.singleton "User not found")let maybeValue : Job<int option> = Job.singleton (Some 42)
maybeValue
|> JobOption.either
(fun x -> Job.singleton (x * 2))
(Job.singleton 0)
// job { return 84 }let emptyJob : Job<int option> = Job.singleton None
emptyJob
|> JobOption.either
(fun x -> Job.singleton (x * 2))
(Job.singleton 0)
// job { return 0 }