summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSon Ho2022-01-27 12:40:22 +0100
committerSon Ho2022-01-27 12:40:22 +0100
commitddd6c830ea4a3a1219e17ce3536100fe46f48223 (patch)
treee776bf79c1acc42cc977f7540e6f656e2920e084 /src
parentb9390f77ef2bfdce6c7d731294f1cfd5d073b63f (diff)
Implement inst_fun_sig_to_string
Diffstat (limited to 'src')
-rw-r--r--src/PrintPure.ml13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/PrintPure.ml b/src/PrintPure.ml
index 8e19238c..8d07e5b1 100644
--- a/src/PrintPure.ml
+++ b/src/PrintPure.ml
@@ -264,3 +264,16 @@ let fun_sig_to_string (fmt : ast_formatter) (sg : fun_sig) : string =
in
let all_types = List.concat [ type_params; inputs; [ outputs ] ] in
String.concat " -> " all_types
+
+let inst_fun_sig_to_string (fmt : ast_formatter) (sg : inst_fun_sig) : string =
+ let ty_fmt = ast_to_type_formatter fmt in
+ let inputs = List.map (ty_to_string ty_fmt) sg.inputs in
+ let outputs = List.map (ty_to_string ty_fmt) sg.outputs in
+ let outputs =
+ match outputs with
+ | [] -> "()"
+ | [ out ] -> out
+ | outputs -> "(" ^ String.concat " * " outputs ^ ")"
+ in
+ let all_types = List.append inputs [ outputs ] in
+ String.concat " -> " all_types