aboutsummaryrefslogtreecommitdiff
path: root/pretyping
diff options
context:
space:
mode:
authorArnaud Spiwack2014-02-27 14:50:40 +0100
committerArnaud Spiwack2014-02-27 14:50:40 +0100
commit0dfc87c68d5aba5adac079cb62ae504d82b303b9 (patch)
treefb6b99101cab4609188ad74ca8684434a7d19cea /pretyping
parentd98fdf1ef5789f6d5420e52c34a33debf08584e9 (diff)
Tacinterp: refactoring using Monad.
Adds a combinator List.map_right which chains effects from right to left.
Diffstat (limited to 'pretyping')
-rw-r--r--pretyping/evd.ml13
-rw-r--r--pretyping/evd.mli3
2 files changed, 15 insertions, 1 deletions
diff --git a/pretyping/evd.ml b/pretyping/evd.ml
index c93ec3b234..d6c9a2097f 100644
--- a/pretyping/evd.ml
+++ b/pretyping/evd.ml
@@ -829,6 +829,19 @@ let sig_sig x = x.sigma
(*******************************************************************)
(* The state monad with state an evar map. *)
+module MonadR =
+ Monad.Make (struct
+
+ type +'a t = evar_map -> evar_map * 'a
+
+ let return a = fun s -> (s,a)
+
+ let (>>=) x f = fun s ->
+ let (s',a) = x s in
+ f a s'
+
+ end)
+
module Monad =
Monad.Make (struct
diff --git a/pretyping/evd.mli b/pretyping/evd.mli
index 0e65b151c4..2b0e9ca684 100644
--- a/pretyping/evd.mli
+++ b/pretyping/evd.mli
@@ -276,7 +276,8 @@ val sig_sig : 'a sigma -> evar_map
(** {5 The state monad with state an evar map} *)
-module Monad : Monad.S with type +'a t = evar_map -> 'a * evar_map
+module MonadR : Monad.S with type +'a t = evar_map -> evar_map * 'a
+module Monad : Monad.S with type +'a t = evar_map -> 'a * evar_map
(** {5 Meta machinery}