<!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="Cc.html"> <link rel="next" href="Io.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"><title>Exception</title> </head> <body> <div class="navbar"><a href="Cc.html">Previous</a> <a href="pa_monad.html">Up</a> <a href="Io.html">Next</a> </div> <center><h1>Module <a href="type_Exception.html">Exception</a></h1></center> <br> <pre><span class="keyword">module</span> Exception: <code class="code">sig</code> <a href="Exception.html">..</a> <code class="code">end</code></pre>Exception is a purely functional replacement of OCaml's built-in exceptions. <p> To indicate a normal value use <a href="Exception.html#VALreturn"><code class="code">Exception.return</code></a>. For exceptional conditions use <a href="Exception.html#VALthrow"><code class="code">Exception.throw</code></a>. Function <a href="Exception.html#VALcatch"><code class="code">Exception.catch</code></a> splices in an exception handler into the thread of control. Execute an exception monad with <a href="Exception.html#VALrun"><code class="code">Exception.run</code></a>.<br> <hr width="100%"> <pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type">('a, 'b)</code> t </pre> <div class="info"> Type of an exception monad. <code class="code">'left</code> is the exception's type and <code class="code">'right</code> is the normal value's type.<br> </div> <pre><span class="keyword">val</span> <a name="VALbind"></a>bind : <code class="type">('a, 'b) <a href="Exception.html#TYPEt">t</a> -> ('b -> ('a, 'c) <a href="Exception.html#TYPEt">t</a>) -> ('a, 'c) <a href="Exception.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">bind a_monad a_function</code> <p> Apply <code class="code">a_function</code> to <code class="code">a_monad</code> producing another monad. <code class="code">a_function</code> takes a normal value as argument and returns a monad.<br> </div> <pre><span class="keyword">val</span> <a name="VALreturn"></a>return : <code class="type">'a -> ('b, 'a) <a href="Exception.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALthrow"></a>throw : <code class="type">'a -> ('a, 'b) <a href="Exception.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALcatch"></a>catch : <code class="type">('a, 'b) <a href="Exception.html#TYPEt">t</a> -> ('a -> ('c, 'b) <a href="Exception.html#TYPEt">t</a>) -> ('c, 'b) <a href="Exception.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALrun"></a>run : <code class="type">('a -> 'b) -> ('c -> 'b) -> ('a, 'c) <a href="Exception.html#TYPEt">t</a> -> 'b</code></pre></body></html>