Skip to content

Instantly share code, notes, and snippets.

@tianyicui
Created November 9, 2012 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tianyicui/4044467 to your computer and use it in GitHub Desktop.
Save tianyicui/4044467 to your computer and use it in GitHub Desktop.
module type ORDERED =
sig
type t
val compare : t -> t -> int
end
module type HEAP =
sig
module Elem : ORDERED
type heap
end
module MakeH (Element : ORDERED) : (HEAP with module Elem = Element) =
struct
module Elem = Element
type heap
end
module rec BootstrappedElem :
sig
type t = E | T of PrimH.heap
val compare : t -> t -> int
end =
struct
type t = E | T of PrimH.heap
let compare t1 t2 = Pervasives.compare t1 t2
end
and PrimH : (HEAP with module Elem = BootstrappedElem) =
MakeH(BootstrappedElem)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment