package bonsai

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Functions allowing for the creation of time-dependent computations in a testable way.

val approx_now : tick_every:Core.Time_ns.Span.t -> Core.Time_ns.t Computation.t

The current time, updated at tick_every intervals.

The current time, update as frequently as possible.

module Before_or_after : sig ... end

Mirrors Incr.Clock.at, which changes from Before to After at the specified time.

val every : when_to_start_next_effect: [< `Wait_period_after_previous_effect_starts_blocking | `Wait_period_after_previous_effect_finishes_blocking | `Every_multiple_of_period_non_blocking | `Every_multiple_of_period_blocking ] -> ?trigger_on_activate:bool -> Core.Time_ns.Span.t -> unit Effect.t Value.t -> unit Computation.t

An event passed to every is scheduled on an interval determined by the time-span argument.

when_to_start_next_effect has the following behavior | `Wait_period_after_previous_effect_starts_blocking -> If the previous effect takes longer than period, we wait until it finishes before starting the next effect. | `Wait_period_after_previous_effect_finishes_blocking -> The effect will always be executed period after the previous effect finishes. | `Every_multiple_of_period_non_blocking -> Executes the effect at a regular interval. | `Every_multiple_of_period_blocking -> Same as `Every_multiple_of_second, but skips a beat if the previous effect is still running.

val get_current_time : Core.Time_ns.t Effect.t Computation.t

An effect for fetching the current time.

OCaml

Innovation. Community. Security.