This file is indexed.

/usr/share/doc/mlton/guide/SyntacticConventions 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
<!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>SyntacticConventions - 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%;">
      SyntacticConventions
    <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">
Here are a number of syntactic conventions useful for programming in SML. <p>
<ol>
<li>
<a href="#head-9239ee2cda84eca4c3440e2a7b50148af67da3d4">General</a></li>
<li>
<a href="#head-649d2864df18704de32e689e69e63f2483e8b76e">Identifiers</a></li>
<li>
<a href="#head-93b9e289e2842469d001eccf7ad5d79f3c302dc9">Types</a></li>
<li>
<a href="#head-68836c550ee20fae0e06b2994e76a40348d2fc30">Core</a></li>
<li>
<a href="#head-e4cf0392296064579858651f856889aadbc2805e">Signatures</a></li>
<li>
<a href="#head-c64b6d8ab6a3167af6b211df05198e555a8951eb">Structures</a></li>
<li>
<a href="#head-23ac4cb38bc668a9233ce693377f7f5c3879f104">Functors</a></li>
</ol>

 
</p>
<h2 id="head-9239ee2cda84eca4c3440e2a7b50148af67da3d4">General</h2>

    <ul>

    <li>
<p>
 A line of code never exceeds 80 columns. 
</p>
</li>
    <li class="gap">
<p>
 Only split a syntactic entity across multiple lines if it doesn't  fit on one line within 80 columns. 
</p>
</li>
    <li class="gap">
<p>
 Use alphabetical order wherever possible. 
</p>
</li>
    <li class="gap">
<p>
 Avoid redundant parentheses. 
</p>
</li>
    <li class="gap">
<p>
 When using <tt>:</tt>, there is no space before the colon, and a  single space after it. 
</p>
</li>

    </ul>


<h2 id="head-649d2864df18704de32e689e69e63f2483e8b76e">Identifiers</h2>

    <ul>

    <li>
<p>
 Variables, record labels and type constructors begin with and use  small letters, using capital letters to separate words. 
<pre>cost
maxValue</pre> 
</p>
</li>
    <li class="gap">
<p>
 Variables that represent collections of objects (lists, arrays,  vectors, ...) are often suffixed with an <tt>s</tt>.  
<pre>xs
employees</pre>
</p>
</li>
    <li class="gap">
<p>
 Constructors, structure identifiers, and functor identifiers begin  with a capital letter.  
<pre>Queue
LinkedList</pre>
</p>
</li>
    <li class="gap">
<p>
 Signature identifiers are in all capitals, using <tt>_</tt> to  separate words.  
<pre>LIST
BINARY_HEAP</pre>
</p>
</li>

    </ul>


<h2 id="head-93b9e289e2842469d001eccf7ad5d79f3c302dc9">Types</h2>

    <ul>

    <li>
<p>
 Alphabetize record labels.  In a record type, there are spaces  after colons and commas, but not before colons or commas, or at the  delimiters <tt>{</tt> and <tt>}&nbsp;</tt>.  
<pre>{bar: int, foo: int}
</pre>
</p>
</li>
    <li class="gap">
<p>
 Only split a record type across multiple lines if it doesn't fit on  one line. If a record type must be split over multiple lines, put one  field per line.  
<pre>{bar: int,
 foo: real * real, 
 zoo: bool} </pre>
</p>
</li>
    <li class="gap">
<p>
 In a tuple type, there are spaces before and after each <tt>*</tt>.  
<pre>int * bool * real
</pre>
</p>
</li>
    <li class="gap">
<p>
 Only split a tuple type across multiple lines if it doesn't fit on  one line.  In a tuple type split over multiple lines, there is one  type per line, and the <tt>*</tt>s go at the beginning of the lines.  
<pre>int
* bool
* real
</pre> It may also be useful to parenthesize to make the grouping more  apparent.   
<pre>(int
 * bool
 * real)
</pre>
</p>
</li>
    <li class="gap">
<p>
 In an arrow type split over multiple lines, put the arrow at the  beginning of its line.   
<pre>int * real
-&gt; bool
</pre> It may also be useful to parenthesize to make the grouping more  apparent.  
<pre>(int * real
 -&gt; bool)
</pre>
</p>
</li>
    <li class="gap">
<p>
 Avoid redundant parentheses. 
</p>
</li>

        <ul>

        <li>
<p>
 Arrow types associate to the right, so write 
<pre>a -&gt; b -&gt; c</pre> not 
<pre>a -&gt; (b -&gt; c)</pre>
</p>
</li>
        <li class="gap">
<p>
 Type constructor application associates to the left, so write   
<pre>int ref list</pre> not 
<pre>(int ref) list</pre>
</p>
</li>
        <li class="gap">
<p>
 Type constructor application binds more tightly than a tuple type,   so write 
<pre>int list * bool list</pre> not 
<pre>(int list) * (bool list)</pre>
</p>
</li>
        <li class="gap">
<p>
 Tuple types bind more tightly than arrow types, so write 
<pre>int * bool -&gt; real
</pre> not 
<pre>(int * bool) -&gt; real</pre>
</p>
</li>

        </ul>



    </ul>


<h2 id="head-68836c550ee20fae0e06b2994e76a40348d2fc30">Core</h2>

    <ul>

    <li>
<p>
 A core expression or declaration split over multiple lines does not  contain any blank lines. 
</p>
</li>
    <li class="gap">
<p>
 A record field selector has no space between the  <tt>#</tt> and the record label.  So, write 
<pre class=code>
#foo
</PRE>
 not 
<pre class=code>
# foo
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A tuple has a space after each comma, but not before, and not at  the delimiters <tt>(</tt> <tt>)</tt>.  
<pre class=code>
(e1, e2, e3)
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A tuple split over multiple lines has one element per line, and the  commas go at the end of the lines.  
<pre class=code>
(e1,
 e2,
 e3)
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A list has a space after each comma, but not before, and not at the  delimiters <tt>[</tt> <tt>]</tt>. 
<pre class=code>
[e1, e2, e3]
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A list split over multiple lines has one element per line, and the  commas at the end of the lines. 
<pre class=code>
[e1,
 e2,
 e3]
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A record has spaces before and after <tt>=</tt>, a space after each  comma, and no space at the delimiters.  Field names appear in  alphabetical order.  
<pre class=code>
{bar = <B><FONT COLOR="#5F9EA0">13</FONT></B>, foo = true} 
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A sequence expression has a space after each semicolon, but not  before.  
<pre class=code>
(e1; e2; e3)
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A sequence expression split over multiple lines has one expression  per line, and the semicolons at the beginning of lines.  Lisp and  Scheme programmers may find this hard to read at first.  
<pre class=code>
(e1
 ; e2
 ; e3)
</PRE>
  <em>Rationale</em>: this makes it easy to visually spot the beginning of  each expression, which becomes more valuable as the expressions  themselves are split across multiple lines. 
</p>
</li>
    <li class="gap">
<p>
 An application expression has a space between the function and the  argument.  There are no parens unless the argument is a tuple (in  which case the parens are really part of the tuple, not the  application).  
<pre class=code>
f a
f (a1, a2, a3)
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 Avoid redundant parentheses.  Application associates to left, so  write 
<pre class=code>
f a1 a2 a3
</PRE>
 not 
<pre class=code>
((f a1) a2) a3
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 Infix operators have a space before and after the operator. 
<pre class=code>
x + y
x * y - z
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 Avoid redundant parentheses.  Use <a href="OperatorPrecedence">OperatorPrecedence</a>.  So, write 
<pre class=code>
x + y * z
</PRE>
 not 
<pre class=code>
x + (y * z)
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 An <tt>andalso</tt> expression split over multiple lines has the  <tt>andalso</tt> at the beginning of subsequent lines. 
<pre class=code>
e1
<B><FONT COLOR="#A020F0">andalso</FONT></B> e2
<B><FONT COLOR="#A020F0">andalso</FONT></B> e3
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A <tt>case</tt> expression is indented as follows 
<pre class=code>
<B><FONT COLOR="#A020F0">case</FONT></B> e1 <B><FONT COLOR="#A020F0">of</FONT></B>
   p1 =&gt; e1
 | p2 =&gt; e2
 | p3 =&gt; e3
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A <tt>datatype</tt>'s constructors are alphabetized.  
<pre class=code>
<B><FONT COLOR="#A020F0">datatype</FONT></B><B><FONT COLOR="#228B22"> t </FONT></B>=<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">A</FONT> </FONT></B>|<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">B</FONT> </FONT></B>|<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">C</FONT>
</FONT></B></PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A <tt>datatype</tt> declaration has a space before and after each  <tt>|</tt>. 
<pre class=code>
<B><FONT COLOR="#A020F0">datatype</FONT></B><B><FONT COLOR="#228B22"> t </FONT></B>=<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">A</FONT> </FONT></B>|<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">B</FONT> <B><FONT COLOR="#A020F0">of</FONT></B> int </FONT></B>|<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">C</FONT>
</FONT></B></PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A <tt>datatype</tt> split over multiple lines has one constructor per  line, with the <tt>|</tt> at the beginning of lines and the constructors  beginning 3 columns to the right of the <tt>datatype</tt>. 
<pre class=code>
<B><FONT COLOR="#A020F0">datatype</FONT></B><B><FONT COLOR="#228B22"> t </FONT></B>=<B><FONT COLOR="#228B22"> 
   <FONT COLOR="#B8860B">A</FONT> 
 </FONT></B>|<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">B</FONT> 
 </FONT></B>|<B><FONT COLOR="#228B22"> <FONT COLOR="#B8860B">C</FONT>
</FONT></B></PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A <tt>fun</tt> declaration may start its body on the subsequent line,  indented 3 spaces. 
<pre class=code>
<B><FONT COLOR="#A020F0">fun</FONT></B> f x y =
   <B><FONT COLOR="#A020F0">let</FONT></B>
      <B><FONT COLOR="#A020F0">val</FONT></B> z = x + y + z
   <B><FONT COLOR="#A020F0">in</FONT></B>
      z
   <B><FONT COLOR="#A020F0">end</FONT></B>
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 An <tt>if</tt> expression is indented as follows. 
<pre class=code>
<B><FONT COLOR="#A020F0">if</FONT></B> e1
   <B><FONT COLOR="#A020F0">then</FONT></B> e2
<B><FONT COLOR="#A020F0">else</FONT></B> e3
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A sequence of <tt>if</tt>-<tt>then</tt>-<tt>else</tt>s is indented as  follows. 
<pre class=code>
<B><FONT COLOR="#A020F0">if</FONT></B> e1
   <B><FONT COLOR="#A020F0">then</FONT></B> e2
<B><FONT COLOR="#A020F0">else</FONT></B> <B><FONT COLOR="#A020F0">if</FONT></B> e3
   <B><FONT COLOR="#A020F0">then</FONT></B> e4
<B><FONT COLOR="#A020F0">else</FONT></B> <B><FONT COLOR="#A020F0">if</FONT></B> e5
   <B><FONT COLOR="#A020F0">then</FONT></B> e6
<B><FONT COLOR="#A020F0">else</FONT></B> e7
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A <tt>let</tt> expression has the <tt>let</tt>, <tt>in</tt>, and <tt>end</tt>  on their own lines, starting in the same column.  Declarations and the  body are indented 3 spaces.  
<pre class=code>
<B><FONT COLOR="#A020F0">let</FONT></B>
   <B><FONT COLOR="#A020F0">val</FONT></B> x = <B><FONT COLOR="#5F9EA0">13</FONT></B>
   <B><FONT COLOR="#A020F0">val</FONT></B> y = <B><FONT COLOR="#5F9EA0">14</FONT></B>
<B><FONT COLOR="#A020F0">in</FONT></B>
   x + y
<B><FONT COLOR="#A020F0">end</FONT></B>
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A <tt>local</tt> declaration has the <tt>local</tt>, <tt>in</tt>, and  <tt>end</tt> on their own lines, starting in the same column.  Declarations are indented 3 spaces. 
<pre class=code>
<B><FONT COLOR="#0000FF">local</FONT></B>
   <B><FONT COLOR="#A020F0">val</FONT></B> x = <B><FONT COLOR="#5F9EA0">13</FONT></B>
<B><FONT COLOR="#0000FF">in</FONT></B>
   <B><FONT COLOR="#A020F0">val</FONT></B> y = x
<B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 An <tt>orelse</tt> expression split over multiple lines has the  <tt>orelse</tt> at the beginning of subsequent lines. 
<pre class=code>
e1
<B><FONT COLOR="#A020F0">orelse</FONT></B> e2
<B><FONT COLOR="#A020F0">orelse</FONT></B> e3
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A <tt>val</tt> declaration has a space before and after the  <tt>=</tt>. 
<pre class=code>
<B><FONT COLOR="#A020F0">val</FONT></B> p = e
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A <tt>val</tt> declaration can start the expression on the subsequent  line, indented 3 spaces. 
<pre class=code>
<B><FONT COLOR="#A020F0">val</FONT></B> p =
   <B><FONT COLOR="#A020F0">if</FONT></B> e1 <B><FONT COLOR="#A020F0">then</FONT></B> e2 <B><FONT COLOR="#A020F0">else</FONT></B> e3
</PRE>
 
</p>
</li>

    </ul>


<h2 id="head-e4cf0392296064579858651f856889aadbc2805e">Signatures</h2>

    <ul>

    <li>
<p>
 A <tt>signature</tt> declaration is indented as follows. 
<pre class=code>
<B><FONT COLOR="#0000FF">signature</FONT></B> FOO =
   <B><FONT COLOR="#0000FF">sig</FONT></B>
      <B><FONT COLOR="#A020F0">val</FONT></B> x: int
   <B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
  <em>Exception</em>: a signature declaration in a file to itself can omit  the indentation to save horizontal space. 
<pre class=code>
<B><FONT COLOR="#0000FF">signature</FONT></B> FOO =
<B><FONT COLOR="#0000FF">sig</FONT></B>

<B><FONT COLOR="#A020F0">val</FONT></B> x: int

<B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
    In this case, there should be a blank line after the <tt>sig</tt>  and before the <tt>end</tt>. 
</p>
</li>
    <li class="gap">
<p>
 A <tt>val</tt> specification has a space after the colon, but not  before.  
<pre class=code>
<B><FONT COLOR="#A020F0">val</FONT></B> x: int
</PRE>
  <em>Exception</em>: in the case of operators (like <tt>+</tt>), there is a  space before the colon to avoid lexing the colon as part of the  operator. 
<pre class=code>
<B><FONT COLOR="#A020F0">val</FONT></B> + : t * t -&gt; t
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 Alphabetize specifications in signatures.  
<pre class=code>
<B><FONT COLOR="#0000FF">sig</FONT></B> 
   <B><FONT COLOR="#A020F0">val</FONT></B> x: int 
   <B><FONT COLOR="#A020F0">val</FONT></B> y: bool 
<B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
 
</p>
</li>

    </ul>


<h2 id="head-c64b6d8ab6a3167af6b211df05198e555a8951eb">Structures</h2>

    <ul>

    <li>
<p>
 A <tt>structure</tt> declaration has a space on both sides of the  <tt>=</tt>. 
<pre class=code>
<B><FONT COLOR="#0000FF">structure</FONT></B> Foo = Bar
</PRE>
 
</p>
</li>
    <li class="gap">
<p>
 A <tt>structure</tt> declaration split over multiple lines is indented  as follows. 
<pre class=code>
<B><FONT COLOR="#0000FF">structure</FONT></B> S =
   <B><FONT COLOR="#0000FF">struct</FONT></B>
      <B><FONT COLOR="#A020F0">val</FONT></B> x = <B><FONT COLOR="#5F9EA0">13</FONT></B>
   <B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
  <em>Exception</em>: a structure declaration in a file to itself can omit  the indentation to save horizontal space. 
<pre class=code>
<B><FONT COLOR="#0000FF">structure</FONT></B> S =
<B><FONT COLOR="#0000FF">struct</FONT></B>

<B><FONT COLOR="#A020F0">val</FONT></B> x = <B><FONT COLOR="#5F9EA0">13</FONT></B>

<B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
    In this case, there should be a blank line after the <tt>struct</tt>  and before the <tt>end</tt>. 
</p>
</li>
    <li class="gap">
<p>
 Declarations in a <tt>struct</tt> are separated by blank lines.  
<pre class=code>
<B><FONT COLOR="#0000FF">struct</FONT></B>
   <B><FONT COLOR="#A020F0">val</FONT></B> x =
      <B><FONT COLOR="#A020F0">let</FONT></B>
         y = <B><FONT COLOR="#5F9EA0">13</FONT></B>
      <B><FONT COLOR="#A020F0">in</FONT></B> 
         y + <B><FONT COLOR="#5F9EA0">1</FONT></B>
      <B><FONT COLOR="#A020F0">end</FONT></B>

   <B><FONT COLOR="#A020F0">val</FONT></B> z = <B><FONT COLOR="#5F9EA0">14</FONT></B>
<B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
 
</p>
</li>

    </ul>


<h2 id="head-23ac4cb38bc668a9233ce693377f7f5c3879f104">Functors</h2>

    <ul>

    <li>
<p>
 A <tt>functor</tt> declaration has spaces after each <tt>:</tt> (or  <tt>:&gt;</tt>) but not before, and a space before and after the  <tt>=</tt>.  It is indented as follows 
<pre class=code>
<B><FONT COLOR="#0000FF">functor</FONT></B> Foo (S: FOO_ARG): FOO =
   <B><FONT COLOR="#0000FF">struct</FONT></B>
       <B><FONT COLOR="#A020F0">val</FONT></B> x = S.x
   <B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
  <em>Exception</em>: a functor declaration in a file to itself can omit  the indentation to save horizontal space. 
<pre class=code>
<B><FONT COLOR="#0000FF">functor</FONT></B> Foo (S: FOO_ARG): FOO =
<B><FONT COLOR="#0000FF">struct</FONT></B>

<B><FONT COLOR="#A020F0">val</FONT></B> x = S.x

<B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
    In this case, there should be a blank line after the <tt>struct</tt>  and before the <tt>end</tt>. 
</p>
</li>
</ul>

</div>



<p>
<hr>
Last edited on 2009-01-08 15:44:46 by <span title="fenrir.uchicago.edu"><a href="MatthewFluet">MatthewFluet</a></span>.
</body></html>