summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSon Ho2022-02-03 23:22:02 +0100
committerSon Ho2022-02-03 23:22:02 +0100
commit1b8b473bb3325713b72e12c7adfba3e024fdf194 (patch)
tree9261f14ef4a8ab629f233f16f3aad562e2d0b36d /src
parentf7f5d626745200df5748e7bda860c7d303bea18a (diff)
Make a minor improvement in printing
Diffstat (limited to '')
-rw-r--r--src/ExtractToFStar.ml16
-rw-r--r--src/PureUtils.ml1
2 files changed, 13 insertions, 4 deletions
diff --git a/src/ExtractToFStar.ml b/src/ExtractToFStar.ml
index 0781a811..7d8e84c4 100644
--- a/src/ExtractToFStar.ml
+++ b/src/ExtractToFStar.ml
@@ -961,10 +961,18 @@ let extract_fun_def (ctx : extraction_ctx) (fmt : F.formatter)
ctx def.inputs_lvs
in
(* Print the return type *)
- F.pp_print_space fmt ();
- F.pp_print_string fmt ":";
- F.pp_print_space fmt ();
- extract_ty ctx fmt false (Collections.List.to_cons_nil def.signature.outputs);
+ let _ =
+ F.pp_print_space fmt ();
+ (* Open a box for the return type *)
+ F.pp_open_hovbox fmt 0;
+ (* Print the return type *)
+ F.pp_print_string fmt ":";
+ F.pp_print_space fmt ();
+ extract_ty ctx fmt false
+ (Collections.List.to_cons_nil def.signature.outputs);
+ (* Close the box for the return type *)
+ F.pp_close_box fmt ()
+ in
(* Print the "=" *)
F.pp_print_space fmt ();
F.pp_print_string fmt "=";
diff --git a/src/PureUtils.ml b/src/PureUtils.ml
index aa383d8c..9f3bd5ef 100644
--- a/src/PureUtils.ml
+++ b/src/PureUtils.ml
@@ -186,6 +186,7 @@ let functions_not_mutually_recursive (funs : fun_def list) : bool =
(** We use this to check whether we need to add parentheses around expressions.
We only look for outer monadic let-bindings.
+ This is used when printing the branches of `if ... then ... else ...`.
*)
let rec expression_requires_parentheses (e : texpression) : bool =
match e.e with