ocaml-base-compiler

Official release 4.14.0
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library ocamlcommon
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

val flatten : sig_item -> Types.signature

flatten sig_item is x.src :: x.post_ghosts

type core_rec_group =
| Not_rec of sig_item
| Rec_group of sig_item list

A group of mutually recursive definition

val rec_items : core_rec_group -> sig_item list

rec_items group is the list of sig_items in the group

type rec_group = {
pre_ghosts : Types.signature_item list;
group : core_rec_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.

val next : Types.signature -> (rec_group * Types.signature) option

The sequence seq signature iterates over signature rec_group by rec_group. The second element of the tuple in the full_seq case is the not-yet traversed part of the signature.

val iter : ( rec_group -> unit ) -> Types.signature -> unit
val fold : ( 'acc -> rec_group -> 'acc ) -> 'acc -> Types.signature -> 'acc
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