moonpool/dev/ocaml/Signature_group/index.html

7 lines
No EOL
9.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Signature_group (ocaml.Signature_group)</title><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../index.html">ocaml</a> &#x00BB; Signature_group</nav><header class="odoc-preamble"><h1>Module <code><span>Signature_group</span></code></h1><p>Iterate on signature by syntactic group of items</p><p>Classes, class types and private row types adds ghost components to the signature where they are defined.</p><p>When editing or printing a signature it is therefore important to identify those ghost components.</p><p>This module provides type grouping together ghost components with the corresponding core item (or recursive group) and the corresponding iterators.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-sig_item"><a href="#type-sig_item" class="anchor"></a><code><span><span class="keyword">type</span> sig_item</span><span> = </span><span>{</span></code><ol><li id="type-sig_item.src" class="def record field anchored"><a href="#type-sig_item.src" class="anchor"></a><code><span>src : <a href="../Types/index.html#type-signature_item">Types.signature_item</a>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>the syntactic item</p><span class="comment-delim">*)</span></div></li><li id="type-sig_item.post_ghosts" class="def record field anchored"><a href="#type-sig_item.post_ghosts" class="anchor"></a><code><span>post_ghosts : <span><a href="../Types/index.html#type-signature_item">Types.signature_item</a> list</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>ghost classes types are post-declared</p><span class="comment-delim">*)</span></div></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>Classes and class types generate ghosts signature items, we group them together before printing</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-flatten"><a href="#val-flatten" class="anchor"></a><code><span><span class="keyword">val</span> flatten : <span><a href="#type-sig_item">sig_item</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Types/index.html#type-signature">Types.signature</a></span></code></div><div class="spec-doc"><p><code>flatten sig_item</code> is <code>x.src :: x.post_ghosts</code></p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-core_rec_group"><a href="#type-core_rec_group" class="anchor"></a><code><span><span class="keyword">type</span> core_rec_group</span><span> = </span></code><ol><li id="type-core_rec_group.Not_rec" class="def variant constructor anchored"><a href="#type-core_rec_group.Not_rec" class="anchor"></a><code><span>| </span><span><span class="constructor">Not_rec</span> <span class="keyword">of</span> <a href="#type-sig_item">sig_item</a></span></code></li><li id="type-core_rec_group.Rec_group" class="def variant constructor anchored"><a href="#type-core_rec_group.Rec_group" class="anchor"></a><code><span>| </span><span><span class="constructor">Rec_group</span> <span class="keyword">of</span> <span><a href="#type-sig_item">sig_item</a> list</span></span></code></li></ol></div><div class="spec-doc"><p>A group of mutually recursive definition</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rec_items"><a href="#val-rec_items" class="anchor"></a><code><span><span class="keyword">val</span> rec_items : <span><a href="#type-core_rec_group">core_rec_group</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-sig_item">sig_item</a> list</span></span></code></div><div class="spec-doc"><p><code>rec_items group</code> is the list of sig_items in the group</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-rec_group"><a href="#type-rec_group" class="anchor"></a><code><span><span class="keyword">type</span> rec_group</span><span> = </span><span>{</span></code><ol><li id="type-rec_group.pre_ghosts" class="def record field anchored"><a href="#type-rec_group.pre_ghosts" class="anchor"></a><code><span>pre_ghosts : <span><a href="../Types/index.html#type-signature_item">Types.signature_item</a> list</span>;</span></code></li><li id="type-rec_group.group" class="def record field anchored"><a href="#type-rec_group.group" class="anchor"></a><code><span>group : <a href="#type-core_rec_group">core_rec_group</a>;</span></code></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>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.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-next"><a href="#val-next" class="anchor"></a><code><span><span class="keyword">val</span> next : <span><a href="../Types/index.html#type-signature">Types.signature</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<a href="#type-rec_group">rec_group</a> * <a href="../Types/index.html#type-signature">Types.signature</a>)</span> option</span></span></code></div><div class="spec-doc"><p>The sequence <code>seq signature</code> iterates over <code>signature</code> <a href="#type-rec_group"><code>rec_group</code></a> by <a href="#type-rec_group"><code>rec_group</code></a>. The second element of the tuple in the <code>full_seq</code> case is the not-yet traversed part of the signature.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-seq"><a href="#val-seq" class="anchor"></a><code><span><span class="keyword">val</span> seq : <span><a href="../Types/index.html#type-signature">Types.signature</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-rec_group">rec_group</a> <a href="../Stdlib/Seq/index.html#type-t">Stdlib.Seq.t</a></span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-iter"><a href="#val-iter" class="anchor"></a><code><span><span class="keyword">val</span> iter : <span><span>(<span><a href="#type-rec_group">rec_group</a> <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Types/index.html#type-signature">Types.signature</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-fold"><a href="#val-fold" class="anchor"></a><code><span><span class="keyword">val</span> fold : <span><span>(<span><span class="type-var">'acc</span> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-rec_group">rec_group</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'acc</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'acc</span> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Types/index.html#type-signature">Types.signature</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'acc</span></span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-in_place_patch"><a href="#type-in_place_patch" class="anchor"></a><code><span><span class="keyword">type</span> in_place_patch</span><span> = </span><span>{</span></code><ol><li id="type-in_place_patch.ghosts" class="def record field anchored"><a href="#type-in_place_patch.ghosts" class="anchor"></a><code><span>ghosts : <a href="../Types/index.html#type-signature">Types.signature</a>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>updated list of ghost items</p><span class="comment-delim">*)</span></div></li><li id="type-in_place_patch.replace_by" class="def record field anchored"><a href="#type-in_place_patch.replace_by" class="anchor"></a><code><span>replace_by : <span><a href="../Types/index.html#type-signature_item">Types.signature_item</a> option</span>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>replacement for the selected item</p><span class="comment-delim">*)</span></div></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>Describe how to amend one element of a signature</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-replace_in_place"><a href="#val-replace_in_place" class="anchor"></a><code><span><span class="keyword">val</span> replace_in_place :
<span><span>(<span>ghosts:<a href="../Types/index.html#type-signature">Types.signature</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../Types/index.html#type-signature_item">Types.signature_item</a> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span class="type-var">'a</span> * <a href="#type-in_place_patch">in_place_patch</a>)</span> option</span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../Types/index.html#type-signature">Types.signature</a> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span class="type-var">'a</span> * <a href="../Types/index.html#type-signature">Types.signature</a>)</span> option</span></span></code></div><div class="spec-doc"><p><code>!replace_in_place patch sg</code> replaces the first element of the signature for which <code>patch ~rec_group ~ghosts component</code> returns <code>Some (value,patch)</code>. The <code>rec_group</code> argument is the remaining part of the mutually recursive group of <code>component</code>. The <code>ghosts</code> list is the current prefix of ghost components associated to <code>component</code></p></div></div></div></body></html>