package async

  1. Overview
  2. Docs

Async_kernel

include module type of struct include Async_kernel end
module Async_kernel_config = Async_kernel.Async_kernel_config
module Async_kernel_require_explicit_time_source = Async_kernel.Async_kernel_require_explicit_time_source
module Async_kernel_scheduler = Async_kernel.Async_kernel_scheduler
module Bvar = Async_kernel.Bvar
module Clock_ns = Async_kernel.Clock_ns
module Condition = Async_kernel.Condition
module Execution_context = Async_kernel.Execution_context
module Gc = Async_kernel.Gc
module Invariant = Async_kernel.Invariant
module Ivar = Async_kernel.Ivar
module Lazy_deferred = Async_kernel.Lazy_deferred
module Monad_sequence = Async_kernel.Monad_sequence
module Monitor = Async_kernel.Monitor
module Mvar = Async_kernel.Mvar
module Pipe = Async_kernel.Pipe
module Priority = Async_kernel.Priority
module Sequencer = Async_kernel.Sequencer
module Stream = Async_kernel.Stream
module Synchronous_time_source = Async_kernel.Synchronous_time_source
module Tail = Async_kernel.Tail
module Throttle = Async_kernel.Throttle
module Throttled = Async_kernel.Throttled
module Time_source = Async_kernel.Time_source

Toplevel functions

The functions below are broadly useful when writing Async programs, and so are made available at the toplevel.

val catch : ?here:Core.Source_code_position.t -> ?info:Core.Info.t -> ?name:string -> (unit -> unit) -> exn Async_kernel.Deferred.t
val choice : 'a Async_kernel.Deferred.t -> ('a -> 'b) -> 'b Async_kernel.Deferred.Choice.t
val don't_wait_for : unit Async_kernel.Deferred.t -> unit
val never : unit -> 'a Async_kernel.Deferred.t
val try_with : ?here:Core.Source_code_position.t -> ?info:Core.Info.t -> ?name:string -> ?extract_exn:bool -> ?run:[ `Now | `Schedule ] -> ?rest:[ `Call of exn -> unit | `Log | `Raise ] -> (unit -> 'a Async_kernel.Deferred.t) -> ('a, exn) Core.Result.t Async_kernel.Deferred.t
val upon : 'a Async_kernel.Deferred.t -> ('a -> unit) -> unit

Infix operators and Let_syntax support

include Core.Monad.Infix with type 'a t := 'a Async_kernel.Deferred.t
val (>>>) : 'a Async_kernel.Deferred.t -> ('a -> unit) -> unit

equivalent to Deferred.upon.

equivalent to Deferred.Result.bind.

val (>>|?) : ('a, 'b) Async_kernel.Deferred.Result.t -> ('a -> 'c) -> ('c, 'b) Async_kernel.Deferred.Result.t

equivalent to Deferred.Result.map.

include module type of struct include Async_kernel.Deferred.Let_syntax end
val return : 'a -> 'a Async_kernel.Deferred.t

t >>= f returns a computation that sequences the computations represented by two monad elements. The resulting computation first does t to yield a value v, and then runs the computation returned by f v.

val (>>|) : 'a Async_kernel.Deferred.t -> ('a -> 'b) -> 'b Async_kernel.Deferred.t

t >>| f is t >>= (fun a -> return (f a)).

module Let_syntax = Async_kernel.Let_syntax
module Deferred : sig ... end

Async_unix

include module type of struct include Async_unix end
module Async_config = Async_unix.Async_config
module Busy_poller = Async_unix.Busy_poller
module Clock = Async_unix.Clock
module Dump_core_on_job_delay = Async_unix.Dump_core_on_job_delay
module Fd = Async_unix.Fd
module In_thread = Async_unix.In_thread
module Io_stats = Async_unix.Io_stats
module Io_uring_raw = Async_unix.Io_uring_raw
module Io_uring_raw_singleton = Async_unix.Io_uring_raw_singleton
module Io_uring = Async_unix.Io_uring
module Print = Async_unix.Print
module Process = Async_unix.Process
module Reader = Async_unix.Reader
module Require_explicit_time_source = Async_unix.Require_explicit_time_source
module Scheduler = Async_unix.Scheduler
module Shutdown = Async_unix.Shutdown
module Signal = Async_unix.Signal
module Socket = Async_unix.Socket
module Sys = Async_unix.Sys
module Tcp = Async_unix.Tcp
module Thread_safe = Async_unix.Thread_safe
module Writer = Async_unix.Writer
module Unix = Async_unix.Unix
val every : ?start:unit Async_kernel.Deferred.t -> ?stop:unit Async_kernel.Deferred.t -> ?continue_on_error:bool -> Time_float_unix.Span.t -> (unit -> unit) -> unit
val schedule : ?monitor:Async_kernel.Monitor.t -> ?priority:Async_kernel.Priority.t -> (unit -> unit) -> unit
val schedule' : ?monitor:Async_kernel.Monitor.t -> ?priority:Async_kernel.Priority.t -> (unit -> 'a Async_kernel.Deferred.t) -> 'a Async_kernel.Deferred.t
val shutdown : ?force:unit Async_kernel.Deferred.t -> int -> unit
val within : ?monitor:Async_kernel.Monitor.t -> ?priority:Async_kernel.Priority.t -> (unit -> unit) -> unit
val within' : ?monitor:Async_kernel.Monitor.t -> ?priority:Async_kernel.Priority.t -> (unit -> 'a Async_kernel.Deferred.t) -> 'a Async_kernel.Deferred.t
module Printf = Async_unix.Printf

Shadow blocking functions in Core.Printf to prevent their unintentional use.

include sig ... end
module Overwrite_ = Async_unix.Overwrite_
val close_in_noerr : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val close_in : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val close_out_noerr : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val close_out : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val eprintf : ('a, unit, string, unit) Stdlib.format4 -> 'a
val flush_all : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val flush : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val fprintf : Async_unix.Writer.t -> ('a, unit, string, unit) Stdlib.format4 -> 'a
val ifprintf : 'a -> ('b, 'a, 'c, unit) Stdlib.format4 -> 'b
val in_channel_length : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val input_binary_int : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val input_byte : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val input_char : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val input_line : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val input_lines : ?fix_win_eol:'a -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val input : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val input_value : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val open_in_bin : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val open_in_gen : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val open_in : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val open_out_bin : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val open_out_gen : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val open_out : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val out_channel_length : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val output_binary_int : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val output_byte : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val output_char : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val output : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val output_string : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val output_value : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val pos_in : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val pos_out : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val prerr_char : char -> unit
val prerr_endline : string -> unit
val prerr_float : float -> unit
val prerr_int : int -> unit
val prerr_newline : unit -> unit
val prerr_string : string -> unit
val print_char : char -> unit
val print_endline : string -> unit
val print_float : float -> unit
val printf : ('a, unit, string, unit) Stdlib.format4 -> 'a
val print_int : int -> unit
val print_newline : unit -> unit
val print_s : ?mach:unit -> Sexplib.Sexp.t -> unit
val print_string : string -> unit
val read_float : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val read_int : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val read_line : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val read_lines : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val read_wrap : ?binary:'a -> f:'b -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val really_input : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val seek_in : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val seek_out : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val set_binary_mode_in : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val set_binary_mode_out : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val write_lines : [< `This_is_async__Think_about_blocking ] -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val write_wrap : ?binary:'a -> f:'b -> [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val eprint_s : [< `This_is_async__Think_about_blocking ] -> [> `This_is_async__Think_about_blocking ]
val eprint_s_nonblocking : ?mach:unit -> Sexplib.Sexp.t -> unit
module LargeFile = Async_unix.LargeFile
module Sexp = Async_unix.Sexp
val exit : ?force:unit Async_kernel.Deferred.t -> int -> 'a Async_kernel.Deferred.t

Async_log

module Log : sig ... end
include module type of struct include Async_log.Ppx_log_syntax end

Async_log.Ppx_log_syntax.Ppx_log_syntax exists so that people can open Async_log.Ppx_log_syntax to use ppx log, instead of doing a module alias. This is consistent with Monad.Syntax.Let_syntax.

Async_command

module Command : sig ... end

Async_rpc

include module type of struct include Async_rpc end
module Rpc = Async_rpc.Rpc
module Versioned_rpc = Async_rpc.Versioned_rpc
module Quickcheck : sig ... end
module Expect_test_config : sig ... end

The default expect test config in code which has open Async.

module Expect_test_config_or_error : sig ... end

An alternative to Async.Deferred_or_error_expect_test_config in which %expect has type unit rather than unit Deferred.Or_error.t. This lets one write:

OCaml

Innovation. Community. Security.