package rotor
Install
Dune Dependency
Authors
Maintainers
Sources
md5=372ca9b6a7af2fdd99d5117d376870b4
sha512=6f5473951437a48bf9ae7a5d22a4283c02bed6a6e5c7bc02fc5f28dc5c28720f3e2c69f32a2a0c5b9447c2bc8c83746bb4de5b67909a98cc8921527582727063
doc/rotor/Moduletype/index.html
Module Moduletype
module Binding : sig ... end
val unwrap :
Compiler.Typedtree.module_type ->
Compiler.Typedtree.module_type
* (Compiler.Path.t
* Compiler.Longident.t Asttypes.loc
* Compiler.Typedtree.with_constraint)
list
list
val module_type_consistent_with :
Elements.Module._sub_t ->
Elements.ModuleType._sub_t ->
bool
ST
is consistent with S
and FT
is consistent with F
.
val sort :
Compiler.Env.t ->
Compiler.Types.module_type ->
Elements.ModuleType._sub_t Containers.Option.t
module_type_sort env mt
returns an optional _module_type
value corresponding to the sort of the module type mt
(i.e. either a structure or a functor). If the sort cannot be determined, then None
is returned. env
is used to lookup modules and module types encountered when examining the structure of mt
, and thus should be the environment corresponding to the point in the AST where the mt
parameter comes from.
val resolve :
Compiler.Env.t ->
Compiler.Types.module_type ->
Types_views._module_type
val resolve_view :
Compiler.Env.t ->
'a Types_views.module_type_view ->
'a Types_views.module_type
Resolve a module type view to a concrete module type; this may involve looking up module types and the types of modules referenced by identifiers, hence the need to provide an environment.
val lookup :
Compiler.Env.t ->
'a Types_views.module_type ->
'b Identifier.Chain.t ->
'b Types_views.item_element_view Containers.Option.t
lookup env mtv id
looks up the element referenced by id
in the module type view mtv
; this may require module (type) identifiers to be resolved, hence the need to provide the environment env
.
val _lookup :
Compiler.Env.t ->
Types_views._module_type ->
'b Identifier.Chain.t ->
'b Types_views.item_element_view Containers.Option.t
Version of lookup
that takes an existential _module_type
.
val resolve_lookup :
Compiler.Env.t ->
Compiler.Types.module_type ->
'b Identifier.Chain.t ->
'b Types_views.item_element_view Containers.Option.t
resolve_lookup env mty id
first resolve
s the module type mty
and then performs _lookup
.
val find :
(Compiler.Ident.t, 'a) Identifier.Atom.t ->
Compiler.Env.t ->
Types_views._module_type Containers.Option.t
find a env
returns the module type of the module or module type identified by a
by using the appropriate compiler lookup function on env
. If the lookup fails, then None
is returned. If a
is not of the correct sort (i.e. a _structure
, _functor
, _structure_type
, or _functor_type
atom), the Invalid_argument is raised.
val find_lookup :
(Compiler.Ident.t, 'a) Identifier.Atom.t ->
Compiler.Env.t ->
'b Identifier.Chain.t ->
'b Types_views.item_element_view Containers.Option.t
val contains :
Compiler.Env.t ->
'a Types_views.module_type ->
(Compiler.Ident.t, 'b) Identifier.Atom.t ->
bool
contains env mt a
returns true if and only if mt
contains a binding for the element a
.
val find_param_by_id :
Compiler.Env.t ->
Compiler.Ident.t ->
Types_views._module_type ->
Compiler.Types.module_type Containers.Option.t Containers.Option.t
find_param_by_id env x mty
returns the module type of the functor parameter of mty
with identifier x
, or None
if the x
is not found. It will raise Invalid_argument
if mty
is not a functor type.
val find_param_by_idx :
Compiler.Env.t ->
int ->
Types_views._module_type ->
(Compiler.Ident.t * Compiler.Types.module_type Containers.Option.t)
Containers.Option.t
find_param_by_idx env idx mty
returns the identifer and module type of the functor parameter of mty
at index idx
, or None
if the x
is not found. It will raise Invalid_argument
if mty
is not a functor type.