diff --git a/.ocamlformat b/.ocamlformat index 07e1516..543ac1b 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,3 +1,4 @@ profile = default version = 0.27.0 +ocaml-version = 5.3 break-sequences = false diff --git a/acutis.ml b/acutis.ml index d5ec931..8b29367 100644 --- a/acutis.ml +++ b/acutis.ml @@ -154,13 +154,10 @@ end = struct type _ Effect.t += Yield : a -> unit Effect.t end in let yield v = Effect.perform (M.Yield v) in - let retc () = Seq.Nil in - let effc : type b. - b Effect.t -> ((b, _) Effect.Deep.continuation -> _) option = function - | M.Yield v -> Some (fun k -> Seq.Cons (v, Effect.Deep.continue k)) - | _ -> None - in - fun () -> Effect.Deep.match_with f yield { retc; exnc = raise; effc } + fun () -> + match f yield with + | () -> Seq.Nil + | effect M.Yield v, k -> Seq.Cons (v, Effect.Deep.continue k) let iter s f = Seq.iter f s let string_to_seq = String.to_seq diff --git a/acutis.opam b/acutis.opam index 08db150..7b1d41b 100644 --- a/acutis.opam +++ b/acutis.opam @@ -16,7 +16,7 @@ doc: "https://johnridesa.bike/acutis/" bug-reports: "https://github.com/johnridesabike/acutis/issues" depends: [ "dune" {>= "3.13"} - "ocaml" {>= "5.2"} + "ocaml" {>= "5.3"} "menhir" "yojson" "dune-build-info" diff --git a/acutis_js.ml b/acutis_js.ml index f2b82e4..877a200 100644 --- a/acutis_js.ml +++ b/acutis_js.ml @@ -110,19 +110,14 @@ module Promise = struct Js.Unsafe.inject (Js.wrap_callback reject); |] - module E = Effect - module ED = Effect.Deep + type _ Effect.t += Await : 'a t -> 'a Effect.t - type _ E.t += Await : 'a t -> 'a E.t + let await p = Effect.perform (Await p) - let await p = E.perform (Await p) - - let effc : type a. a E.t -> ((a, 'b t) ED.continuation -> 'b t) option = - function - | Await p -> Some (fun k -> then_ p (ED.continue k) (ED.discontinue k)) - | _ -> None - - let handle_await f = ED.try_with f () { effc } + let handle_await f = + match f () with + | x -> x + | effect Await p, k -> Effect.Deep.(then_ p (continue k) (discontinue k)) end let fname_to_compname s = diff --git a/acutis_js.opam b/acutis_js.opam index d9a5720..20c3ded 100644 --- a/acutis_js.opam +++ b/acutis_js.opam @@ -10,7 +10,7 @@ doc: "https://johnridesa.bike/acutis/" bug-reports: "https://github.com/johnridesabike/acutis/issues" depends: [ "dune" {>= "3.13"} - "ocaml" {>= "5.0"} + "ocaml" "acutis" {= version} "js_of_ocaml" {>= "5.8.1"} "js_of_ocaml-compiler" diff --git a/dune-project b/dune-project index 22afc1f..9672bf3 100644 --- a/dune-project +++ b/dune-project @@ -29,7 +29,7 @@ compile them to self-contained JavaScript files. ") (depends (ocaml - (>= 5.2)) + (>= 5.3)) menhir yojson dune-build-info @@ -44,8 +44,7 @@ compile them to self-contained JavaScript files. (synopsis "A virtual package containing the Acutis JavaScript dependencies") (allow_empty) (depends - (ocaml - (>= 5.0)) + ocaml (acutis (= :version)) (js_of_ocaml