core-lwt
  1. Overview
  2. Docs
module Lwt : sig ... end
include module type of struct include Core_lwt_basic end
type 'a t = 'a Lwt.t
include Core_kernel.Monad with type 'a t := 'a Lwt.t
val (>>=) : 'a Lwt.t -> ('a -> 'b Lwt.t) -> 'b Lwt.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 Lwt.t -> ('a -> 'b) -> 'b Lwt.t

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

module Monad_infix = Core_lwt_basic.Monad_infix
val bind : 'a Lwt.t -> f:('a -> 'b Lwt.t) -> 'b Lwt.t

bind t ~f = t >>= f

val return : 'a -> 'a Lwt.t

return v returns the (trivial) computation that returns v.

val map : 'a Lwt.t -> f:('a -> 'b) -> 'b Lwt.t

map t ~f is t >>| f.

val join : 'a Lwt.t Lwt.t -> 'a Lwt.t

join t is t >>= (fun t' -> t').

val ignore_m : 'a Lwt.t -> unit Lwt.t

ignore_m t is map t ~f:(fun _ -> ()). ignore_m used to be called ignore, but we decided that was a bad name, because it shadowed the widely used Pervasives.ignore. Some monads still do let ignore = ignore_m for historical reasons.

val all : 'a Lwt.t list -> 'a list Lwt.t
val all_unit : unit Lwt.t list -> unit Lwt.t
val all_ignore : unit Lwt.t list -> unit Lwt.t
  • deprecated [since 2018-02] Use [all_unit]
module Let_syntax = Core_lwt_basic.Let_syntax
val (>>=?) : 'a Lwt.Or_error.t -> ('a -> 'b Lwt.Or_error.t) -> 'b Lwt.Or_error.t
val (>>|?) : 'a Lwt.Or_error.t -> ('a -> 'b) -> 'b Lwt.Or_error.t