4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
6 <title>XMLSimplifyTypes</title>
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
19 <body class="article">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
26 <h1>XMLSimplifyTypes</h1>
30 <div class="sectionbody">
31 <div class="paragraph"><p><a href="XMLSimplifyTypes">XMLSimplifyTypes</a> is an optimization pass for the <a href="XML">XML</a>
32 <a href="IntermediateLanguage">IntermediateLanguage</a>, invoked from <a href="XMLSimplify">XMLSimplify</a>.</p></div>
36 <h2 id="_description">Description</h2>
37 <div class="sectionbody">
38 <div class="paragraph"><p>This pass simplifies types in an <a href="XML">XML</a> program, eliminating all
39 unused type arguments.</p></div>
43 <h2 id="_implementation">Implementation</h2>
44 <div class="sectionbody">
45 <div class="ulist"><ul>
48 <a href="https://github.com/MLton/mlton/blob/master/mlton/xml/simplify-types.sig"><span class="monospaced">simplify-types.sig</span></a>
53 <a href="https://github.com/MLton/mlton/blob/master/mlton/xml/simplify-types.fun"><span class="monospaced">simplify-types.fun</span></a>
60 <h2 id="_details_and_notes">Details and Notes</h2>
61 <div class="sectionbody">
62 <div class="paragraph"><p>It first computes a simple fixpoint on all the <span class="monospaced">datatype</span> declarations
63 to determine which <span class="monospaced">datatype</span> <span class="monospaced">tycon</span> args are actually used. Then it
64 does a single pass over the program to determine which polymorphic
65 declaration type variables are used, and rewrites types to eliminate
66 unused type arguments.</p></div>
67 <div class="paragraph"><p>This pass should eliminate any spurious duplication that the
68 <a href="Monomorphise">Monomorphise</a> pass might perform due to phantom types.</p></div>
72 <div id="footnotes"><hr></div>
74 <div id="footer-text">
76 <div id="footer-badges">