Guest User

Untitled

a guest
Feb 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. module Dom (M : Map.OrderedType) :
  2. sig
  3. val domain : 'a Map.Make(M).t -> Set.Make(M).t
  4. end =
  5. struct
  6.  
  7. type 'a map = 'a Map.Make(M).t
  8. type set = Set.Make(M).t
  9.  
  10. type 'a _map =
  11. | MEmpty
  12. | MNode of 'a map * M.t * 'a * 'a map * int
  13.  
  14. type _set =
  15. | SEmpty
  16. | SNode of set * M.t * set * int
  17.  
  18. let rec domain (s : 'a map) : set = match Obj.magic s with
  19. | MEmpty -> Obj.magic SEmpty
  20. | MNode (l, k, _, r, h) ->
  21. Obj.magic (SNode (domain l, k, domain r, h))
  22.  
  23. end
Add Comment
Please, Sign In to add comment