Skip to content

Commit

Permalink
deploy: 23b7b16
Browse files Browse the repository at this point in the history
  • Loading branch information
favonia committed Feb 23, 2024
0 parents commit 6b213be
Show file tree
Hide file tree
Showing 66 changed files with 2,211 additions and 0 deletions.
Empty file added .nojekyll
Empty file.
2 changes: 2 additions & 0 deletions algaeff/Algaeff/Fun/Deep/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Deep (algaeff.Algaeff.Fun.Deep)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../odoc.support/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">algaeff</a> &#x00BB; <a href="../../index.html">Algaeff</a> &#x00BB; <a href="../index.html">Fun</a> &#x00BB; Deep</nav><header class="odoc-preamble"><h1>Module <code><span>Fun.Deep</span></code></h1><p>Useful helper functions for deep handlers.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-finally"><a href="#val-finally" class="anchor"></a><code><span><span class="keyword">val</span> finally : <span><span><span>(<span class="type-var">'a</span>, <span class="type-var">'b</span>)</span> <span class="xref-unresolved">Stdlib</span>.Effect.Deep.continuation</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p><code>finally f</code> runs the thunk <code>f</code> and calls <code>continue</code> if a value is returned and <code>discontinue</code> if an exception is raised. Here is an example that calls <code>List.nth</code> and then either returns the found element with <code>continue</code> or raises the exception <code>Not_found</code> with <code>discontinue</code>.</p><pre class="language-ocaml"><code>Algaeff.Fun.Deep.finally k @@ fun () -&gt; List.nth elements n</code></pre></div></div></div></body></html>
6 changes: 6 additions & 0 deletions algaeff/Algaeff/Fun/Shallow/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Shallow (algaeff.Algaeff.Fun.Shallow)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../odoc.support/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">algaeff</a> &#x00BB; <a href="../../index.html">Algaeff</a> &#x00BB; <a href="../index.html">Fun</a> &#x00BB; Shallow</nav><header class="odoc-preamble"><h1>Module <code><span>Fun.Shallow</span></code></h1><p>Useful helper functions for shallow handlers.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-finally_with"><a href="#val-finally_with" class="anchor"></a><code><span><span class="keyword">val</span> finally_with :
<span><span><span>(<span class="type-var">'a</span>, <span class="type-var">'b</span>)</span> <span class="xref-unresolved">Stdlib</span>.Effect.Shallow.continuation</span> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span class="type-var">'b</span>, <span class="type-var">'c</span>)</span> <span class="xref-unresolved">Stdlib</span>.Effect.Shallow.handler</span> <span class="arrow">&#45;&gt;</span></span>
<span class="type-var">'c</span></span></code></div><div class="spec-doc"><p>See <a href="../Deep/index.html#val-finally"><code>Deep.finally</code></a>.</p></div></div></div></body></html>
2 changes: 2 additions & 0 deletions algaeff/Algaeff/Fun/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Fun (algaeff.Algaeff.Fun)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../odoc.support/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">algaeff</a> &#x00BB; <a href="../index.html">Algaeff</a> &#x00BB; Fun</nav><header class="odoc-preamble"><h1>Module <code><span>Algaeff.Fun</span></code></h1><p>Useful helper functions around effects.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec module anchored" id="module-Deep"><a href="#module-Deep" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Deep/index.html">Deep</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Useful helper functions for deep handlers.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Shallow"><a href="#module-Shallow" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Shallow/index.html">Shallow</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Useful helper functions for shallow handlers.</p></div></div></div></body></html>
2 changes: 2 additions & 0 deletions algaeff/Algaeff/Mutex/Make/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Make (algaeff.Algaeff.Mutex.Make)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../odoc.support/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">algaeff</a> &#x00BB; <a href="../../index.html">Algaeff</a> &#x00BB; <a href="../index.html">Mutex</a> &#x00BB; Make</nav><header class="odoc-preamble"><h1>Module <code><span>Mutex.Make</span></code></h1><p>The implementation of mutex effects. <code>Make</code> is generative so that one can use multiple mutexes at the same time.</p><p>The signature of mutex effects.</p></header><nav class="odoc-toc"><ul><li><a href="#parameters">Parameters</a></li><li><a href="#signature">Signature</a></li></ul></nav><div class="odoc-content"><h2 id="parameters"><a href="#parameters" class="anchor"></a>Parameters</h2><h2 id="signature"><a href="#signature" class="anchor"></a>Signature</h2><div class="odoc-spec"><div class="spec exception anchored" id="exception-Locked"><a href="#exception-Locked" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Locked</span></span></code></div><div class="spec-doc"><p>The exception raised by <a href="#val-exclusively"><code>exclusively</code></a> if the mutex was locked.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-exclusively"><a href="#val-exclusively" class="anchor"></a><code><span><span class="keyword">val</span> exclusively : <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>exclusively f</code> locks the mutex, run the thunk <code>f</code>, and then unlock the mutex. If the mutex was already locked, <code>exclusively f</code> immediately raises <a href="#exception-Locked"><code>Locked</code></a> without waiting. Note that calling <code>exclusively</code> inside <code>f</code> is an instance of attempting to lock an already locked mutex.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <a href="#exception-Locked"><code>Locked</code></a> <p>The mutex was already locked.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-run"><a href="#val-run" class="anchor"></a><code><span><span class="keyword">val</span> run : <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>run f</code> executes the thunk <code>f</code> which may perform mutex effects. Each call of <code>run</code> creates a fresh mutex; in particular, calling <code>run</code> inside the thunk <code>f</code> will start a new scope that does not interfere with the outer scope.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-register_printer"><a href="#val-register_printer" class="anchor"></a><code><span><span class="keyword">val</span> register_printer : <span><span>(<span><span>[ `Exclusively ]</span> <span class="arrow">&#45;&gt;</span></span> <span>string option</span>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>register_printer p</code> registers a printer <code>p</code> via <code>Printexc.register_printer</code> to convert unhandled internal effects into strings for the OCaml runtime system to display. Ideally, all internal effects should have been handled by <a href="#val-run"><code>run</code></a> and there is no need to use this function, but when it is not the case, this function can be helpful for debugging. The functor <a href="#"><code>Mutex.Make</code></a> always registers a simple printer to suggest using <a href="#val-run"><code>run</code></a>, but you can register new ones to override it. The return type of the printer <code>p</code> should return <code>Some s</code> where <code>s</code> is the resulting string, or <code>None</code> if it chooses not to convert a particular effect. The registered printers are tried in reverse order until one of them returns <code>Some s</code> for some <code>s</code>; that is, the last registered printer is tried first. Note that this function is a wrapper of <code>Printexc.register_printer</code> and all the registered printers (via this function or <code>Printexc.register_printer</code>) are put into the same list.</p><p>The input type of the printer <code>p</code> is a variant representing internal effects used in this module. It corresponds to all the effects trigger by <a href="#val-exclusively"><code>exclusively</code></a>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 1.1.0</li></ul></div></div></div></body></html>
14 changes: 14 additions & 0 deletions algaeff/Algaeff/Mutex/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Mutex (algaeff.Algaeff.Mutex)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../odoc.support/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">algaeff</a> &#x00BB; <a href="../index.html">Algaeff</a> &#x00BB; Mutex</nav><header class="odoc-preamble"><h1>Module <code><span>Algaeff.Mutex</span></code></h1><p>Effects for making concurrent execution immediately fail.</p></header><div class="odoc-content"><pre class="language-ocaml"><code>module M = Algaeff.Mutex.Make ()

let () = M.run @@ fun () -&gt;
let ten = M.exclusively @@ fun () -&gt; 10 in
let nine = M.exclusively @@ fun () -&gt; 9 in
(* this will print out 19 *)
print_int (ten + nine)

let _ = M.run @@ fun () -&gt;
M.exclusively @@ fun () -&gt;
(* this raises M.Locked *)
M.exclusively @@ fun () -&gt;
100</code></pre><p>Note that the exception <a href="module-type-S/index.html#exception-Locked"><code>S.Locked</code></a> would be immediately raised for any attempt to lock an already locked mutex. The typical application of this component is to prevent erroneous concurrent API access, not to provide synchronization. Therefore, no waiting would happen.</p><p>It is impossible to implement meaningful synchronization unless this module also handles lightweight threading. For applications that need synchronization between lightweight threads (so that one thread would wait for another thread to unlock the mutex), check out other libraries such as the <a href="https://github.com/ocaml-multicore/eio">Eio</a> and <a href="https://erratique.ch/software/affect">Affect</a>.</p><div class="odoc-spec"><div class="spec module-type anchored" id="module-type-S"><a href="#module-type-S" class="anchor"></a><code><span><span class="keyword">module</span> <span class="keyword">type</span> <a href="module-type-S/index.html">S</a></span><span> = <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>The signature of mutex effects.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Make"><a href="#module-Make" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Make/index.html">Make</a></span><span> () : <a href="module-type-S/index.html">S</a></span></code></div><div class="spec-doc"><p>The implementation of mutex effects. <code>Make</code> is generative so that one can use multiple mutexes at the same time.</p></div></div></div></body></html>
2 changes: 2 additions & 0 deletions algaeff/Algaeff/Mutex/module-type-S/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>S (algaeff.Algaeff.Mutex.S)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../odoc.support/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">algaeff</a> &#x00BB; <a href="../../index.html">Algaeff</a> &#x00BB; <a href="../index.html">Mutex</a> &#x00BB; S</nav><header class="odoc-preamble"><h1>Module type <code><span>Mutex.S</span></code></h1><p>The signature of mutex effects.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec exception anchored" id="exception-Locked"><a href="#exception-Locked" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Locked</span></span></code></div><div class="spec-doc"><p>The exception raised by <a href="#val-exclusively"><code>exclusively</code></a> if the mutex was locked.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-exclusively"><a href="#val-exclusively" class="anchor"></a><code><span><span class="keyword">val</span> exclusively : <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>exclusively f</code> locks the mutex, run the thunk <code>f</code>, and then unlock the mutex. If the mutex was already locked, <code>exclusively f</code> immediately raises <a href="#exception-Locked"><code>Locked</code></a> without waiting. Note that calling <code>exclusively</code> inside <code>f</code> is an instance of attempting to lock an already locked mutex.</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <a href="#exception-Locked"><code>Locked</code></a> <p>The mutex was already locked.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-run"><a href="#val-run" class="anchor"></a><code><span><span class="keyword">val</span> run : <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>run f</code> executes the thunk <code>f</code> which may perform mutex effects. Each call of <code>run</code> creates a fresh mutex; in particular, calling <code>run</code> inside the thunk <code>f</code> will start a new scope that does not interfere with the outer scope.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-register_printer"><a href="#val-register_printer" class="anchor"></a><code><span><span class="keyword">val</span> register_printer : <span><span>(<span><span>[ `Exclusively ]</span> <span class="arrow">&#45;&gt;</span></span> <span>string option</span>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>register_printer p</code> registers a printer <code>p</code> via <code>Printexc.register_printer</code> to convert unhandled internal effects into strings for the OCaml runtime system to display. Ideally, all internal effects should have been handled by <a href="#val-run"><code>run</code></a> and there is no need to use this function, but when it is not the case, this function can be helpful for debugging. The functor <a href="../Make/index.html"><code>Mutex.Make</code></a> always registers a simple printer to suggest using <a href="#val-run"><code>run</code></a>, but you can register new ones to override it. The return type of the printer <code>p</code> should return <code>Some s</code> where <code>s</code> is the resulting string, or <code>None</code> if it chooses not to convert a particular effect. The registered printers are tried in reverse order until one of them returns <code>Some s</code> for some <code>s</code>; that is, the last registered printer is tried first. Note that this function is a wrapper of <code>Printexc.register_printer</code> and all the registered printers (via this function or <code>Printexc.register_printer</code>) are put into the same list.</p><p>The input type of the printer <code>p</code> is a variant representing internal effects used in this module. It corresponds to all the effects trigger by <a href="#val-exclusively"><code>exclusively</code></a>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 1.1.0</li></ul></div></div></div></body></html>
2 changes: 2 additions & 0 deletions algaeff/Algaeff/Reader/Make/argument-1-Env/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Env (algaeff.Algaeff.Reader.Make.Env)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../../odoc.support/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">algaeff</a> &#x00BB; <a href="../../../index.html">Algaeff</a> &#x00BB; <a href="../../index.html">Reader</a> &#x00BB; <a href="../index.html">Make</a> &#x00BB; Env</nav><header class="odoc-preamble"><h1>Parameter <code><span>Make.Env</span></code></h1></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span></code></div><div class="spec-doc"><p>The wrapped type.</p></div></div></div></body></html>
Loading

0 comments on commit 6b213be

Please sign in to comment.