This file is indexed.

/usr/share/doc/mlton/guide/ShowBasis is in mlton-doc 20100608-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="robots" content="index,nofollow">



<title>ShowBasis - MLton Standard ML Compiler (SML Compiler)</title>
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="all" href="common.css">
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="screen" href="screen.css">
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="print" href="print.css">


<link rel="Start" href="Home">


</head>

<body lang="en" dir="ltr">

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-833377-1";
urchinTracker();
</script>
<table bgcolor = lightblue cellspacing = 0 style = "border: 0px;" width = 100%>
  <tr>
    <td style = "
		border: 0px;
		color: darkblue; 
		font-size: 150%;
		text-align: left;">
      <a class = mltona href="Home">MLton MLTONWIKIVERSION</a>
    <td style = "
		border: 0px;
		font-size: 150%;
		text-align: center;
		width: 50%;">
      ShowBasis
    <td style = "
		border: 0px;
		text-align: right;">
      <table cellspacing = 0 style = "border: 0px">
        <tr style = "vertical-align: middle;">
      </table>
  <tr style = "background-color: white;">
    <td colspan = 3
	style = "
		border: 0px;
		font-size:70%;
		text-align: right;">
      <a href = "Home">Home</a>
      &nbsp;<a href = "TitleIndex">Index</a>
      &nbsp;
</table>
<div id="content" lang="en" dir="ltr">
MLton has a flag, <tt>-show-basis&nbsp;</tt> <em>file</em>, that causes MLton to pretty print to <em>file</em> the basis defined by the input program.  For example, if <tt>foo.sml</tt> contains 
<pre class=code>
<B><FONT COLOR="#A020F0">fun</FONT></B> f x = x + <B><FONT COLOR="#5F9EA0">1</FONT></B>
</PRE>
<p>
 then <tt>mlton&nbsp;-show-basis&nbsp;foo.basis&nbsp;foo.sml</tt> will create <tt>foo.basis</tt> with the following contents. 
<pre>val f: int -&gt; int
</pre>If you only want to see the basis and do not wish to compile the program, you can call MLton with <tt>-stop&nbsp;tc</tt>. 
</p>
<h2 id="head-f68fa1f6c99a6935aec560696799f2414d893d6f">Displaying signatures</h2>
<p>
When displaying signatures, MLton prefixes types defined in the signature them with <tt>?.</tt> to distinguish them from types defined in the environment.  For example,  
<pre class=code>
<B><FONT COLOR="#0000FF">signature</FONT></B> SIG =
   <B><FONT COLOR="#0000FF">sig</FONT></B>
      <B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> t
      </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> x: t * int -&gt; unit
   <B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
 is displayed as 
<pre>signature SIG = 
   sig
      type t = ?.t
      val x: (?.t * int) -&gt; unit
   end
</pre>Notice that <tt>int</tt> occurs without the <tt>?.</tt> prefix. 
</p>
<p>
MLton also uses a canonical name for each type in the signature, and that name is used everywhere for that type, no matter what the input signature looked like.  For example: 
<pre class=code>
<B><FONT COLOR="#0000FF">signature</FONT></B> SIG =
   <B><FONT COLOR="#0000FF">sig</FONT></B>
      <B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> t
      </FONT></B><B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> u </FONT></B>=<B><FONT COLOR="#228B22"> t
      </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> x: t
      <B><FONT COLOR="#A020F0">val</FONT></B> y: u
   <B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
 is displayed as 
<pre>signature SIG = 
   sig
      type t = ?.t
      type u = ?.t
      val x: ?.t
      val y: ?.t
   end
</pre>
</p>
<p>
Canonical names are always relative to the "top" of the signature, even when used in nested substructures.  For example: 
<pre class=code>
<B><FONT COLOR="#0000FF">signature</FONT></B> S =
   <B><FONT COLOR="#0000FF">sig</FONT></B>
      <B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> t
      </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> w: t
      <B><FONT COLOR="#0000FF">structure</FONT></B> U:
         <B><FONT COLOR="#0000FF">sig</FONT></B>
            <B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> u
            </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> x: t
            <B><FONT COLOR="#A020F0">val</FONT></B> y: u
         <B><FONT COLOR="#0000FF">end</FONT></B>
      <B><FONT COLOR="#A020F0">val</FONT></B> z: U.u
   <B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
 is displayed as 
<pre>signature S = 
   sig
      type t = ?.t
      val w: ?.t
      val z: ?.U.u
      structure U:
         sig
            type u = ?.U.u
            val x: ?.t
            val y: ?.U.u
         end
   end
</pre>
</p>
<h2 id="head-c6c2aa845cc7b36e66f2c4aa799b976c96116919">Displaying structures</h2>
<p>
When displaying structures, MLton uses signature constraints wherever possible, combined with <tt>where&nbsp;type</tt> clauses to specify the meanings of the types defined within the signature. 
</p>

<pre class=code>
<B><FONT COLOR="#0000FF">signature</FONT></B> SIG =
   <B><FONT COLOR="#0000FF">sig</FONT></B>
      <B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> t
      </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> x: t
   <B><FONT COLOR="#0000FF">end</FONT></B>
<B><FONT COLOR="#0000FF">structure</FONT></B> S: SIG =
   <B><FONT COLOR="#0000FF">struct</FONT></B>
      <B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> t </FONT></B>=<B><FONT COLOR="#228B22"> int
      </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> x = <B><FONT COLOR="#5F9EA0">13</FONT></B>
   <B><FONT COLOR="#0000FF">end</FONT></B>
<B><FONT COLOR="#0000FF">structure</FONT></B> S2:&gt; SIG = S
</PRE>
<p>
 is displayed as 
<pre>structure S: SIG
             where type t = int
structure S2: SIG
              where type t = S2.t
signature SIG = 
   sig
      type t = ?.t
      val x: ?.t
   end
</pre>
</p>
</div>



<p>
<hr>
Last edited on 2005-12-02 01:48:03 by <span title="ppp-71-139-183-221.dsl.snfc21.pacbell.net"><a href="StephenWeeks">StephenWeeks</a></span>.
</body></html>