From e93a458009024c717d6798e8f2d0992270707179 Mon Sep 17 00:00:00 2001 From: Sebastian Willenbrink Date: Sat, 5 Mar 2022 11:11:34 +0100 Subject: [PATCH 1/2] Use raise_with_backtrace instead of raise --- src/ppx_effects_runtime.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ppx_effects_runtime.ml b/src/ppx_effects_runtime.ml index f667b48..8f434af 100644 --- a/src/ppx_effects_runtime.ml +++ b/src/ppx_effects_runtime.ml @@ -1,7 +1,9 @@ (** These functions are exported for use by the [ppx_effects] PPX. They are not intended to be called directly by users. *) -let raise = Stdlib.raise +let raise e = + let bt = Printexc.get_raw_backtrace () in + Printexc.raise_with_backtrace e bt open Stdlib.Effect.Deep From 2cff2fc7481b721f8204f998857465ecf4590b0d Mon Sep 17 00:00:00 2001 From: Sebastian Willenbrink Date: Tue, 25 Apr 2023 14:06:18 +0200 Subject: [PATCH 2/2] Fix minor issue Where did it come from? Is that a change in 5.0.0 beta1 -> 5.0.0? --- dune-project | 4 ++-- ppx_effects.opam | 2 +- src/ppx_effects.ml | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dune-project b/dune-project index 26d48e3..7860399 100644 --- a/dune-project +++ b/dune-project @@ -13,5 +13,5 @@ (description "PPX syntax for untyped effects in OCaml 5.0") (documentation "https://craigfe.github.io/ppx-effects") (depends - (ocaml-variants (= 4.12.0+domains)) - (ppxlib (and (>= 0.12.0))))) \ No newline at end of file + (ocaml-base-compiler (>= 5.0)) + (ppxlib (and (>= 0.12.0))))) diff --git a/ppx_effects.opam b/ppx_effects.opam index e5f5abc..4c9909c 100644 --- a/ppx_effects.opam +++ b/ppx_effects.opam @@ -10,7 +10,7 @@ doc: "https://craigfe.github.io/ppx-effects" bug-reports: "https://github.com/CraigFe/ppx_effects/issues" depends: [ "dune" {>= "2.9"} - "ocaml-variants" {= "4.12.0+domains"} + "ocaml-base-compiler" {>= "5.0"} "ppxlib" {>= "0.12.0"} "odoc" {with-doc} ] diff --git a/src/ppx_effects.ml b/src/ppx_effects.ml index 2919d19..b7041a5 100644 --- a/src/ppx_effects.ml +++ b/src/ppx_effects.ml @@ -80,7 +80,7 @@ module Cases = struct ppat_desc = Ppat_construct ( effect, - Some ([], { ppat_desc = Ppat_var { txt = "k"; _ }; _ }) ); + Some { ppat_desc = Ppat_var { txt = "k"; _ }; _ } ); _; } -> raise_errorf ~loc "%s.@,Hint: did you mean %a?" error_prefix @@ -284,13 +284,13 @@ let impl : structure -> structure = let effect_decl_of_exn_decl ~loc (exn : type_exception) : type_extension = let name = exn.ptyexn_constructor.pext_name in let eff_type = Located.lident ~loc "Stdlib.Effect.t" in - let constrs, v, args = + let constrs, args = match exn.ptyexn_constructor.pext_kind with - | Pext_decl (constrs, v, body) -> + | Pext_decl (constrs, body) -> let body = Option.map (fun typ -> ptyp_constr ~loc eff_type [ typ ]) body in - (constrs, body, v) + (constrs, body) | Pext_rebind _ -> raise_errorf ~loc "cannot process effect defined as an alias of %a." pp_quoted name.txt @@ -298,7 +298,7 @@ let effect_decl_of_exn_decl ~loc (exn : type_exception) : type_extension = let params = [ (ptyp_any ~loc, (NoVariance, NoInjectivity)) ] in type_extension ~loc ~path:eff_type ~params ~constructors: - [ extension_constructor ~loc ~name ~kind:(Pext_decl (constrs, args, v)) ] + [ extension_constructor ~loc ~name ~kind:(Pext_decl (constrs, args)) ] ~private_:Public let str_effect_decl =