Skip to content

Commit 7fc2598

Browse files
authored
Merge pull request #961 from SkySkimmer/genarg-correct-typ
Adapt to rocq-prover/rocq#21655 (genarg interp must be at 'top type)
2 parents 0f6525e + f6a5107 commit 7fc2598

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/rocq_elpi_arg_HOAS.ml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -667,21 +667,23 @@ let subst mod_subst = function
667667
| LTacTactic t ->
668668
LTacTactic (Ltac_plugin.Tacsubst.subst_tactic mod_subst t)
669669

670-
let interp return ist = function
671-
| Int _ as x -> return x
672-
| String _ as x -> return x
673-
| Term t -> return @@ Term(ist,t)
674-
| OpenTerm t -> return @@ OpenTerm(ist,t)
670+
let interp ist = function
671+
| Int _ as x -> x
672+
| String _ as x -> x
673+
| Term t -> Term(ist,t)
674+
| OpenTerm t -> OpenTerm(ist,t)
675675
| LTac(ty,v) ->
676676
let id =
677677
match DAst.get v with
678678
| Glob_term.GVar id -> id
679679
| _ -> assert false in
680-
return @@ LTac(ty,(ist,id))
681-
| LTacTactic t -> return @@ LTacTactic (Ltac_plugin.Tacinterp.Value.of_closure ist t)
680+
LTac(ty,(ist,id))
681+
| LTacTactic t -> LTacTactic (Ltac_plugin.Tacinterp.Value.of_closure ist t)
682682

683683
[%%if coq = "9.0" || coq = "9.1" || coq = "9.2"]
684-
let register_interp0 wit f = Geninterp.register_interp0 wit f
684+
let register_interp0 wit f = Geninterp.register_interp0 wit (fun ist x ->
685+
Ftactic.bind (f ist x) @@ fun v ->
686+
Ftactic.return (Geninterp.Val.inject (Geninterp.val_tag (Topwit wit)) v))
685687
let freturn = Ftactic.return
686688
[%%else]
687689
let register_interp0 wit f = Ltac_plugin.Tacinterp.Register.register_interp0 wit f
@@ -693,7 +695,7 @@ let add_genarg tag pr_raw pr_glob pr_top glob subst interp =
693695
let tag = Geninterp.Val.create tag in
694696
let () = Genintern.register_intern0 wit glob in
695697
let () = Gensubst.register_subst0 wit subst in
696-
let () = register_interp0 wit (interp (fun x -> freturn @@ Geninterp.Val.Dyn (tag, x))) in
698+
let () = register_interp0 wit interp in
697699
let () = Geninterp.register_val0 wit (Some (Geninterp.Val.Base tag)) in
698700
Ltac_plugin.Pptactic.declare_extra_genarg_pprule wit pr_raw pr_glob pr_top;
699701
wit
@@ -705,7 +707,7 @@ let wit = add_genarg "elpi_ftactic_arg"
705707
(fun env sigma _ _ _ -> pp_top env sigma)
706708
glob
707709
subst
708-
interp
710+
(fun ist x -> freturn (interp ist x))
709711

710712
end
711713

0 commit comments

Comments
 (0)