spacepaste

example.ml

  1.  
  2. open Batteries
  3. module type M =
  4. sig
  5. include Map.S
  6. val filter: (key -> 'a -> bool) -> 'a t -> 'a t
  7. end
  8. module BetterMap (OM: Map.S): (M with type key = OM.key) =
  9. struct
  10. include OM
  11. let filter pred m =
  12. fold
  13. (fun k v accum ->
  14. if pred k v then
  15. add k v accum
  16. else
  17. accum)
  18. m
  19. empty
  20. end
  21. module IntMap = BetterMap(IntMap)
  22.  

error.txt

  1.  
  2. Values do not match:
  3. val filter : (key -> 'a -> bool) -> 'a t -> 'a t
  4. is not included in
  5. val filter : ('a -> bool) -> 'a t -> 'a t
  6.