Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -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)))))
(ocaml-base-compiler (>= 5.0))
(ppxlib (and (>= 0.12.0)))))
2 changes: 1 addition & 1 deletion ppx_effects.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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}
]
Expand Down
10 changes: 5 additions & 5 deletions src/ppx_effects.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -284,21 +284,21 @@ 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
in
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 =
Expand Down
4 changes: 3 additions & 1 deletion src/ppx_effects_runtime.ml
Original file line number Diff line number Diff line change
@@ -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

Expand Down