diff options
| author | Pierre-Marie Pédrot | 2018-05-29 11:16:32 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2018-06-24 18:20:26 +0200 |
| commit | e42b3b188b365159a60851bb0d4214068bb74dd4 (patch) | |
| tree | 2b25564a83d2999a36a74648486b4d3f4ea6d984 /proofs | |
| parent | 567b9b75309ab61130b8e08dd87275d91ed97488 (diff) | |
Share the role type between the implementations of side-effects.
We simply exploit a type isomorphism to remove the use of dedicated algebraic
types in the kernel which are actually not necessary.
Diffstat (limited to 'proofs')
| -rw-r--r-- | proofs/refine.ml | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/proofs/refine.ml b/proofs/refine.ml index b64e7a2e5e..05d5eaa9e9 100644 --- a/proofs/refine.ml +++ b/proofs/refine.ml @@ -49,17 +49,14 @@ let (pr_constrv,pr_constr) = (* Get the side-effect's constant declarations to update the monad's * environmnent *) -let add_if_undefined kn cb env = - try ignore(Environ.lookup_constant kn env); env - with Not_found -> Environ.add_constant kn cb env +let add_if_undefined env eff = + let open Entries in + try ignore(Environ.lookup_constant eff.seff_constant env); env + with Not_found -> Environ.add_constant eff.seff_constant eff.seff_body env (* Add the side effects to the monad's environment, if not already done. *) -let add_side_effect env = function - | { Entries.eff = Entries.SEsubproof (kn, cb, eff_env) } -> - add_if_undefined kn cb env - | { Entries.eff = Entries.SEscheme (l,_) } -> - List.fold_left (fun env (_,kn,cb,eff_env) -> - add_if_undefined kn cb env) env l +let add_side_effect env { Entries.eff } = + List.fold_left add_if_undefined env eff let add_side_effects env effects = List.fold_left (fun env eff -> add_side_effect env eff) env effects |
