public
Created

  • Download Gist
ordered.ml
OCaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
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)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.