Module Ui_effect.Expert

val eval : on_exn:(Base.Exn.t -> Base.unit) -> ?on_further_exns:(Base.Exn.t -> Base.unit) -> 'a t -> f:('a -> Base.unit) -> Base.unit

eval t ~f runs the given effect, and calls f when the effect completes, or on_exn if the effect does not return a result due to an exception. This function should not be called while constructing effects; it's intended for use by libraries that actually schedule effects, such as Bonsai, or Virtual_dom.

on_further_exns is called on exceptions that occur after the effect has gotten a result/exn. For example, if every branch of an all_parallel call raises an exception, on_exn would be called on the first exn, while on_further_exns would be called on the rest. There is no guarantee that the callbacks will be called in any particular order.

val handle : on_exn:(Base.Exn.t -> Base.unit) -> ?on_further_exns:(Base.Exn.t -> Base.unit) -> Base.unit t -> Base.unit

handle ~on_exn ?on_further_exns t is the same as eval ~on_exn ?on_further_exns t ~f:ignore.

type hide =
  1. | T : {
    1. value : 'a t;
    2. callback : 'a -> Base.unit;
    3. on_exn : Base.Exn.t -> Base.unit;
    } -> hide
val of_fun : f: (callback:('a -> Base.unit) -> on_exn:(Base.Exn.t -> Base.unit) -> Base.unit) -> 'a t