Skip to content

Commit

Permalink
Goptions.declare_* functions return unit instead of a write_function
Browse files Browse the repository at this point in the history
Returning a writer insinuates that it is not exactly the same as the
writer which was passed as argument, but that is incorrect.
  • Loading branch information
SkySkimmer committed Nov 23, 2018
1 parent 8fb0156 commit 99d129b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
5 changes: 1 addition & 4 deletions library/goptions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,7 @@ let declare_option cast uncast append ?(preprocess = fun x -> x)
let cread () = cast (read ()) in
let cwrite l v = warn (); change l OptSet (uncast v) in
let cappend l v = warn (); change l OptAppend (uncast v) in
value_tab := OptionMap.add key (name, depr, (cread,cwrite,cappend)) !value_tab;
write
type 'a write_function = 'a -> unit
value_tab := OptionMap.add key (name, depr, (cread,cwrite,cappend)) !value_tab
let declare_int_option =
declare_option
Expand Down
10 changes: 4 additions & 6 deletions library/goptions.mli
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,14 @@ type 'a option_sig = {
(** The [preprocess] function is triggered before setting the option. It can be
used to emit a warning on certain values, and clean-up the final value. *)

type 'a write_function = 'a -> unit

val declare_int_option : ?preprocess:(int option -> int option) ->
int option option_sig -> int option write_function
int option option_sig -> unit
val declare_bool_option : ?preprocess:(bool -> bool) ->
bool option_sig -> bool write_function
bool option_sig -> unit
val declare_string_option: ?preprocess:(string -> string) ->
string option_sig -> string write_function
string option_sig -> unit
val declare_stringopt_option: ?preprocess:(string option -> string option) ->
string option option_sig -> string option write_function
string option option_sig -> unit


(** {6 Special functions supposed to be used only in vernacentries.ml } *)
Expand Down
4 changes: 2 additions & 2 deletions tactics/class_tactics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ let _ =
optread = get_typeclasses_filtered_unification;
optwrite = set_typeclasses_filtered_unification; }

let set_typeclasses_debug =
let _ =
declare_bool_option
{ optdepr = false;
optname = "debug output for typeclasses proof search";
Expand All @@ -137,7 +137,7 @@ let _ =
optread = get_typeclasses_verbose;
optwrite = set_typeclasses_verbose; }

let set_typeclasses_depth =
let _ =
declare_int_option
{ optdepr = false;
optname = "depth for typeclasses proof search";
Expand Down

0 comments on commit 99d129b

Please sign in to comment.