package eio

  1. Overview
  2. Docs

Actions that can be performed by mock handlers.

type 'a t = [
  1. | `Return of 'a
    (*

    Immediately return a value

    *)
  2. | `Raise of exn
    (*

    Raise an exception

    *)
  3. | `Await of 'a Eio.Promise.or_exn
    (*

    Wait for a promise to resolve

    *)
  4. | `Yield_then of 'a t
    (*

    Call Eio.Fiber.yield, then perform an action

    *)
  5. | `Run of unit -> 'a
    (*

    Run any code you like.

    *)
]
val run : 'a t -> 'a

run t performs action t and returns the result.

val map : ('a -> 'b) -> 'a t -> 'b t

run (map f t) = f (run t).

OCaml

Innovation. Community. Security.