Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > 7e661e52354c3398928bf511f54fefa4 > files > 51

ocaml-extlib-1.5.1-4.mga1.i586.rpm

<!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="index.html">
<link rel="previous" href="OptParse.html">
<link rel="next" href="PMap.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Base64" rel="Chapter" href="Base64.html">
<link title="BitSet" rel="Chapter" href="BitSet.html">
<link title="Dllist" rel="Chapter" href="Dllist.html">
<link title="DynArray" rel="Chapter" href="DynArray.html">
<link title="Enum" rel="Chapter" href="Enum.html">
<link title="ExtArray" rel="Chapter" href="ExtArray.html">
<link title="ExtHashtbl" rel="Chapter" href="ExtHashtbl.html">
<link title="ExtList" rel="Chapter" href="ExtList.html">
<link title="ExtString" rel="Chapter" href="ExtString.html">
<link title="Global" rel="Chapter" href="Global.html">
<link title="IO" rel="Chapter" href="IO.html">
<link title="OptParse" rel="Chapter" href="OptParse.html">
<link title="Option" rel="Chapter" href="Option.html">
<link title="PMap" rel="Chapter" href="PMap.html">
<link title="RefList" rel="Chapter" href="RefList.html">
<link title="Std" rel="Chapter" href="Std.html">
<link title="UChar" rel="Chapter" href="UChar.html">
<link title="UTF8" rel="Chapter" href="UTF8.html">
<link title="Unzip" rel="Chapter" href="Unzip.html"><title>Option</title>
</head>
<body>
<div class="navbar"><a href="OptParse.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;<a href="PMap.html">Next</a>
</div>
<center><h1>Module <a href="type_Option.html">Option</a></h1></center>
<br>
<pre><span class="keyword">module</span> Option: <code class="code">sig</code> <a href="Option.html">..</a> <code class="code">end</code></pre>Functions for the option type.
<p>

    Options are an Ocaml standard type that can be either <code class="code">None</code> (undefined)
	or <code class="code">Some x</code> where x can be any value. Options are widely used in Ocaml
	to represent undefined values (a little like NULL in C, but in a type
	and memory safe way). This module adds some functions for working with
	options.<br>
<hr width="100%">
<pre><span id="VALmay"><span class="keyword">val</span> may</span> : <code class="type">('a -> unit) -> 'a option -> unit</code></pre><div class="info">
<code class="code">may f (Some x)</code> calls <code class="code">f x</code> and <code class="code">may f None</code> does nothing.<br>
</div>
<pre><span id="VALmap"><span class="keyword">val</span> map</span> : <code class="type">('a -> 'b) -> 'a option -> 'b option</code></pre><div class="info">
<code class="code">map f (Some x)</code> returns <code class="code">Some (f x)</code> and <code class="code">map None</code> returns <code class="code">None</code>.<br>
</div>
<pre><span id="VALdefault"><span class="keyword">val</span> default</span> : <code class="type">'a -> 'a option -> 'a</code></pre><div class="info">
<code class="code">default x (Some v)</code> returns <code class="code">v</code> and <code class="code">default x None</code> returns <code class="code">x</code>.<br>
</div>
<pre><span id="VALmap_default"><span class="keyword">val</span> map_default</span> : <code class="type">('a -> 'b) -> 'b -> 'a option -> 'b</code></pre><div class="info">
<code class="code">map_default f x (Some v)</code> returns <code class="code">f v</code> and <code class="code">map_default f x None</code>
	returns <code class="code">x</code>.<br>
</div>
<pre><span id="VALis_none"><span class="keyword">val</span> is_none</span> : <code class="type">'a option -> bool</code></pre><div class="info">
<code class="code">is_none None</code> returns <code class="code">true</code> otherwise it returns <code class="code">false</code>.<br>
</div>
<pre><span id="VALis_some"><span class="keyword">val</span> is_some</span> : <code class="type">'a option -> bool</code></pre><div class="info">
<code class="code">is_some (Some x)</code> returns <code class="code">true</code> otherwise it returns <code class="code">false</code>.<br>
</div>
<pre><span id="VALget"><span class="keyword">val</span> get</span> : <code class="type">'a option -> 'a</code></pre><div class="info">
<code class="code">get (Some x)</code> returns <code class="code">x</code> and <code class="code">get None</code> raises <code class="code">No_value</code>.<br>
</div>
<pre><span id="EXCEPTIONNo_value"><span class="keyword">exception</span> No_value</span></pre>
<div class="info">
Raised when calling <code class="code">get None</code>.<br>
</div>
</body></html>