aboutsummaryrefslogtreecommitdiff
path: root/lib/hMap.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2015-01-25 19:25:34 +0100
committerPierre-Marie Pédrot2015-01-25 19:25:34 +0100
commit92fda8598da9221bc24deb8b5636233b77d9c45b (patch)
tree4e89eab6dbe1dbb53e12d89dd498d96e157a1168 /lib/hMap.ml
parent8434840413d7cef32ed83539a0c7ef4de13ec528 (diff)
Equipping extended maps with fold operator defined for any monad.
Diffstat (limited to 'lib/hMap.ml')
-rw-r--r--lib/hMap.ml14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/hMap.ml b/lib/hMap.ml
index f902eded03..8e900cd581 100644
--- a/lib/hMap.ml
+++ b/lib/hMap.ml
@@ -329,4 +329,18 @@ struct
Int.Map.map fs s
end
+ module Monad(M : CMap.MonadS) =
+ struct
+ module IntM = Int.Map.Monad(M)
+ module ExtM = Map.Monad(M)
+ open M
+
+ let fold f s accu =
+ let ff _ m accu = ExtM.fold f m accu in
+ IntM.fold ff s accu
+
+ let fold_left _ _ _ = assert false
+ let fold_right _ _ _ = assert false
+ end
+
end