Ocaml_typing.Global_modulemodule Parameter_name : sig ... endmodule Argument : sig ... endmodule Name : sig ... endAn elaborated form of name in which all arguments are expressed, including those being passed implicitly from one module to another by the subset rule for parameterised modules. Normally, these "hidden" arguments simply say to pass X as X for some module X, but if there are parameterised parameters, the hidden arguments can get more complex.
Suppose M takes parameters X and Y, neither of which is itself parameterised. If someone is passing Foo as the value of X, then, we will have (abbreviating nested records):
{ head: M; visible_args: [ X, Foo ]; hidden_args: [ Y, Y ] }This represents that X is explicitly being given the value Foo and Y (the parameter) is implicitly getting the value Y (the argument currently in scope).
However, suppose instead Y is parameterised by X. Then M still takes two parameters X and Y, but now once X has the value Foo, Y requires _that particular_ X:
{ head: M; visible_args: [ X, Foo ]; hidden_args: [ Y, Y[X:Foo] ] }Importantly, the _parameters_ X and Y never change: they are names that appear in m.ml and m.cmi. But further specialisation requires passing specifically a Y[X:Foo] rather than a Y. (Here, Y[X:Foo] stands for the record { head = Y; visible_args = [ X, Foo ]; hidden_args = [] } of type t.)
and argument = t Argument.tinclude Ocaml_utils.Identifiable.S with type t := tmodule T : Ocaml_utils.Identifiable.Thing with type t = tinclude Ocaml_utils.Identifiable.Thing with type t := T.tinclude Hashtbl.HashedType with type t := T.tval hash : T.t -> intA hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include
(=), hash) for comparing objects by structure (provided objects do not contain floats)(fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly(==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).include Map.OrderedType with type t := T.tA total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.
val output : out_channel -> T.t -> unitval print : Format.formatter -> T.t -> unitmodule Set : Ocaml_utils.Identifiable.Set with module T := Tmodule Map : Ocaml_utils.Identifiable.Map with module T := Tmodule Tbl : Ocaml_utils.Identifiable.Tbl with module T := Tval create_exn :
string ->
argument list ->
hidden_args:Parameter_name.t list ->
tval to_string : t -> stringtype subst = t Parameter_name.Map.tA map from parameter names to their values.
Apply a substitution to the given global. If it appears in the substitution directly (that is, its Name.t form is a key in the map), this simply performs a lookup. Otherwise, we perform a _revealing substitution_: if the value of a hidden argument is a key in the substitution, the argument becomes visible. Otherwise, substitution recurses into arguments (both hidden and visible) as usual. See global_test.ml for examples.
Apply a substitution to the arguments and parameters in t but not to t itself. Useful if subst is constructed from some parameter-argument pairs and t is one of the parameters, since we want to handle any interdependencies but the substitution applied to t itself is uninterestingly just the corresponding value.
val find_in_parameter_map : t -> 'a Parameter_name.Map.t -> 'a optionval check : subst -> Parameter_name.t list -> boolCheck that a substitution is a valid (possibly partial) instantiation of a module with the given parameter list. Each name being substituted must appear in the list.
val is_complete : t -> boolReturns true if hidden_args is empty and all argument values (if any) are also complete. This is a stronger condition than full application, and (unless the whole global is itself a parameter) it's equivalent to the global being a static constant, since any parameters being used would have to show up in a hidden_args somewhere. (Importantly, it's not possible that a parameter is being used as an argument to a different parameter, since a module can be declared to be an argument for up to one parameter.)
CR lmaurer: Make sure we're checking for the user redundantly passing an parameter as an argument. This should be accepted and ignored, lest we count the parameter as filled and consider something completely instantiated.
val has_arguments : t -> boolReturns true if this name has at least one argument (either hidden or visible).
module Precision : sig ... endmodule With_precision : sig ... end