From 5289ccfb23cfa44c50971e05daa8735e7d5db2af Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Thu, 29 Dec 2016 04:19:00 -0800 Subject: [PATCH] Simplify Subtype.list_to_string Reviewed By: jeremydubreil Differential Revision: D4371339 fbshipit-source-id: 6c192f4 --- infer/src/IR/Subtype.re | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/infer/src/IR/Subtype.re b/infer/src/IR/Subtype.re index e67a39ea5..c5d071fc3 100644 --- a/infer/src/IR/Subtype.re +++ b/infer/src/IR/Subtype.re @@ -18,24 +18,12 @@ let module L = Logging; let module F = Format; -let list_to_string list => { - let rec aux list => - switch list { - | [] => "" - | [el, ...rest] => - let s = aux rest; - if (s == "") { - Typename.name el - } else { - Typename.name el ^ ", " ^ s - } - }; - if (IList.length list == 0) { +let list_to_string list => + if (List.length list == 0) { "( sub )" } else { - "- {" ^ aux list ^ "}" - } -}; + "- {" ^ String.concat sep::", " (List.map f::Typename.name list) ^ "}" + }; type t' = | Exact /** denotes the current type only */