<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="pa_monad.html"> <link rel="previous" href="Pa_monad.html"> <link rel="next" href="Exception.html"> <link rel="Up" href="pa_monad.html"> <link title="Index of types" rel=Appendix href="pa_monad_types.html"> <link title="Index of exceptions" rel=Appendix href="pa_monad_exceptions.html"> <link title="Index of values" rel=Appendix href="pa_monad_values.html"> <link title="Index of modules" rel=Appendix href="pa_monad_modules.html"> <link title="Pa_monad" rel="Chapter" href="Pa_monad.html"> <link title="Cc" rel="Chapter" href="Cc.html"> <link title="Exception" rel="Chapter" href="Exception.html"> <link title="Io" rel="Chapter" href="Io.html"> <link title="Utest" rel="Chapter" href="Utest.html"><link title="Fundamental Functions" rel="Section" href="#4_FundamentalFunctions"> <link title="Specific monad morphisms" rel="Section" href="#4_Specificmonadmorphisms"> <title>Cc</title> </head> <body> <div class="navbar"><a class="pre" href="Pa_monad.html" title="Pa_monad">Previous</a> <a class="up" href="pa_monad.html" title="Index">Up</a> <a class="post" href="Exception.html" title="Exception">Next</a> </div> <h1>Module <a href="type_Cc.html">Cc</a></h1> <pre><span class="keyword">module</span> Cc: <code class="code">sig</code> <a href="Cc.html">..</a> <code class="code">end</code></pre><div class="info"> Delimited continuations: multi-prompt shift/reset with the polymorphic answertype and variously typed prompts.<br> </div> <hr width="100%"> <pre><span id="TYPEm"><span class="keyword">type</span> <code class="type">'a</code> m</span> </pre> <div class="info"> The type of monadic values.<br> </div> <pre><span id="TYPEprompt"><span class="keyword">type</span> <code class="type">'a</code> prompt</span> </pre> <div class="info"> The type of prompts.<br> </div> <br> <h4 id="4_FundamentalFunctions">Fundamental Functions</h4><br> <pre><span id="VALreturn"><span class="keyword">val</span> return</span> : <code class="type">'a -> 'a <a href="Cc.html#TYPEm">m</a></code></pre><div class="info"> <code class="code">return a_value</code><br> </div> <pre><span id="VALbind"><span class="keyword">val</span> bind</span> : <code class="type">'a <a href="Cc.html#TYPEm">m</a> -> ('a -> 'b <a href="Cc.html#TYPEm">m</a>) -> 'b <a href="Cc.html#TYPEm">m</a></code></pre><div class="info"> <code class="code">bind cc_monad f</code><br> </div> <pre><span id="VALrun"><span class="keyword">val</span> run</span> : <code class="type">'a <a href="Cc.html#TYPEm">m</a> -> 'a</code></pre><div class="info"> <h4 id="4_Runningthemonad">Running the monad</h4><br> </div> <br> <h4 id="4_Specificmonadmorphisms">Specific monad morphisms</h4><br> <pre><span id="VALnew_prompt"><span class="keyword">val</span> new_prompt</span> : <code class="type">unit -> 'a <a href="Cc.html#TYPEprompt">prompt</a> <a href="Cc.html#TYPEm">m</a></code></pre><div class="info"> <code class="code">new_prompt ()</code> <p> Create a new prompt that corresponds to the value of the type <code class="code">'a</code><br> </div> <pre><span id="VALpushP"><span class="keyword">val</span> pushP</span> : <code class="type">'a <a href="Cc.html#TYPEprompt">prompt</a> -> 'a <a href="Cc.html#TYPEm">m</a> -> 'a <a href="Cc.html#TYPEm">m</a></code></pre><div class="info"> <code class="code">pushP prompt m</code> <p> Push the <code class="code">prompt</code> and execute the computation <code class="code">m</code><br> </div> <pre><span id="VALshiftP"><span class="keyword">val</span> shiftP</span> : <code class="type">'a <a href="Cc.html#TYPEprompt">prompt</a> -> (('b <a href="Cc.html#TYPEm">m</a> -> 'a <a href="Cc.html#TYPEm">m</a>) -> 'a <a href="Cc.html#TYPEm">m</a>) -> 'b <a href="Cc.html#TYPEm">m</a></code></pre><div class="info"> <code class="code">shiftP prompt f</code> <p> Capture the delimited continuation up to the dynamically closest occurrence of <code class="code">prompt</code>, remove that continuation and execute <code class="code">f c</code>, where <code class="code">c</code> is the reified captured continuation enclosed in its own <code class="code">prompt</code>.<br> </div> </body></html>