Skip to content

Commit

Permalink
reformat interface
Browse files Browse the repository at this point in the history
  • Loading branch information
d-kalinichenko committed Jan 25, 2025
1 parent 2a288ed commit 454b9d9
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions otherlibs/stdlib_alpha/effect.mli
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
val continue :
('a, 'b, 'es) Continuation.t
-> 'a
-> local_ 'es Handler.List.t
-> 'es Handler.List.t @ local
-> 'b
(** [continue k v hs] resumes the continuation [k] with value [v]. [hs] are
used to handle [k]'s additional effects.
Expand All @@ -81,7 +81,7 @@
val discontinue :
('a, 'b, 'es) Continuation.t
-> exn
-> local_ 'es Handler.List.t
-> 'es Handler.List.t @ local
-> 'b
(** [discontinue k e hs] resumes the continuation [k] by raising the
exception [e]. [hs] are used to handle [k]'s additional effects.
Expand All @@ -91,10 +91,10 @@
*)

val discontinue_with_backtrace :
('a,'b, 'es) Continuation.t
('a, 'b, 'es) Continuation.t
-> exn
-> Printexc.raw_backtrace
-> local_ 'es Handler.List.t
-> 'es Handler.List.t @ local
-> 'b
(** [discontinue_with k e bt hs] resumes the continuation [k] by raising the
exception [e] using the raw backtrace [bt] as the origin of the exception.
Expand Down Expand Up @@ -162,10 +162,10 @@
type eff := t

type ('a, 'es) t =
| Value : global_ 'a -> ('a, 'es) t
| Exception : global_ exn -> ('a, 'es) t
| Value : 'a @@ global -> ('a, 'es) t
| Exception : exn @@ global -> ('a, 'es) t
| Operation :
global_ ('o, eff) ops
('o, eff) ops @@ global
* ('o, ('a, 'es) t, 'es) Continuation.t -> ('a, 'es) t
(** [('a, 'es) t] is the result of running a continuation until it
either finishes and returns an ['a] value, raises an exception, or
Expand All @@ -185,15 +185,15 @@
end

type ('a, 'es) result = ('a, 'es) Result.t =
| Value : global_ 'a -> ('a, 'es) result
| Exception : global_ exn -> ('a, 'es) result
| Value : 'a @@ global -> ('a, 'es) result
| Exception : exn @@ global -> ('a, 'es) result
| Operation :
global_ ('o, t) ops
('o, t) ops @@ global
* ('o, ('a, 'es) result, 'es) Continuation.t
-> ('a, 'es) result

val fiber :
(local_ t Handler.t -> 'a -> 'b)
(t Handler.t @ local -> 'a -> 'b)
-> ('a, ('b, unit) Result.t, unit) Continuation.t
(** [fiber f] constructs a continuation that runs the computation [f]. [f]
is passed a [t Handler.t] so that it can perform operations from effect
Expand All @@ -208,15 +208,15 @@
[t]. *)

val fiber_with :
local_ 'es Handler.List.Length.t
-> (local_ (t * 'es) Handler.List.t -> 'a -> 'b)
'es Handler.List.Length.t @ local
-> ((t * 'es) Handler.List.t @ local -> 'a -> 'b)
-> ('a, ('b, 'es) Result.t, 'es) Continuation.t
(** [fiber_with l f] constructs a continuation that runs the computation [f],
which requires handlers for [l] additional effects. [f] is passed a typed
list of handlers so that it can perform operations from effect [t] as
well as from the additional effects ['es]. *)

val run : (local_ t Handler.t -> 'a) -> ('a, unit) Result.t
val run : (t Handler.t @ local -> 'a) -> ('a, unit) Result.t
(** [run f] constructs a continuation that runs the computation [f], and
immediately continues it. [f] is passed a [t Handler.t] so that it can
perform operations from effect [t]. *)
Expand All @@ -230,15 +230,15 @@
so that it can perform operations from effect [t]. *)

val run_with :
local_ 'es Handler.List.t
-> (local_ (t * 'es) Handler.List.t -> 'a)
'es Handler.List.t @ local
-> ((t * 'es) Handler.List.t @ local -> 'a)
-> ('a, 'es) Result.t
(** [run_with hs f] constructs a continuation that runs the computation [f],
and immediately continues it with handlers [hs]. [f] is passed a typed list
of handlers so that it can perform operations from effect [t] as well as
from the additional effects ['es].*)

val perform : local_ t Handler.t -> ('a, t) ops -> 'a
val perform : t Handler.t @ local -> ('a, t) ops -> 'a
(** [perform h e] performs an effect [e] at the handler [h] *)

module Handler : sig
Expand Down Expand Up @@ -279,10 +279,10 @@
type 'p eff := 'p t

type ('a, 'p, 'es) t =
| Value : global_ 'a -> ('a, 'p, 'es) t
| Exception : global_ exn -> ('a, 'p, 'es) t
| Value : 'a @@ global -> ('a, 'p, 'es) t
| Exception : exn @@ global -> ('a, 'p, 'es) t
| Operation :
global_ ('o, 'p, 'p eff) ops
('o, 'p, 'p eff) ops @@ global
* ('o, ('a, 'p, 'es) t, 'es) Continuation.t
-> ('a, 'p, 'es) t
(** [('a, 'p, 'es) t] is the result of running a continuation until it
Expand All @@ -303,15 +303,15 @@
end

type ('a, 'p, 'es) result = ('a, 'p, 'es) Result.t =
| Value : global_ 'a -> ('a, 'p, 'es) result
| Exception : global_ exn -> ('a, 'p, 'es) result
| Value : 'a @@ global -> ('a, 'p, 'es) result
| Exception : exn @@ global -> ('a, 'p, 'es) result
| Operation :
global_ ('o, 'p, 'p t) ops
('o, 'p, 'p t) ops @@ global
* ('o, ('a, 'p, 'es) result, 'es) Continuation.t
-> ('a, 'p, 'es) result

val fiber :
(local_ 'p t Handler.t -> 'a -> 'b)
('p t Handler.t @ local -> 'a -> 'b)
-> ('a, ('b, 'p, unit) Result.t, unit) Continuation.t
(** [fiber f] constructs a continuation that runs the computation [f]. [f]
is passed a [t Handler.t] so that it can perform operations from effect
Expand All @@ -326,15 +326,15 @@
perform operations from effect [t]. *)

val fiber_with :
local_ 'es Handler.List.Length.t
-> (local_ ('p t * 'es) Handler.List.t -> 'a -> 'b)
'es Handler.List.Length.t @ local
-> (('p t * 'es) Handler.List.t @ local -> 'a -> 'b)
-> ('a, ('b, 'p, 'es) Result.t, 'es) Continuation.t
(** [fiber_with l f] constructs a continuation that runs the computation [f],
which requires handlers for [l] additional effects. [f] is passed a typed
list of handlers so that it can perform operations from effect [t] as
well as from the additional effects ['es]. *)

val run : (local_ 'p t Handler.t -> 'a) -> ('a, 'p, unit) Result.t
val run : ('p t Handler.t @ local -> 'a) -> ('a, 'p, unit) Result.t
(** [run f] constructs a continuation that runs the computation [f], and
immediately continues it. *)

Expand All @@ -346,13 +346,13 @@
[f], and immediately continues it. *)

val run_with :
local_ 'es Handler.List.t
-> (local_ ('p t * 'es) Handler.List.t -> 'a)
'es Handler.List.t @ local
-> (('p t * 'es) Handler.List.t @ local -> 'a)
-> ('a, 'p, 'es) Result.t
(** [run_with hs f] constructs a continuation that runs the computation [f],
and immediately continues it with handlers [hs]. *)

val perform : local_ 'p t Handler.t -> ('a, 'p, 'p t) ops -> 'a
val perform : 'p t Handler.t @ local -> ('a, 'p, 'p t) ops -> 'a
(** [perform h e] performs an effect [e] at the handler [h] *)

module Handler : sig
Expand Down Expand Up @@ -387,10 +387,10 @@
type ('p, 'q) eff := ('p, 'q) t

type ('a, 'p, 'q, 'es) t =
| Value : global_ 'a -> ('a, 'p, 'q, 'es) t
| Exception : global_ exn -> ('a, 'p, 'q, 'es) t
| Value : 'a @@ global -> ('a, 'p, 'q, 'es) t
| Exception : exn @@ global -> ('a, 'p, 'q, 'es) t
| Operation :
global_ ('o, 'p, 'q, ('p, 'q) eff) ops
('o, 'p, 'q, ('p, 'q) eff) ops @@ global
* ('o, ('a, 'p, 'q, 'es) t, 'es) Continuation.t
-> ('a, 'p, 'q, 'es) t
(** [('a, 'p, 'q, 'es) t] is the result of running a continuation until
Expand All @@ -411,15 +411,15 @@
end

type ('a, 'p, 'q, 'es) result = ('a, 'p, 'q, 'es) Result.t =
| Value : global_ 'a -> ('a, 'p, 'q, 'es) result
| Exception : global_ exn -> ('a, 'p, 'q, 'es) result
| Value : 'a @@ global -> ('a, 'p, 'q, 'es) result
| Exception : exn @@ global -> ('a, 'p, 'q, 'es) result
| Operation :
global_ ('o, 'p, 'q, ('p, 'q) t) ops
('o, 'p, 'q, ('p, 'q) t) ops @@ global
* ('o, ('a, 'p, 'q, 'es) result, 'es) Continuation.t
-> ('a, 'p, 'q, 'es) result

val fiber :
(local_ ('p, 'q) t Handler.t -> 'a -> 'b)
(('p, 'q) t Handler.t @ local -> 'a -> 'b)
-> ('a, ('b, 'p, 'q, unit) Result.t, unit) Continuation.t
(** [fiber f] constructs a continuation that runs the computation [f]. [f]
is passed a [t Handler.t] so that it can perform operations from effect
Expand All @@ -434,16 +434,16 @@
perform operations from effect [t]. *)

val fiber_with :
local_ 'es Handler.List.Length.t
-> (local_ (('p, 'q) t * 'es) Handler.List.t -> 'a -> 'b)
'es Handler.List.Length.t @ local
-> ((('p, 'q) t * 'es) Handler.List.t @ local -> 'a -> 'b)
-> ('a, ('b, 'p, 'q, 'es) Result.t, 'es) Continuation.t
(** [fiber_with l f] constructs a continuation that runs the computation [f],
which requires handlers for [l] additional effects. [f] is passed a typed
list of handlers so that it can perform operations from effect [t] as
well as from the additional effects ['es]. *)

val run :
(local_ ('p, 'q) t Handler.t -> 'a)
(('p, 'q) t Handler.t @ local -> 'a)
-> ('a, 'p, 'q, unit) Result.t
(** [run f] constructs a continuation that runs the computation [f], and
immediately continues it. *)
Expand All @@ -456,14 +456,14 @@
[f], and immediately continues it. *)

val run_with :
local_ 'es Handler.List.t
-> (local_ (('p, 'q) t * 'es) Handler.List.t -> 'a)
'es Handler.List.t @ local
-> ((('p, 'q) t * 'es) Handler.List.t @ local -> 'a)
-> ('a, 'p, 'q, 'es) Result.t
(** [run_with hs f] constructs a continuation that runs the computation [f],
and immediately continues it with handlers [hs]. *)

val perform :
local_ ('p, 'q) t Handler.t
('p, 'q) t Handler.t @ local
-> ('a, 'p, 'q, ('p, 'q) t) ops
-> 'a
(** [perform h e] performs an effect [e] at the handler [h] *)
Expand Down

0 comments on commit 454b9d9

Please sign in to comment.