diff options
| author | Arnaud Spiwack | 2014-02-27 14:07:43 +0100 |
|---|---|---|
| committer | Arnaud Spiwack | 2014-02-27 14:46:37 +0100 |
| commit | d98fdf1ef5789f6d5420e52c34a33debf08584e9 (patch) | |
| tree | b61a0b679df7b56ff6180924395fa5671d4c9b8f /pretyping | |
| parent | 4d6b938e90ecd9dbfb29a0af28a7d8b6a657ae17 (diff) | |
Code refactoring thanks to the new Monad module.
Diffstat (limited to 'pretyping')
| -rw-r--r-- | pretyping/evd.ml | 16 | ||||
| -rw-r--r-- | pretyping/evd.mli | 4 |
2 files changed, 20 insertions, 0 deletions
diff --git a/pretyping/evd.ml b/pretyping/evd.ml index 0e53ff1318..c93ec3b234 100644 --- a/pretyping/evd.ml +++ b/pretyping/evd.ml @@ -826,6 +826,22 @@ type 'a sigma = { let sig_it x = x.it let sig_sig x = x.sigma +(*******************************************************************) +(* The state monad with state an evar map. *) + +module Monad = + Monad.Make (struct + + type +'a t = evar_map -> 'a * evar_map + + let return a = fun s -> (a,s) + + let (>>=) x f = fun s -> + let (a,s') = x s in + f a s' + + end) + (**********************************************************) (* Failure explanation *) diff --git a/pretyping/evd.mli b/pretyping/evd.mli index 58e4cd630b..0e65b151c4 100644 --- a/pretyping/evd.mli +++ b/pretyping/evd.mli @@ -274,6 +274,10 @@ type 'a sigma = { val sig_it : 'a sigma -> 'a 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 + (** {5 Meta machinery} These functions are almost deprecated. They were used before the |
