Hive.Outcome
hive · API reference
Completion state shared by workers, tasks and supervisors.
The result of joining a finished unit of work.
Copied from Cats Effect's Outcome: supervisors and callers consult it to decide restarts and error handling.
type 'a t =
| Completed of 'a (* Finished normally with a value. *)
| Failed of exn (* Terminated by an uncaught exception. *)
| Cancelled (* Cancelled before completion (e.g. switch shutdown). *)val map : ('a -> 'b) -> 'a t -> 'b tmap f o applies f to the value of a Completed outcome.
Failed and Cancelled pass through unchanged:
ocaml]
Hive.Outcome.map String.length (Hive.Outcome.Completed "ok")
= Hive.Outcome.Completed 2val value : 'a t -> 'a optionvalue o is Some v iff o is Completed v.
val is_completed : _ t -> booltrue for Completed _.
val is_failed : _ t -> booltrue for Failed _.
val is_cancelled : _ t -> booltrue for Cancelled.