package merlin-lib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=376707aa871f09e9639456d3fbe4b89a21c9ad75c774e94cbbbe67f842b0a500
sha512=a11ea4b8e3520b3ee41ae8198cda34b2816b8dfcdcb99350ef29689a7d62bb66d17ffa075c551aa56d521120b55e6db14a106a31f7b3970ed2aa07e1db3c9b88
doc/merlin-lib.ocaml_typing/Ocaml_typing/Signature_group/index.html
Module Ocaml_typing.Signature_group
Source
Iterate on signature by syntactic group of items
Classes, class types and private row types adds ghost components to the signature where they are defined.
When editing or printing a signature it is therefore important to identify those ghost components.
This module provides type grouping together ghost components with the corresponding core item (or recursive group) and the corresponding iterators.
type sig_item = {
src : Types.signature_item;
(*the syntactic item
*)post_ghosts : Types.signature_item list;
(*ghost classes types are post-declared
*)
}
Classes and class types generate ghosts signature items, we group them together before printing
flatten sig_item
is x.src :: x.post_ghosts
A group of mutually recursive definition
rec_items group
is the list of sig_items in the group
Private #row types are manifested as a sequence of definitions preceding a recursive group, we collect them and separate them from the syntactic recursive group.
type in_place_patch = {
ghosts : Types.signature;
(*updated list of ghost items
*)replace_by : Types.signature_item option;
(*replacement for the selected item
*)
}
Describe how to amend one element of a signature
val replace_in_place :
(ghosts:Types.signature ->
Types.signature_item ->
('a * in_place_patch) option) ->
Types.signature ->
('a * Types.signature) option
!replace_in_place patch sg
replaces the first element of the signature for which patch ~rec_group ~ghosts component
returns Some (value,patch)
. The rec_group
argument is the remaining part of the mutually recursive group of component
. The ghosts
list is the current prefix of ghost components associated to component