Re: Re: [Batteries-discuss] how to get an IntSet and a FloatSet with batteries

[email protected]
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
-[ Mon, Jan 06, 2014 at 05:54:15PM +0900, Francois Berenger ]----
> I have this currently but I feel it is too long:
> 
> module IntSet = struct
>    include Set.Make(
>      struct type t = int
>      let compare = cmp_int
>    end)
>    (* extend type with more operations *)
>    let of_list = L.fold_left (fun acc x -> add x acc) empty
>    let to_list = elements
> end

Why not use BatInt itself as the OrderedType?

module IntSet = struct
  include Set.Make(BatInt)
  (* extend type with more operations *)
  ...
end
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.