<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.10">
<title>SuccessorML</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">


<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css">
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20201002</a>
</div>
</div>
<div id="header">
<h1>SuccessorML</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p>The purpose of <a href="http://sml-family.org/successor-ml/">successor ML</a>, or
sML for short, is to provide a vehicle for the continued evolution of
ML, using Standard ML as a starting point. The intention is for
successor ML to be a living, evolving dialect of ML that is responsive
to community needs and advances in language design, implementation,
and semantics.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_successorml_features_in_mlton">SuccessorML Features in MLton</h2>
<div class="sectionbody">
<div class="paragraph"><p>The following SuccessorML features have been implemented in MLton.
The features are disabled by default, and may be enabled utilizing the
feature&#8217;s corresponding <a href="MLBasisAnnotations">ML Basis annotation</a>
which is listed directly after the feature name.  In addition, the
<span class="monospaced">allowSuccessorML {false|true}</span> annotation can be used to
simultaneously enable all of the features.</p></div>
<div class="ulist"><ul>
<li>
<p>
<a id="DoDecls"></a>
<span class="monospaced">do</span> Declarations: <span class="monospaced">allowDoDecls {false|true}</span>
</p>
<div class="paragraph"><p>Allow a <span class="monospaced">do <em>exp</em></span> declaration form, which evaluates <em>exp</em> for its
side effects.  The following example uses a <span class="monospaced">do</span> declaration:</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">do</span><span class="w"> </span><span class="n">print</span><span class="w"> </span><span class="s">&quot;Hello world.</span><span class="se">\n</span><span class="s">&quot;</span><span class="w"></span>
</pre></div></div></div>
<div class="paragraph"><p>and is equivalent to:</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">val</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">print</span><span class="w"> </span><span class="s">&quot;Hello world.</span><span class="se">\n</span><span class="s">&quot;</span><span class="w"></span>
</pre></div></div></div>
</li>
<li>
<p>
<a id="ExtendedConsts"></a>
Extended Constants: <span class="monospaced">allowExtendedConsts {false|true}</span>
</p>
<div class="openblock">
<div class="content">
<div class="paragraph"><p>Allow or disallow all of the extended constants features.  This is a
proxy for all of the following annotations.</p></div>
<div class="ulist"><ul>
<li>
<p>
<a id="ExtendedNumConsts"></a>
Extended Numeric Constants: <span class="monospaced">allowExtendedNumConsts {false|true}</span>
</p>
<div class="paragraph"><p>Allow underscores as a separator in numeric constants and allow binary
integer and word constants.</p></div>
<div class="paragraph"><p>Underscores in a numeric constant must occur between digits and
consecutive underscores are allowed.</p></div>
<div class="paragraph"><p>Binary integer constants use the prefix <span class="monospaced">0b</span> and binary word constants
use the prefix <span class="monospaced">0wb</span>.</p></div>
<div class="paragraph"><p>The following example uses extended numeric constants (although it may
be incorrectly syntax highlighted):</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">val</span><span class="w"> </span><span class="n">pb</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="mi">0</span><span class="n">b10101</span><span class="w"></span>
<span class="k">val</span><span class="w"> </span><span class="n">nb</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="mi">~0</span><span class="n">b10_10_10</span><span class="w"></span>
<span class="k">val</span><span class="w"> </span><span class="n">wb</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="mi">0</span><span class="n">wb1010</span><span class="w"></span>
<span class="k">val</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="mi">4</span><span class="p">__</span><span class="mi">327</span><span class="p">__</span><span class="mi">829</span><span class="w"></span>
<span class="k">val</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="mf">6.022</span><span class="p">_</span><span class="mi">140</span><span class="p">_</span><span class="mf">9e23</span><span class="w"></span>
</pre></div></div></div>
</li>
<li>
<p>
<a id="ExtendedTextConsts"></a> Extended Text Constants: <span class="monospaced">allowExtendedTextConsts {false|true}</span>
</p>
<div class="paragraph"><p>Allow characters with integer codes &ge; 128 and &le; 247 that
correspond to syntactically well-formed UTF-8 byte sequences in text
constants.</p></div>
<div class="paragraph"><p>Any 1, 2, 3, or 4 byte sequence that can be properly decoded to a
binary number according to the UTF-8 encoding/decoding scheme is
allowed in a text constant (but invalid sequences are not explicitly
rejected) and denotes the corresponding sequence of characters with
integer codes &ge; 128 and &le; 247.  This feature enables "UTF-8
convenience" (but not comprehensive Unicode support); in particular,
it allows one to copy text from a browser and paste it into a string
constant in an editor and, furthermore, if the string is printed to a
terminal, then will (typically) appear as the original text.  The
following example uses UTF-8 byte sequences:</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">val</span><span class="w"> </span><span class="n">s1</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="n">String</span><span class="p">.</span><span class="n">string</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\240\159\130\161</span><span class="s">&quot;</span><span class="w"></span>
<span class="k">val</span><span class="w"> </span><span class="n">s2</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="n">String</span><span class="p">.</span><span class="n">string</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="s">&quot;🂡&quot;</span><span class="w"></span>
<span class="k">val</span><span class="w"> </span><span class="p">_</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">print</span><span class="w"> </span><span class="p">(</span><span class="s">&quot;s1 --&gt; &quot;</span><span class="w"> </span><span class="n">^</span><span class="w"> </span><span class="n">s1</span><span class="w"> </span><span class="n">^</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span><span class="w"></span>
<span class="k">val</span><span class="w"> </span><span class="p">_</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">print</span><span class="w"> </span><span class="p">(</span><span class="s">&quot;s2 --&gt; &quot;</span><span class="w"> </span><span class="n">^</span><span class="w"> </span><span class="n">s2</span><span class="w"> </span><span class="n">^</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span><span class="w"></span>
<span class="k">val</span><span class="w"> </span><span class="p">_</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">print</span><span class="w"> </span><span class="p">(</span><span class="s">&quot;String.size s1 --&gt; &quot;</span><span class="w"> </span><span class="n">^</span><span class="w"> </span><span class="n">Int</span><span class="p">.</span><span class="n">toString</span><span class="w"> </span><span class="p">(</span><span class="n">String</span><span class="p">.</span><span class="n">size</span><span class="w"> </span><span class="n">s1</span><span class="p">)</span><span class="w"> </span><span class="n">^</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span><span class="w"></span>
<span class="k">val</span><span class="w"> </span><span class="p">_</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">print</span><span class="w"> </span><span class="p">(</span><span class="s">&quot;String.size s2 --&gt; &quot;</span><span class="w"> </span><span class="n">^</span><span class="w"> </span><span class="n">Int</span><span class="p">.</span><span class="n">toString</span><span class="w"> </span><span class="p">(</span><span class="n">String</span><span class="p">.</span><span class="n">size</span><span class="w"> </span><span class="n">s2</span><span class="p">)</span><span class="w"> </span><span class="n">^</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span><span class="w"></span>
<span class="k">val</span><span class="w"> </span><span class="p">_</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">print</span><span class="w"> </span><span class="p">(</span><span class="s">&quot;s1 = s2 --&gt; &quot;</span><span class="w"> </span><span class="n">^</span><span class="w"> </span><span class="n">Bool</span><span class="p">.</span><span class="n">toString</span><span class="w"> </span><span class="p">(</span><span class="n">s1</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">s2</span><span class="p">)</span><span class="w"> </span><span class="n">^</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span><span class="w"></span>
</pre></div></div></div>
<div class="paragraph"><p>and, when compiled and executed, will display:</p></div>
<div class="listingblock">
<div class="content monospaced">
<pre>s1 --&gt; 🂡
s2 --&gt; 🂡
String.size s1 --&gt; 4
String.size s2 --&gt; 4
s1 = s2 --&gt; true</pre>
</div></div>
<div class="paragraph"><p>Note that the <span class="monospaced">String.string</span> type corresponds to any sequence of
8-bit values, including invalid UTF-8 sequences; hence the string
constant <span class="monospaced">"\192"</span> (a UTF-8 leading byte with no UTF-8 continuation
byte) is valid.  Similarly, the <span class="monospaced">Char.char</span> type corresponds to a
single 8-bit value; hence the char constant <span class="monospaced">#"α"</span> is not valid, as
the text constant <span class="monospaced">"α"</span> denotes a sequence of two 8-bit values.</p></div>
</li>
</ul></div>
</div></div>
</li>
<li>
<p>
<a id="LineComments"></a>
Line Comments: <span class="monospaced">allowLineComments {false|true}</span>
</p>
<div class="paragraph"><p>Allow line comments beginning with the token <span class="monospaced">(*)</span>.  The following
example uses a line comment:</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="cm">(*) This is a line comment</span>
</pre></div></div></div>
<div class="paragraph"><p>Line comments properly nest within block comments.  The following
example uses line comments nested within block comments:</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="cm">(*</span>
<span class="cm">val x = 4 (*) This is a line comment</span>
<span class="cm">*)</span>

<span class="cm">(*</span>
<span class="cm">val y = 5 (*) This is a line comment *)</span>
<span class="cm">*)</span>
</pre></div></div></div>
</li>
<li>
<p>
<a id="OptBar"></a>
Optional Pattern Bars: <span class="monospaced">allowOptBar {false|true}</span>
</p>
<div class="paragraph"><p>Allow a bar to appear before the first match rule of a <span class="monospaced">case</span>, <span class="monospaced">fn</span>,
or <span class="monospaced">handle</span> expression, allow a bar to appear before the first
function-value binding of a <span class="monospaced">fun</span> declaration, and allow a bar to
appear before the first constructor binding or description of a
<span class="monospaced">datatype</span> declaration or specification.  The following example uses
leading bars in a <span class="monospaced">datatype</span> declaration, a <span class="monospaced">fun</span> declaration, and a
<span class="monospaced">case</span> expression:</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">datatype</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">  </span><span class="p">|</span><span class="w"> </span><span class="n">C</span><span class="w"></span>
<span class="w">  </span><span class="p">|</span><span class="w"> </span><span class="n">B</span><span class="w"></span>
<span class="w">  </span><span class="p">|</span><span class="w"> </span><span class="n">A</span><span class="w"></span>

<span class="k">fun</span><span class="w"></span>
<span class="w">  </span><span class="p">|</span><span class="w"> </span><span class="n">f</span><span class="w"> </span><span class="n">NONE</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="mi">0</span><span class="w"></span>
<span class="w">  </span><span class="p">|</span><span class="w"> </span><span class="n">f</span><span class="w"> </span><span class="p">(</span><span class="n">SOME</span><span class="w"> </span><span class="n">t</span><span class="p">)</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">     </span><span class="p">(</span><span class="k">case</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="k">of</span><span class="w"></span>
<span class="w">        </span><span class="p">|</span><span class="w"> </span><span class="n">A</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="mi">1</span><span class="w"></span>
<span class="w">        </span><span class="p">|</span><span class="w"> </span><span class="n">B</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="mi">2</span><span class="w"></span>
<span class="w">        </span><span class="p">|</span><span class="w"> </span><span class="n">C</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="mi">3</span><span class="p">)</span><span class="w"></span>
</pre></div></div></div>
<div class="paragraph"><p>By eliminating the special case of the first element, this feature
allows for simpler refactoring (e.g., sorting the lines of the
<span class="monospaced">datatype</span> declaration&#8217;s constructor bindings to put the constructors
in alphabetical order).</p></div>
</li>
<li>
<p>
<a id="OptSemicolon"></a>
Optional Semicolons: <span class="monospaced">allowOptSemicolon {false|true}</span>
</p>
<div class="paragraph"><p>Allow a semicolon to appear after the last expression in a sequence or
<span class="monospaced">let</span>-body expression.  The following example uses a trailing
semicolon in the body of a <span class="monospaced">let</span> expression:</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">fun</span><span class="w"> </span><span class="n">h</span><span class="w"> </span><span class="n">z</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">  </span><span class="k">let</span><span class="w"></span>
<span class="w">    </span><span class="k">val</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="mi">3</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="n">z</span><span class="w"></span>
<span class="w">  </span><span class="k">in</span><span class="w"></span>
<span class="w">     </span><span class="n">f</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">;</span><span class="w"></span>
<span class="w">     </span><span class="n">g</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">;</span><span class="w"></span>
<span class="w">  </span><span class="k">end</span><span class="w"></span>
</pre></div></div></div>
<div class="paragraph"><p>By eliminating the special case of the last element, this feature
allows for simpler refactoring.</p></div>
</li>
<li>
<p>
<a id="OrPats"></a>
Disjunctive (Or) Patterns: <span class="monospaced">allowOrPats {false|true}</span>
</p>
<div class="paragraph"><p>Allow disjunctive (a.k.a., "or") patterns of the form <span class="monospaced"><em>pat<sub>1</sub></em> |
<em>pat<sub>2</sub></em></span>, which matches a value that matches either <span class="monospaced"><em>pat<sub>1</sub></em></span> or
<span class="monospaced"><em>pat<sub>2</sub></em></span>.  Disjunctive patterns have lower precedence than <span class="monospaced">as</span>
patterns and constraint patterns, much as <span class="monospaced">orelse</span> expressions have
lower precedence than <span class="monospaced">andalso</span> expressions and constraint
expressions.  Both sub-patterns of a disjunctive pattern must bind the
same variables with the same types.  The following example uses
disjunctive patterns:</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">datatype</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">A</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="n">int</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">B</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="n">int</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">C</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="n">int</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">D</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="n">int</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="n">int</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">E</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="n">int</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="n">int</span><span class="w"></span>

<span class="k">fun</span><span class="w"> </span><span class="n">f</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">  </span><span class="k">case</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="k">of</span><span class="w"></span>
<span class="w">     </span><span class="n">A</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">B</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">C</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="n">+</span><span class="w"> </span><span class="mi">1</span><span class="w"></span>
<span class="w">   </span><span class="p">|</span><span class="w"> </span><span class="n">D</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="w"> </span><span class="p">_)</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">E</span><span class="w"> </span><span class="p">(_,</span><span class="w"> </span><span class="n">x</span><span class="p">)</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="mi">2</span><span class="w"></span>
</pre></div></div></div>
</li>
<li>
<p>
<a id="RecordPunExps"></a>
Record Punning Expressions: <span class="monospaced">allowRecordPunExps {false|true}</span>
</p>
<div class="paragraph"><p>Allow record punning expressions, whereby an identifier <span class="monospaced"><em>vid</em></span> as an
expression row in a record expression denotes the expression row
<span class="monospaced"><em>vid</em> = <em>vid</em></span> (i.e., treating a label as a variable).  The following
example uses record punning expressions (and also record punning
patterns):</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">fun</span><span class="w"> </span><span class="n">incB</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">  </span><span class="k">case</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="p">{</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">,</span><span class="w"> </span><span class="n">c</span><span class="p">}</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="n">+</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="n">c</span><span class="p">}</span><span class="w"></span>
</pre></div></div></div>
<div class="paragraph"><p>and is equivalent to:</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">fun</span><span class="w"> </span><span class="n">incB</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">  </span><span class="k">case</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="p">{</span><span class="n">a</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">b</span><span class="p">,</span><span class="w"> </span><span class="n">c</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">c</span><span class="p">}</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="n">a</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="n">+</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="n">c</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">c</span><span class="p">}</span><span class="w"></span>
</pre></div></div></div>
</li>
<li>
<p>
<a id="SigWithtype"></a>
<span class="monospaced">withtype</span> in Signatures: <span class="monospaced">allowSigWithtype {false|true}</span>
</p>
<div class="paragraph"><p>Allow <span class="monospaced">withtype</span> to modify a <span class="monospaced">datatype</span> specification in a signature.
The following example uses <span class="monospaced">withtype</span> in a signature (and also
<span class="monospaced">withtype</span> in a declaration):</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">signature</span><span class="w"> </span><span class="n">STREAM</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">  </span><span class="k">sig</span><span class="w"></span>
<span class="w">    </span><span class="k">datatype</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">u</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">Nil</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">Cons</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">t</span><span class="w"></span>
<span class="w">    </span><span class="k">withtype</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">u</span><span class="w"></span>
<span class="w">  </span><span class="k">end</span><span class="w"></span>
<span class="k">structure</span><span class="w"> </span><span class="n">Stream</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="n">STREAM</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">  </span><span class="k">struct</span><span class="w"></span>
<span class="w">    </span><span class="k">datatype</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">u</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">Nil</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">Cons</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">t</span><span class="w"></span>
<span class="w">    </span><span class="k">withtype</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">u</span><span class="w"></span>
<span class="w">  </span><span class="k">end</span><span class="w"></span>
</pre></div></div></div>
<div class="paragraph"><p>and is equivalent to:</p></div>
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">signature</span><span class="w"> </span><span class="n">STREAM</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">  </span><span class="k">sig</span><span class="w"></span>
<span class="w">    </span><span class="k">datatype</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">u</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">Nil</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">Cons</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="p">(</span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">u</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">u</span><span class="w"></span>
<span class="w">  </span><span class="k">end</span><span class="w"></span>
<span class="k">structure</span><span class="w"> </span><span class="n">Stream</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="n">STREAM</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">  </span><span class="k">struct</span><span class="w"></span>
<span class="w">    </span><span class="k">datatype</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">u</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">Nil</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="n">Cons</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">*</span><span class="w"> </span><span class="p">(</span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">u</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">&#39;a</span><span class="w"> </span><span class="n">u</span><span class="w"></span>
<span class="w">  </span><span class="k">end</span><span class="w"></span>
</pre></div></div></div>
</li>
<li>
<p>
<a id="VectorExpsAndPats"></a>
Vector Expressions and Patterns: <span class="monospaced">allowVectorExpsAndPats {false|true}</span>
</p>
<div class="openblock">
<div class="content">
<div class="paragraph"><p>Allow or disallow vector expressions and vector patterns.  This is a
proxy for all of the following annotations.</p></div>
<div class="ulist"><ul>
<li>
<p>
<a id="VectorExps"></a>
Vector Expressions: <span class="monospaced">allowVectorExps {false|true}</span>
</p>
<div class="paragraph"><p>Allow vector expressions of the form <span class="monospaced">#[<em>exp<sub>0</sub></em>, <em>exp<sub>1</sub></em>, &#8230;, <em>exp<sub>n-1</sub></em>]</span> (where <em>n ≥ 0</em>).  The expression has type <span class="monospaced"><em>τ</em> vector</span> when each expression <em>exp<sub>i</sub></em> has type <span class="monospaced"><em>τ</em></span>.</p></div>
</li>
<li>
<p>
<a id="VectorPats"></a>
Vector Patterns: <span class="monospaced">allowVectorPats {false|true}</span>
</p>
<div class="paragraph"><p>Allow vector patterns of the form <span class="monospaced">#[<em>pat<sub>0</sub></em>, <em>pat<sub>1</sub></em>, &#8230;, <em>pat<sub>n-1</sub></em>]</span> (where <em>n ≥ 0</em>).  The pattern matches values of type <span class="monospaced"><em>τ</em> vector</span> when each pattern <em>pat<sub>i</sub></em> matches values of type <span class="monospaced"><em>τ</em></span>.</p></div>
</li>
</ul></div>
</div></div>
</li>
</ul></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
