diff --git a/src/string_with_vars.ml b/src/string_with_vars.ml index 4a788f25..6237ac5e 100644 --- a/src/string_with_vars.ml +++ b/src/string_with_vars.ml @@ -158,7 +158,7 @@ let concat_rev = function | l -> String.concat (List.rev l) ~sep:"" module Mode = struct - type 'a t = + type _ t = | Single : Value.t t | Many : Value.t list t diff --git a/src/string_with_vars.mli b/src/string_with_vars.mli index f81a63b3..4a3736bd 100644 --- a/src/string_with_vars.mli +++ b/src/string_with_vars.mli @@ -35,7 +35,7 @@ val is_var : t -> name:string -> bool val text_only : t -> string option module Mode : sig - type 'a t = + type _ t = | Single : Value.t t | Many : Value.t list t end diff --git a/src/super_context.ml b/src/super_context.ml index fccb2bde..f956c69f 100644 --- a/src/super_context.ml +++ b/src/super_context.ml @@ -583,17 +583,16 @@ module Expander : sig type sctx = t - type expander - = sctx + val with_expander + : sctx -> dir:Path.t -> dep_kind:Build.lib_dep_kind -> scope:Scope.t -> targets_written_by_user:targets -> map_exe:(Path.t -> Path.t) -> bindings:Pform.Map.t - -> Value.t list option String_with_vars.expander - - val with_expander : (expander -> 'a) -> 'a * Resolved_forms.t + -> f:(Value.t list option String_with_vars.expander -> 'a) + -> 'a * Resolved_forms.t end = struct module Resolved_forms = struct type t = @@ -633,16 +632,6 @@ end = struct type sctx = t - type expander - = sctx - -> dir:Path.t - -> dep_kind:Build.lib_dep_kind - -> scope:Scope.t - -> targets_written_by_user:targets - -> map_exe:(Path.t -> Path.t) - -> bindings:Pform.Map.t - -> Value.t list option String_with_vars.expander - let path_exp path = [Value.Path path] let str_exp str = [Value.String str] @@ -772,11 +761,12 @@ end = struct ); res - let with_expander - : 'a. (expander -> 'a) -> 'a * Resolved_forms.t - = fun f -> - let acc = Resolved_forms.empty () in - (f (expander ~acc), acc) + let with_expander sctx ~dir ~dep_kind ~scope ~targets_written_by_user + ~map_exe ~bindings ~f = + let acc = Resolved_forms.empty () in + ( f (expander ~acc sctx ~dir ~dep_kind ~scope ~targets_written_by_user ~map_exe ~bindings) + , acc + ) end module Action = struct @@ -801,10 +791,8 @@ module Action = struct let expand_step1 sctx ~dir ~dep_kind ~scope ~targets_written_by_user ~map_exe ~bindings t = - Expander.with_expander (fun expander -> - let f = expander sctx ~dir ~dep_kind ~scope ~targets_written_by_user - ~map_exe ~bindings in - U.partial_expand t ~dir ~map_exe ~f) + Expander.with_expander sctx ~dir ~dep_kind ~scope ~targets_written_by_user ~map_exe ~bindings + ~f:(fun f -> U.partial_expand t ~dir ~map_exe ~f) let expand_step2 ~dir ~dynamic_expansions ~bindings ~(deps_written_by_user : Path.t Jbuild.Bindings.t)