Skip to content

Commit

Permalink
Update provider doc to 0.0.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbin committed Aug 2, 2024
1 parent b4c30d1 commit 5766f64
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<div class="by-name">
<h2>OCaml package documentation</h2>
<ol>
<li><a href="provider/index.html">provider</a> <span class="version">0.0.5</span></li>
<li><a href="provider-test/index.html">provider-test</a> <span class="version">0.0.5</span></li>
<li><a href="provider/index.html">provider</a> <span class="version">0.0.6</span></li>
<li><a href="provider-test/index.html">provider-test</a> <span class="version">0.0.6</span></li>
</ol>
</div>
</main>
Expand Down
7 changes: 2 additions & 5 deletions provider/Provider/Interface/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@

module File_reader = struct
type tag = [ `File_reader ]
end</code></pre><p>Then, the type of the interface for a provider whose internal state is <code>state</code>, that would implement both functionalities would be:</p><pre class="language-ocaml"><code>(state, [ Directory_reader.tag | File_reader.tag ]) Provider.Interface.t</code></pre></div></div><h2 id="building-interfaces"><a href="#building-interfaces" class="anchor"></a>Building interfaces</h2><div class="odoc-spec"><div class="spec value anchored" id="val-make"><a href="#val-make" class="anchor"></a><code><span><span class="keyword">val</span> make : <span><span><span><span class="type-var">'t</span> <a href="../Trait/Implementation/index.html#type-t">Trait.Implementation.t</a></span> <span class="xref-unresolved">Base</span>.list</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>make implementations</code> create a new interface from a list of implementation. It only keeps the last implementation supplied for each trait. This means that the resulting interface will not contain any duplicate traits, and the order of the implementations in the input list can affect its contents.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-implementations"><a href="#val-implementations" class="anchor"></a><code><span><span class="keyword">val</span> implementations : <span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'t</span> <a href="../Trait/Implementation/index.html#type-t">Trait.Implementation.t</a></span> <span class="xref-unresolved">Base</span>.list</span></span></code></div><div class="spec-doc"><p><code>implementations t</code> returns a list of trait implementations that the interface <code>t</code> supports. See also <a href="#val-extend"><code>extend</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-extend"><a href="#val-extend" class="anchor"></a><code><span><span class="keyword">val</span> extend :
<span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="label">with_</span>:<span><span><span class="type-var">'t</span> <a href="../Trait/Implementation/index.html#type-t">Trait.Implementation.t</a></span> <span class="xref-unresolved">Base</span>.list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>extend t ~with_</code> extends the interface <code>t</code> and returns a new interface that includes both the original and additional implementations. The resulting interface only contains the last occurrence of each trait, prioritizing the rightmost elements in the combined list <code>implementations t @ with_</code>.</p></div></div><h2 id="lookup"><a href="#lookup" class="anchor"></a>Lookup</h2><p>A lookup operation is used to retrieve the implementation of a specific trait within an interface.</p><div class="odoc-spec"><div class="spec value anchored" id="val-is_empty"><a href="#val-is_empty" class="anchor"></a><code><span><span class="keyword">val</span> is_empty : <span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span class="xref-unresolved">Base</span>.bool</span></code></div><div class="spec-doc"><p><code>is_empty t</code> checks if an interface <code>t</code> implements any traits. An empty interface may be created using <code>make []</code>. It will cause any lookup operation to fail. It can be useful for initializing data structures or providing a base case for algorithms that process interfaces.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-lookup"><a href="#val-lookup" class="anchor"></a><code><span><span class="keyword">val</span> lookup :
end</code></pre><p>Then, the type of the interface for a provider whose internal state is <code>state</code>, that would implement both functionalities would be:</p><pre class="language-ocaml"><code>(state, [ Directory_reader.tag | File_reader.tag ]) Provider.Interface.t</code></pre></div></div><h2 id="building-interfaces"><a href="#building-interfaces" class="anchor"></a>Building interfaces</h2><div class="odoc-spec"><div class="spec value anchored" id="val-make"><a href="#val-make" class="anchor"></a><code><span><span class="keyword">val</span> make : <span><span><span><span class="type-var">'t</span> <a href="../Trait/Implementation/index.html#type-t">Trait.Implementation.t</a></span> list</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>make implementations</code> create a new interface from a list of implementation. It only keeps the last implementation supplied for each trait. This means that the resulting interface will not contain any duplicate traits, and the order of the implementations in the input list can affect its contents.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-implementations"><a href="#val-implementations" class="anchor"></a><code><span><span class="keyword">val</span> implementations : <span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'t</span> <a href="../Trait/Implementation/index.html#type-t">Trait.Implementation.t</a></span> list</span></span></code></div><div class="spec-doc"><p><code>implementations t</code> returns a list of trait implementations that the interface <code>t</code> supports. See also <a href="#val-extend"><code>extend</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-extend"><a href="#val-extend" class="anchor"></a><code><span><span class="keyword">val</span> extend : <span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="label">with_</span>:<span><span><span class="type-var">'t</span> <a href="../Trait/Implementation/index.html#type-t">Trait.Implementation.t</a></span> list</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>extend t ~with_</code> extends the interface <code>t</code> and returns a new interface that includes both the original and additional implementations. The resulting interface only contains the last occurrence of each trait, prioritizing the rightmost elements in the combined list <code>implementations t @ with_</code>.</p></div></div><h2 id="lookup"><a href="#lookup" class="anchor"></a>Lookup</h2><p>A lookup operation is used to retrieve the implementation of a specific trait within an interface.</p><div class="odoc-spec"><div class="spec value anchored" id="val-is_empty"><a href="#val-is_empty" class="anchor"></a><code><span><span class="keyword">val</span> is_empty : <span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>is_empty t</code> checks if an interface <code>t</code> implements any traits. An empty interface may be created using <code>make []</code>. It will cause any lookup operation to fail. It can be useful for initializing data structures or providing a base case for algorithms that process interfaces.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-lookup"><a href="#val-lookup" class="anchor"></a><code><span><span class="keyword">val</span> lookup :
<span><span><span>(<span class="type-var">'t</span>, <span class="type-var">'tags</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="label">trait</span>:<span><span>(<span class="type-var">'t</span>, <span class="type-var">'implementation</span>, <span class="type-var">'tags</span>)</span> <a href="../Trait/index.html#type-t">Trait.t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span class="type-var">'implementation</span></span></code></div><div class="spec-doc"><p><code>lookup t ~trait</code> retrieves the implementation for a given <code>trait</code> from an interface.</p><p>If the provider has correctly exported their implementation using the appropriate tags, the compiler will ensure that this function does not fail in user code (a failure of this function would typically indicate a programming error in the provider's setup).</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-lookup_opt"><a href="#val-lookup_opt" class="anchor"></a><code><span><span class="keyword">val</span> lookup_opt :
<span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="label">trait</span>:<span><span>(<span class="type-var">'t</span>, <span class="type-var">'implementation</span>, <span class="type-var">_</span>)</span> <a href="../Trait/index.html#type-t">Trait.t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="type-var">'implementation</span> <span class="xref-unresolved">Base</span>.option</span></span></code></div><div class="spec-doc"><p><code>lookup_opt t ~trait</code> returns the implementation of the <code>trait</code> (<code>Some implementation</code>) or indicates that the trait is not implemented (<code>None</code>).</p><p>This is particularly useful in scenarios where a part of a program needs to adapt behavior at runtime based on whether certain functionalities are available or not.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-implements"><a href="#val-implements" class="anchor"></a><code><span><span class="keyword">val</span> implements : <span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="label">trait</span>:<span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>, <span class="type-var">_</span>)</span> <a href="../Trait/index.html#type-t">Trait.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span class="xref-unresolved">Base</span>.bool</span></code></div><div class="spec-doc"><p><code>implements t ~trait</code> says wether an interface implements a trait. This is <code>true</code> iif <code>lookup_opt t ~trait</code> returns <code>Some _</code>.</p></div></div></div></body></html>
<span><span class="type-var">'implementation</span> option</span></span></code></div><div class="spec-doc"><p><code>lookup_opt t ~trait</code> returns the implementation of the <code>trait</code> (<code>Some implementation</code>) or indicates that the trait is not implemented (<code>None</code>).</p><p>This is particularly useful in scenarios where a part of a program needs to adapt behavior at runtime based on whether certain functionalities are available or not.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-implements"><a href="#val-implements" class="anchor"></a><code><span><span class="keyword">val</span> implements : <span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="label">trait</span>:<span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>, <span class="type-var">_</span>)</span> <a href="../Trait/index.html#type-t">Trait.t</a></span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>implements t ~trait</code> says wether an interface implements a trait. This is <code>true</code> iif <code>lookup_opt t ~trait</code> returns <code>Some _</code>.</p></div></div></div></body></html>
2 changes: 1 addition & 1 deletion provider/Provider/Private/Interface/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Interface (provider.Provider.Private.Interface)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.2"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../odoc.support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><script>let base_url = '../../../../';
let search_urls = ['../../../db.js','../../../../sherlodoc.js'];
</script><script src="../../../../odoc.support/odoc_search.js" defer="defer"></script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a><a href="../../../index.html">provider</a> &#x00BB; <a href="../../index.html">Provider</a> &#x00BB; <a href="../index.html">Private</a> &#x00BB; Interface</nav><div class="odoc-search"><div class="search-inner"><input class="search-bar" placeholder="🔎 Search..."/><div class="search-snake"></div><div class="search-result"></div></div></div><header class="odoc-preamble"><h1>Module <code><span>Private.Interface</span></code></h1></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-same_trait_uids"><a href="#val-same_trait_uids" class="anchor"></a><code><span><span class="keyword">val</span> same_trait_uids : <span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="../../Interface/index.html#type-t">Interface.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span>(<span class="type-var">'t</span>, <span class="type-var">_</span>)</span> <a href="../../Interface/index.html#type-t">Interface.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span class="xref-unresolved">Base</span>.bool</span></code></div><div class="spec-doc"><p><code>same_trait_uids i1 i2</code> checks if the traits of two interfaces are the same and in the same order.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-cache"><a href="#val-cache" class="anchor"></a><code><span><span class="keyword">val</span> cache : <span><span><span>(<span class="type-var">_</span>, <span class="type-var">_</span>)</span> <a href="../../Interface/index.html#type-t">Interface.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><a href="../../Trait/Uid/index.html#type-t">Trait.Uid.t</a> <span class="xref-unresolved">Base</span>.option</span></span></code></div><div class="spec-doc"><p>Exported to test the caching strategy. Retains the most recently looked up trait. Currently returns <code>None</code> for empty interface, and if the interface is not empty, returns the most recently looked up trait (<code>Some uid</code>) or an arbitrary initial value.</p></div></div></div></body></html>
</script><script src="../../../../odoc.support/odoc_search.js" defer="defer"></script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a><a href="../../../index.html">provider</a> &#x00BB; <a href="../../index.html">Provider</a> &#x00BB; <a href="../index.html">Private</a> &#x00BB; Interface</nav><div class="odoc-search"><div class="search-inner"><input class="search-bar" placeholder="🔎 Search..."/><div class="search-snake"></div><div class="search-result"></div></div></div><header class="odoc-preamble"><h1>Module <code><span>Private.Interface</span></code></h1></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-same_trait_uids"><a href="#val-same_trait_uids" class="anchor"></a><code><span><span class="keyword">val</span> same_trait_uids : <span><span><span>(<span class="type-var">'t1</span>, <span class="type-var">_</span>)</span> <a href="../../Interface/index.html#type-t">Interface.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span>(<span class="type-var">'t2</span>, <span class="type-var">_</span>)</span> <a href="../../Interface/index.html#type-t">Interface.t</a></span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>same_trait_uids i1 i2</code> checks if the traits of two interfaces are the same and in the same order.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-cache"><a href="#val-cache" class="anchor"></a><code><span><span class="keyword">val</span> cache : <span><span><span>(<span class="type-var">_</span>, <span class="type-var">_</span>)</span> <a href="../../Interface/index.html#type-t">Interface.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><a href="../../Trait/Uid/index.html#type-t">Trait.Uid.t</a> option</span></span></code></div><div class="spec-doc"><p>Exported to test the caching strategy. Retains the most recently looked up trait. Currently returns <code>None</code> for empty interface, and if the interface is not empty, returns the most recently looked up trait (<code>Some uid</code>) or an arbitrary initial value.</p></div></div></div></body></html>
Loading

0 comments on commit 5766f64

Please sign in to comment.