package bonsai

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Poll_result : sig ... end
val poll : ('a -> 'b Effect.t) Value.t -> ('a -> 'b Poll_result.t Effect.t) Computation.t

Transforms an input effect into a new effect that enforces that invariant that at most one instance of the effect is running at once. Attempting to run the effect while a previous run is still ongoing will cause the new effect to be enqueued. Any previously enqueued item gets kicked out, thus maintaining the invariant that at most one effect will be enqueued. (this is important so that things like RPCs calls don't pile up)

CAUTION: This computation assumes that the input effect will always complete. If a run of the effect raises, no more runs will ever get executed, since they will all be waiting for the one that raised to complete.

OCaml

Innovation. Community. Security.