package merlin-lib

  1. Overview
  2. Docs
Merlin's libraries

Install

Dune Dependency

Authors

Maintainers

Sources

merlin-5.5-503.tbz
sha256=67da3b34f2fea07678267309f61da4a2c6f08298de0dc59655b8d30fd8269af1
sha512=1fb3b5180d36aa82b82a319e15b743b802b6888f0dc67645baafdb4e18dfc23a7b90064ec9bc42f7424061cf8cde7f8839178d8a8537bf4596759f3ff4891873

doc/merlin-lib.ocaml_typing/Ocaml_typing/Signature_group/index.html

Module Ocaml_typing.Signature_groupSource

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.

Sourcetype sig_item = {
  1. src : Types.signature_item;
    (*

    the syntactic item

    *)
  2. 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

Sourcetype core_rec_group =
  1. | Not_rec of sig_item
  2. | Rec_group of sig_item list

A group of mutually recursive definition

Sourceval rec_items : core_rec_group -> sig_item list

rec_items group is the list of sig_items in the group

Sourcetype rec_group = {
  1. pre_ghosts : Types.signature_item list;
  2. 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.

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.

Sourceval iter : (rec_group -> unit) -> Types.signature -> unit
Sourceval fold : ('acc -> rec_group -> 'acc) -> 'acc -> Types.signature -> 'acc
Sourcetype in_place_patch = {
  1. ghosts : Types.signature;
    (*

    updated list of ghost items

    *)
  2. replace_by : Types.signature_item option;
    (*

    replacement for the selected item

    *)
}

Describe how to amend one element of a signature

Sourceval 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 ~ghosts component returns Some (value,patch). The ghosts list is the current prefix of ghost components associated to component

OCaml

Innovation. Community. Security.