Skip to content

Instantly share code, notes, and snippets.

Created October 28, 2017 18:42
Show Gist options
  • Save anonymous/152ed805fe7fda5ce3a8911d3554c64c to your computer and use it in GitHub Desktop.
Save anonymous/152ed805fe7fda5ce3a8911d3554c64c to your computer and use it in GitHub Desktop.
Ocaml extending Map
module type S = sig
type key
type atom
type t
val f: t -> t -> t
val a: atom -> t -> t * t
end
(* I would like Make to have a partial signature of S *)
module Make (Key: OrderedType) (Atom: Atomic) (* : S *) = struct
module Base = Map.Make(Key)
type key = Key.t
type atom = Atom.t
type t = atom Base.t
include Base
(* Extending map basing on Map 'a t = Atom.t t *)
let f = ...
let a = ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment