diff options
author | Arnaud Spiwack <arnaud@spiwack.net> | 2014-08-05 15:51:16 +0200 |
---|---|---|
committer | Arnaud Spiwack <arnaud@spiwack.net> | 2014-08-05 16:52:14 +0200 |
commit | 664b3cba1e8d326382ca981aa49fdf00edd429e6 (patch) | |
tree | 462c7a7e2cc4c0becb5259feb1c25ca10bcdd5c9 /tactics/tacinterp.ml | |
parent | 1624735620d7e375a124231fea94648eac0da342 (diff) |
Tactics: [tclENV] is now sensitive to [Proofview.Goal.enter].
When "entering" in a goal, the environment observed by [tclENV] is changed (in the scope of the goal) to be that of the goal.
I'm not entirely sure it is the right semantics. But it allows to write tactics which are agnostic of whether they are run in a goal or not.
Diffstat (limited to 'tactics/tacinterp.ml')
-rw-r--r-- | tactics/tacinterp.ml | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tactics/tacinterp.ml b/tactics/tacinterp.ml index 1f53e19c3..dea543958 100644 --- a/tactics/tacinterp.ml +++ b/tactics/tacinterp.ml @@ -978,11 +978,23 @@ struct let enter f = bind (Proofview.Goal.goals >>= fun l -> Proofview.tclUNIT (Depends l)) - (fun gl -> Proofview.V82.wrap_exceptions (fun () -> f gl)) + (fun gl -> + (* the global environment of the tactic is changed to that of + the goal *) + Proofview.tclIN_ENV (Proofview.Goal.env gl) ( + Proofview.V82.wrap_exceptions (fun () -> f gl) + ) + ) let raw_enter f = bind (Proofview.Goal.raw_goals >>= fun l -> Proofview.tclUNIT (Depends l)) - (fun gl -> Proofview.V82.wrap_exceptions (fun () -> f gl)) + (fun gl -> + (* the global environment of the tactic is changed to that of + the goal *) + Proofview.tclIN_ENV (Proofview.Goal.env gl) ( + Proofview.V82.wrap_exceptions (fun () -> f gl) + ) + ) let lift (type a) (t:a Proofview.tactic) : a t = Proofview.tclBIND t (fun x -> Proofview.tclUNIT (Uniform x)) |