package hardcaml_step_testbench

  1. Overview
  2. Docs
Hardcaml Testbench Monad

Install

Dune Dependency

Authors

Maintainers

Sources

hardcaml_step_testbench-v0.16.0.tar.gz
sha256=2a8382d8acb404fced2e8b9fb794e5ac14cee6e15a77149b5c63ad560f873953

doc/hardcaml_step_testbench.digital_components/Digital_components/Step_monad/index.html

Module Digital_components.Step_monadSource

Sourcetype ('a, 'i, 'o) t
Sourceval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> ('i -> Sexplib0.Sexp.t) -> ('o -> Sexplib0.Sexp.t) -> ('a, 'i, 'o) t -> Sexplib0.Sexp.t
include Base.Monad.S3 with type ('a, 'b, 'c) t := ('a, 'b, 'c) t
Sourceval (>>=) : ('a, 'd, 'e) t -> ('a -> ('b, 'd, 'e) t) -> ('b, 'd, 'e) t
Sourceval (>>|) : ('a, 'd, 'e) t -> ('a -> 'b) -> ('b, 'd, 'e) t
Sourcemodule Let_syntax : sig ... end
Sourcemodule Monad_infix : sig ... end

Same as Infix, except the monad type has three arguments. The second and third are always just passed through.

Sourceval bind : ('a, 'd, 'e) t -> f:('a -> ('b, 'd, 'e) t) -> ('b, 'd, 'e) t
Sourceval return : 'a -> ('a, _, _) t
Sourceval map : ('a, 'd, 'e) t -> f:('a -> 'b) -> ('b, 'd, 'e) t
Sourceval join : (('a, 'd, 'e) t, 'd, 'e) t -> ('a, 'd, 'e) t
Sourceval ignore_m : (_, 'd, 'e) t -> (unit, 'd, 'e) t
Sourceval all : ('a, 'd, 'e) t list -> ('a list, 'd, 'e) t
Sourceval all_unit : (unit, 'd, 'e) t list -> (unit, 'd, 'e) t
Sourceval next_step : Base.Source_code_position.t -> 'o -> ('i, 'i, 'o) t
Sourceval thunk : (Base.Unit.t -> ('a, 'i, 'o) t) -> ('a, 'i, 'o) t
Sourceval output_forever : 'o -> (_, _, 'o) t
Sourceval for_ : Base.Int.t -> Base.Int.t -> (Base.Int.t -> (Base.Unit.t, 'i, 'o) t) -> (Base.Unit.t, 'i, 'o) t

for_ i j f does f i, f (i+1), ... f j in sequence. If j < i, then for_ i j immediately returns unit.

Sourceval delay : 'o -> num_steps:Base.Int.t -> (Base.Unit.t, _, 'o) t

delay o ~num_steps outputs o for num_steps and then returns unit. delay raises if num_steps < 0.

Sourceval repeat : count:Base.Int.t -> (Base.Unit.t -> (Base.Unit.t, 'i, 'o) t) -> (Base.Unit.t, 'i, 'o) t

repeat ~count f does f () count times. repeat raises if count < 0.

Sourceval wait : output:'o -> until:('i -> Base.Bool.t) -> (Base.Unit.t, 'i, 'o) t
Sourcemodule Event : sig ... end

An event is a value that will at some point in time (possibly the past, possibly the future) transition from "undetermined" to "determined", with some value. One can wait_for an event in a computation.

Sourceval wait_for : 'a Event.t -> output:'o -> ('a, _, 'o) t

wait_for event ~output outputs output until the step at which event becomes determined, at which point the wait_for proceeds.

Sourcemodule Component_finished : sig ... end
Sourceval spawn : ?update_children_after_finish:Base.Bool.t -> Base.Source_code_position.t -> start:('i_c -> (('a, 'o_c) Component_finished.t, 'i_c, 'o_c) t) -> input:'i_c Data.t -> output:'o_c Data.t -> child_input:(parent:'i -> 'i_c) -> include_child_output:(parent:'o -> child:'o_c -> 'o) -> (('a, 'o_c) Component_finished.t Event.t, 'i, 'o) t

spawn creates a child computation that runs start. spawn returns on the current step, and the child starts on the next step. The parent computation uses child_input to adjust its input into the form that the child computation sees, and include_child_output to incorporate the child's output into its output.

When update_children_after_finish, unfinished tasks spawned from within start will be executed even after start completes.

Sourceval create_component : created_at:Base.Source_code_position.t -> update_children_after_finish:Base.Bool.t -> start:('i -> (('a, 'o) Component_finished.t, 'i, 'o) t) -> input:'i Data.t -> output:'o Data.t -> ('i, 'o) Component.t * ('a, 'o) Component_finished.t Event.t

create_component creates a Component.t that runs the computation described by start. When update_children_after_finish is set to true, all component's children will be updated even after the child terminates. This will result in tasks spawned from within the child task to execute even after the child terminates.

OCaml

Innovation. Community. Security.