let print output_file fct =
              let o =
                new printer ~comments: !comments ~curry_constr: !curry_constr
                  () in
              let o = if !locations then o#set_loc_and_comments else o
              in
                with_outfile output_file
                  (fun f ->
                     let () = Format.pp_set_margin f !margin
                     in Format.fprintf f "@[<v0>%a@]@." (fct o))