Re: Re: [Batteries-discuss] how to get an IntSet and a FloatSet with batteries
| 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