[sledge] Use more standard interface for Trace.parse

Summary:
`('a, exn) result` is a more widely used type than with something
custom in place of `exn`, e.g. by the `Result` operations.

Reviewed By: mbouaziz

Differential Revision: D14322627

fbshipit-source-id: e2ed167ed
master
Josh Berdine 6 years ago committed by Facebook Github Bot
parent 264a97794d
commit 89e2e30fb2

@ -8,6 +8,10 @@
(** Configuration options *)
let trace_conv =
let parse s =
Trace.parse s
|> Result.map_error ~f:(fun _ -> `Msg ("Invalid trace spec: " ^ s))
in
let print fs {trace_all; trace_mods_funs} =
let pf fmt = Format.fprintf fs fmt in
if trace_all then pf "*"
@ -22,7 +26,7 @@ let trace_conv =
if fun_enabled then pf "+%s.%s" mod_name fun_name
else pf "-%s.%s" mod_name fun_name ) )
in
(Trace.parse, print)
(parse, print)
type t =
{ compile_only: bool

@ -75,7 +75,7 @@ let parse s =
~data:{trace_mod= Some enabled; trace_funs= default} )
in
Ok {none with trace_mods_funs}
with Assert_failure _ -> Error (`Msg ("Invalid trace spec: " ^ s))
with Assert_failure _ as exn -> Error exn
let init ?(margin = 300) ~config:c () =
Format.set_margin margin ;

@ -23,7 +23,7 @@ type config =
val none : config
val all : config
val parse : string -> (config, [> `Msg of string]) result
val parse : string -> (config, exn) result
val init : ?margin:int -> config:config -> unit -> unit
(** Initialize the configuration of debug tracing. *)

Loading…
Cancel
Save