sig
  module Tail :
    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 create :
            (('a, 'execution_context) Raw_ivar.t -> unit) ->
            ('a, 'execution_context) t
          val peek : ('a, 'b) t -> 'a option
          val is_determined : ('a, 'b) t -> bool
          val return : '-> ('a, 'b) t
          module Scheduler_dependent :
            functor (Scheduler : Import.Basic_scheduler->
              sig
                type 'a t = ('a, Scheduler.Execution_context.t) deferred
                val sexp_of_t :
                  ('-> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
                type 'a detailed = 'a t
                val sexp_of_detailed :
                  ('-> Sexplib.Sexp.t) -> 'a detailed -> Sexplib.Sexp.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
              end
          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
          val sexp_of_t :
            ('-> Sexplib.Sexp.t) ->
            ('execution_context -> Sexplib.Sexp.t) ->
            ('a, 'execution_context) t -> Sexplib.Sexp.t
          type ('a, 'execution_context) ivar = ('a, 'execution_context) t
          val equal : ('a, 'b) t -> ('a, 'b) t -> bool
          val create : unit -> ('a, 'b) t
          val create_full : '-> ('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->
              sig
                type 'a t = ('a, Scheduler.Execution_context.t) ivar
                val sexp_of_t :
                  ('-> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
                type 'a detailed = 'a t
                val sexp_of_detailed :
                  ('-> Sexplib.Sexp.t) -> 'a detailed -> Sexplib.Sexp.t
                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
              end
          val debug_space_leaks : int option ref
          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 create :
                (('a, 'execution_context) Raw_ivar.t -> unit) ->
                ('a, 'execution_context) t
              val peek : ('a, 'b) t -> 'a option
              val is_determined : ('a, 'b) t -> bool
              val return : '-> ('a, 'b) t
              module Scheduler_dependent :
                functor (Scheduler : Import.Basic_scheduler->
                  sig
                    type 'a t = ('a, Scheduler.Execution_context.t) deferred
                    val sexp_of_t :
                      ('-> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
                    type 'a detailed = 'a t
                    val sexp_of_detailed :
                      ('-> Sexplib.Sexp.t) -> 'a detailed -> Sexplib.Sexp.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
                  end
              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 next : '-> 'a
          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 collect : ('a, 'b) t -> (('a, 'b) Stream.next, 'b) Deferred.t
      val ounit_tests : unit -> OUnit.test
    end
  type 'execution_context t =
    'execution_context Raw_monitor.t = {
    name_opt : string option;
    id : int;
    parent : 'execution_context t option;
    errors : (exn, 'execution_context) Tail.t;
    mutable has_seen_error : bool;
    mutable someone_is_listening : bool;
  }
  val someone_is_listening : 'a t -> bool
  val set_someone_is_listening : 'a t -> bool -> unit
  val has_seen_error : 'a t -> bool
  val set_has_seen_error : 'a t -> bool -> unit
  val errors : 'a t -> (exn, 'a) Tail.t
  val parent : 'a t -> 'a t option
  val id : 'a t -> int
  val name_opt : 'a t -> string option
  module Fields :
    sig
      val names : string list
      val someone_is_listening : ('a t, bool) Fieldslib.Field.t
      val has_seen_error : ('a t, bool) Fieldslib.Field.t
      val errors :
        ('execution_context t, (exn, 'execution_context) Tail.t)
        Fieldslib.Field.t
      val parent :
        ('execution_context t, 'execution_context t option) Fieldslib.Field.t
      val id : ('a t, int) Fieldslib.Field.t
      val name_opt : ('a t, string option) Fieldslib.Field.t
      val make_creator :
        name_opt:(('a t, string option) Fieldslib.Field.t ->
                  '-> ('-> string option) * 'd) ->
        id:(('e t, int) Fieldslib.Field.t -> '-> ('-> int) * 'f) ->
        parent:(('g t, 'g t option) Fieldslib.Field.t ->
                '-> ('-> 'h t option) * 'i) ->
        errors:(('j t, (exn, 'j) Tail.t) Fieldslib.Field.t ->
                '-> ('-> (exn, 'h) Tail.t) * 'k) ->
        has_seen_error:(('l t, bool) Fieldslib.Field.t ->
                        '-> ('-> bool) * 'm) ->
        someone_is_listening:(('n t, bool) Fieldslib.Field.t ->
                              '-> ('-> bool) * 'o) ->
        '-> ('-> 'h t) * 'o
      val create :
        name_opt:string option ->
        id:int ->
        parent:'a t option ->
        errors:(exn, 'a) Tail.t ->
        has_seen_error:bool -> someone_is_listening:bool -> 'a t
      val iter :
        name_opt:(('a t, string option) Fieldslib.Field.t -> unit) ->
        id:(('b t, int) Fieldslib.Field.t -> unit) ->
        parent:(('c t, 'c t option) Fieldslib.Field.t -> unit) ->
        errors:(('d t, (exn, 'd) Tail.t) Fieldslib.Field.t -> unit) ->
        has_seen_error:(('e t, bool) Fieldslib.Field.t -> unit) ->
        someone_is_listening:(('f t, bool) Fieldslib.Field.t -> 'g) -> 'g
      val fold :
        init:'->
        name_opt:('-> ('b t, string option) Fieldslib.Field.t -> 'c) ->
        id:('-> ('d t, int) Fieldslib.Field.t -> 'e) ->
        parent:('-> ('f t, 'f t option) Fieldslib.Field.t -> 'g) ->
        errors:('-> ('h t, (exn, 'h) Tail.t) Fieldslib.Field.t -> 'i) ->
        has_seen_error:('-> ('j t, bool) Fieldslib.Field.t -> 'k) ->
        someone_is_listening:('-> ('l t, bool) Fieldslib.Field.t -> 'm) ->
        'm
      val map :
        name_opt:(('a t, string option) Fieldslib.Field.t -> string option) ->
        id:(('b t, int) Fieldslib.Field.t -> int) ->
        parent:(('c t, 'c t option) Fieldslib.Field.t -> 'd t option) ->
        errors:(('e t, (exn, 'e) Tail.t) Fieldslib.Field.t ->
                (exn, 'd) Tail.t) ->
        has_seen_error:(('f t, bool) Fieldslib.Field.t -> bool) ->
        someone_is_listening:(('g t, bool) Fieldslib.Field.t -> bool) -> 'd t
      val map_poly : ('a t, 'b) Fieldslib.Field.user -> 'b list
      val for_all :
        name_opt:(('a t, string option) Fieldslib.Field.t -> bool) ->
        id:(('b t, int) Fieldslib.Field.t -> bool) ->
        parent:(('c t, 'c t option) Fieldslib.Field.t -> bool) ->
        errors:(('d t, (exn, 'd) Tail.t) Fieldslib.Field.t -> bool) ->
        has_seen_error:(('e t, bool) Fieldslib.Field.t -> bool) ->
        someone_is_listening:(('f t, bool) Fieldslib.Field.t -> bool) -> bool
      val exists :
        name_opt:(('a t, string option) Fieldslib.Field.t -> bool) ->
        id:(('b t, int) Fieldslib.Field.t -> bool) ->
        parent:(('c t, 'c t option) Fieldslib.Field.t -> bool) ->
        errors:(('d t, (exn, 'd) Tail.t) Fieldslib.Field.t -> bool) ->
        has_seen_error:(('e t, bool) Fieldslib.Field.t -> bool) ->
        someone_is_listening:(('f t, bool) Fieldslib.Field.t -> bool) -> bool
      val to_list :
        name_opt:(('a t, string option) Fieldslib.Field.t -> 'b) ->
        id:(('c t, int) Fieldslib.Field.t -> 'b) ->
        parent:(('d t, 'd t option) Fieldslib.Field.t -> 'b) ->
        errors:(('e t, (exn, 'e) Tail.t) Fieldslib.Field.t -> 'b) ->
        has_seen_error:(('f t, bool) Fieldslib.Field.t -> 'b) ->
        someone_is_listening:(('g t, bool) Fieldslib.Field.t -> 'b) ->
        'b list
      module Direct :
        sig
          val iter :
            'a t ->
            name_opt:(('b t, string option) Fieldslib.Field.t ->
                      'a t -> string option -> unit) ->
            id:(('c t, int) Fieldslib.Field.t -> 'a t -> int -> unit) ->
            parent:(('d t, 'd t option) Fieldslib.Field.t ->
                    'a t -> 'a t option -> unit) ->
            errors:(('e t, (exn, 'e) Tail.t) Fieldslib.Field.t ->
                    'a t -> (exn, 'a) Tail.t -> unit) ->
            has_seen_error:(('f t, bool) Fieldslib.Field.t ->
                            'a t -> bool -> unit) ->
            someone_is_listening:(('g t, bool) Fieldslib.Field.t ->
                                  'a t -> bool -> 'h) ->
            'h
          val fold :
            'a t ->
            init:'->
            name_opt:('->
                      ('c t, string option) Fieldslib.Field.t ->
                      'a t -> string option -> 'd) ->
            id:('-> ('e t, int) Fieldslib.Field.t -> 'a t -> int -> 'f) ->
            parent:('->
                    ('g t, 'g t option) Fieldslib.Field.t ->
                    'a t -> 'a t option -> 'h) ->
            errors:('->
                    ('i t, (exn, 'i) Tail.t) Fieldslib.Field.t ->
                    'a t -> (exn, 'a) Tail.t -> 'j) ->
            has_seen_error:('->
                            ('k t, bool) Fieldslib.Field.t ->
                            'a t -> bool -> 'l) ->
            someone_is_listening:('->
                                  ('m t, bool) Fieldslib.Field.t ->
                                  'a t -> bool -> 'n) ->
            'n
        end
    end
  val bogus : unit -> 'a t
  module Pretty :
    sig
      type one =
        Raw_monitor.Pretty.one = {
        name_opt : string option;
        id : int;
        has_seen_error : bool;
        someone_is_listening : bool;
      }
      val sexp_of_one : one -> Sexplib.Sexp.t
      type t = one list
      val sexp_of_t : t -> Sexplib.Sexp.t
    end
  val to_pretty : 'a t -> Pretty.one Core.Std.List.t
  val sexp_of_t : '-> 'b t -> Sexplib.Sexp.t
  exception Shutdown
  val ounit_tests : unit -> OUnit.test
end