diff --git a/src/fut.ml b/src/fut.ml index 54ea7aa8..0661ffa2 100644 --- a/src/fut.ml +++ b/src/fut.ml @@ -411,41 +411,14 @@ let await (fut : 'a t) : 'a = [@@@endif] -module type INFIX = sig - val ( >|= ) : 'a t -> ('a -> 'b) -> 'b t - val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t - val ( let+ ) : 'a t -> ('a -> 'b) -> 'b t - val ( and+ ) : 'a t -> 'b t -> ('a * 'b) t - val ( let* ) : 'a t -> ('a -> 'b t) -> 'b t - val ( and* ) : 'a t -> 'b t -> ('a * 'b) t -end - -module Infix_ (X : sig - val pool : Runner.t option -end) : INFIX = struct - let[@inline] ( >|= ) x f = map ?on:X.pool ~f x - let[@inline] ( >>= ) x f = bind ?on:X.pool ~f x +module Infix = struct + let[@inline] ( >|= ) x f = map ~f x + let[@inline] ( >>= ) x f = bind ~f x let ( let+ ) = ( >|= ) let ( let* ) = ( >>= ) let ( and+ ) = both let ( and* ) = both end -module Infix_local = Infix_ (struct - let pool = None -end) - -include Infix_local - -module Infix (X : sig - val pool : Runner.t -end) = -Infix_ (struct - let pool = Some X.pool -end) - -let[@inline] infix pool : (module INFIX) = - let module M = Infix (struct - let pool = pool - end) in - (module M) +include Infix +module Infix_local = Infix [@@deprecated "use Infix"] diff --git a/src/fut.mli b/src/fut.mli index 989d43a6..aa4515f5 100644 --- a/src/fut.mli +++ b/src/fut.mli @@ -209,7 +209,19 @@ val wait_block : 'a t -> 'a or_error val wait_block_exn : 'a t -> 'a (** Same as {!wait_block} but re-raises the exception if the future failed. *) -module type INFIX = sig +(** {2 Infix operators} + + These combinators run on either the current pool (if present), + or on the same thread that just fulfilled the previous future + if not. + + They were previously present as [module Infix_local] and [val infix], + but are now simplified. + + @since NEXT_RELEASE *) + +(** @since NEXT_RELEASE *) +module Infix : sig val ( >|= ) : 'a t -> ('a -> 'b) -> 'b t val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t val ( let+ ) : 'a t -> ('a -> 'b) -> 'b t @@ -218,17 +230,8 @@ module type INFIX = sig val ( and* ) : 'a t -> 'b t -> ('a * 'b) t end -module Infix_local : INFIX -(** Operators that run on the same thread as the first future. *) +include module type of Infix -include INFIX - -(** Make infix combinators, with intermediate computations running on the given pool. *) -module Infix (_ : sig - val pool : Runner.t -end) : INFIX - -val infix : Runner.t -> (module INFIX) -(** [infix runner] makes a new infix module with intermediate computations - running on the given runner.. - @since 0.2 *) +module Infix_local = Infix +[@@deprecated "Use Infix"] +(** @deprecated use Infix instead *)