Created
February 7, 2017 15:57
-
-
Save Octachron/f20e5d1a625da349dd52e08295d809fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module type s = sig | |
type 'a t | |
val hash : 'a t -> int | |
val equal : 'a t -> 'a t -> bool | |
end | |
module Id: s = struct | |
type 'a t = { | |
id : int; | |
contents : 'a; | |
} | |
let hash { id; _ } = id | |
let equal a b = a.id = b.id | |
end | |
module Spec(T:sig type t end) = | |
struct | |
type 'a aux = T.t Id.t | |
type t = T.t aux | |
include (Id: s with type 'a t := 'a aux) | |
end | |
module H = Hashtbl.Make(Spec(struct type t = int end)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment