2 * Copyright (c) 2015, Facebook, Inc.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
10 include Set.Make
(StringKey
)
12 let pp_limit ?
(max_elts
= None
) fmt sset
=
13 Format.fprintf fmt
"@[<2>{";
14 let elements = elements sset
in
17 | _
-> Format.fprintf fmt
" ");
22 | Some max_elts
when i
>= max_elts
-> ()
24 if i
> 0 then Format.fprintf fmt
";@ ";
25 Format.fprintf fmt
"%S" s
);
32 | _
-> Format.fprintf fmt
" ");
33 Format.fprintf fmt
"@,}@]"
35 let pp = pp_limit ~max_elts
:None
37 let show sset
= Format.asprintf
"%a" pp sset
41 let pp_large ?
(max_elts
= 5) fmt sset
=
42 let l = cardinal sset
in
48 "<only showing %d of %d elems: %a>"
51 (pp_limit ~max_elts
:(Some max_elts
))
54 let show_large ?
(max_elts
= 5) sset
=
55 Format.asprintf
"%a" (pp_large ~max_elts
) sset