Skip to content

Instantly share code, notes, and snippets.

@zakki
Created January 13, 2014 16:24
Show Gist options
  • Select an option

  • Save zakki/8403141 to your computer and use it in GitHub Desktop.

Select an option

Save zakki/8403141 to your computer and use it in GitHub Desktop.
open Batteries
open Deriving_Show
module Show_batSet
(O : Set.OrderedType)
(K : Show with type a = O.t)
: Show with type a = Set.Make(O).t =
Defaults(
struct
module S = Set.Make(O)
type a = S.t
let format formatter set =
Format.pp_open_box formatter 0;
Format.pp_print_string formatter "{";
S.iter (fun elt ->
Format.pp_open_box formatter 0;
K.format formatter elt;
Format.fprintf formatter ";@;";
Format.pp_close_box formatter ();
) set;
Format.pp_print_string formatter "}";
Format.pp_close_box formatter ();
end)
module IntSet = struct
include Set.Make(Int)
module Show_t = Show_batSet(Int)(Show_int)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment