sig
  module Deferred :
    sig
      type ('a, 'execution_context) t =
          ('a, 'execution_context) Raw_deferred.t
      type ('a, 'execution_context) deferred = ('a, 'execution_context) t
      val of_ivar :
        ('a, 'execution_context) Raw_ivar.t -> ('a, 'execution_context) t
      val peek : ('a, 'b) t -> 'a option
      module Scheduler_dependent :
        functor (Scheduler : Import.Basic_scheduler->
          functor
            (Deferred : sig
                          type 'a t
                          val of_raw :
                            ('a, Scheduler.Execution_context.t) t -> 'a t
                          val to_raw :
                            'a t -> ('a, Scheduler.Execution_context.t) t
                        end->
            functor
              (Ivar : sig
                        type 'a t
                        val of_raw :
                          ('a, Scheduler.Execution_context.t) Raw_ivar.t ->
                          'a t
                        val to_raw :
                          'a t ->
                          ('a, Scheduler.Execution_context.t) Raw_ivar.t
                      end->
              sig
                type 'a t = 'Deferred.t
                val create : ('Ivar.t -> unit) -> 'a t
                val peek : 'a t -> 'a option
                val is_determined : 'a t -> bool
                val return : '-> 'a t
                val upon : 'a t -> ('-> unit) -> unit
                val upon' : 'a t -> ('-> unit) -> Unregister.t
                val bind : 'a t -> ('-> 'b t) -> 'b t
                val install_removable_handler :
                  'a t ->
                  ('a, Scheduler.Execution_context.t) Raw_handler.t ->
                  Unregister.t
                val of_raw :
                  ('a, Scheduler.Execution_context.t) deferred -> 'a t
                val to_raw :
                  'a t -> ('a, Scheduler.Execution_context.t) deferred
                val sexp_of_t :
                  ('-> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
              end
      val sexp_of_t :
        ('-> Sexplib.Sexp.t) ->
        ('execution_context -> Sexplib.Sexp.t) ->
        ('a, 'execution_context) t -> Sexplib.Sexp.t
      val ounit_tests : unit -> OUnit.test
    end
  module Ivar :
    sig
      module Handler :
        sig
          type ('a, 'execution_context) t =
              ('a, 'execution_context) Raw_ivar.Handler.t
        end
      type ('a, 'execution_context) t = ('a, 'execution_context) Raw_ivar.t
      type ('a, 'execution_context) ivar = ('a, 'execution_context) t
      val invariant :
        'Core.Std.Invariant.inv ->
        'Core.Std.Invariant.inv -> ('a, 'b) t Core.Std.Invariant.inv
      val create : unit -> ('a, 'b) t
      val peek : ('a, 'b) t -> 'a option
      val is_empty : ('a, 'b) t -> bool
      val is_full : ('a, 'b) t -> bool
      module Scheduler_dependent :
        functor (Scheduler : Import.Basic_scheduler->
          functor
            (Ivar : sig
                      type 'a t
                      val of_raw :
                        ('a, Scheduler.Execution_context.t) ivar -> 'a t
                      val to_raw :
                        'a t -> ('a, Scheduler.Execution_context.t) ivar
                    end->
            sig
              type 'a t = 'Ivar.t
              val equal : 'a t -> 'a t -> bool
              val create : unit -> 'a t
              val create_full : '-> 'a t
              val peek : 'a t -> 'a option
              val is_empty : 'a t -> bool
              val is_full : 'a t -> bool
              val connect : bind_result:'a t -> bind_rhs:'a t -> unit
              val fill : 'a t -> '-> unit
              val install_removable_handler :
                'a t ->
                ('a, Scheduler.Execution_context.t) Raw_handler.t ->
                Unregister.t
              val upon : 'a t -> ('-> unit) -> unit
              val upon' : 'a t -> ('-> unit) -> Unregister.t
              val of_raw : ('a, Scheduler.Execution_context.t) ivar -> 'a t
              val to_raw : 'a t -> ('a, Scheduler.Execution_context.t) ivar
              val sexp_of_t :
                ('-> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
            end
      val debug_space_leaks : int option ref
      val sexp_of_t :
        ('-> Sexplib.Sexp.t) ->
        ('execution_context -> Sexplib.Sexp.t) ->
        ('a, 'execution_context) t -> Sexplib.Sexp.t
      val ounit_tests : unit -> OUnit.test
    end
  module Stream :
    sig
      module Deferred :
        sig
          type ('a, 'execution_context) t =
              ('a, 'execution_context) Raw_deferred.t
          type ('a, 'execution_context) deferred = ('a, 'execution_context) t
          val of_ivar :
            ('a, 'execution_context) Raw_ivar.t -> ('a, 'execution_context) t
          val peek : ('a, 'b) t -> 'a option
          module Scheduler_dependent :
            functor (Scheduler : Import.Basic_scheduler->
              functor
                (Deferred : sig
                              type 'a t
                              val of_raw :
                                ('a, Scheduler.Execution_context.t) t -> 'a t
                              val to_raw :
                                'a t -> ('a, Scheduler.Execution_context.t) t
                            end->
                functor
                  (Ivar : sig
                            type 'a t
                            val of_raw :
                              ('a, Scheduler.Execution_context.t) Raw_ivar.t ->
                              'a t
                            val to_raw :
                              'a t ->
                              ('a, Scheduler.Execution_context.t) Raw_ivar.t
                          end->
                  sig
                    type 'a t = 'Deferred.t
                    val create : ('Ivar.t -> unit) -> 'a t
                    val peek : 'a t -> 'a option
                    val is_determined : 'a t -> bool
                    val return : '-> 'a t
                    val upon : 'a t -> ('-> unit) -> unit
                    val upon' : 'a t -> ('-> unit) -> Unregister.t
                    val bind : 'a t -> ('-> 'b t) -> 'b t
                    val install_removable_handler :
                      'a t ->
                      ('a, Scheduler.Execution_context.t) Raw_handler.t ->
                      Unregister.t
                    val of_raw :
                      ('a, Scheduler.Execution_context.t) deferred -> 'a t
                    val to_raw :
                      'a t -> ('a, Scheduler.Execution_context.t) deferred
                    val sexp_of_t :
                      ('-> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
                  end
          val sexp_of_t :
            ('-> Sexplib.Sexp.t) ->
            ('execution_context -> Sexplib.Sexp.t) ->
            ('a, 'execution_context) t -> Sexplib.Sexp.t
          val ounit_tests : unit -> OUnit.test
        end
      type ('a, 'execution_context) t =
          (('a, 'execution_context) next, 'execution_context) Deferred.t
      and ('a, 'execution_context) next =
        ('a, 'execution_context) Raw_stream.next =
          Nil
        | Cons of 'a * ('a, 'execution_context) t
      val sexp_of_t :
        ('-> Core.Std.Sexp.t) ->
        '-> (('a, 'c) next, 'c) Deferred.t -> Core.Std.Sexp.t
      val ounit_tests : unit -> OUnit.test
    end
  type ('a, 'execution_context) t =
    ('a, 'execution_context) Raw_tail.t = {
    mutable next :
      (('a, 'execution_context) Stream.next, 'execution_context) Ivar.t;
  }
  val sexp_of_t : '-> '-> ('c, 'd) t -> Core.Std.Sexp.t
  val create : unit -> ('a, 'b) t
  val ounit_tests : unit -> OUnit.test
end