Skip to content

Commit 8c0dcec

Browse files
author
Jeremy Siek
committed
added docs for existentials
1 parent 24ae44f commit 8c0dcec

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

artifact/index.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,36 @@ <h3>Syntactic differences from the paper:</h3>
186186
<td><code>let x : T = e<sub>1</sub> in e<sub>2</sub></code></td>
187187
<td>Let expressions require a type annotation.</td>
188188
</tr>
189+
190+
<tr>
191+
<td></td>
192+
<td><code>exists X. T</code></td>
193+
<td>Existential types are provided by encoding into universals</td>
194+
</tr>
195+
196+
<tr>
197+
<td></td>
198+
<td><code>pack T<sub>1</sub>, e in X. T<sub>2</sub></code>
199+
<td>Create an existential package from the value of <code>e</code>,
200+
hiding type <code>T<sub>1</sub></code> as <code>X</code>
201+
inside <code>T<sub>2</sub></code>.
202+
Expression <code>e</code> should have type
203+
<code>T<sub>2</sub>[T<sub>1</sub>/X]</code>.
204+
The result type is <code>exists X. T<sub>2</sub></code>. </td>
205+
</tr>
206+
207+
<tr>
208+
<td></td>
209+
<td><code>unpack[T<sub>1</sub>,T<sub>2</sub>] X,x = e<sub>1</sub> in e<sub>2</sub> </code></td>
210+
<td>Unpack an existential. The expression <code>e<sub>1</sub></code>
211+
should have type <code>exists X. T<sub>1</sub></code>
212+
and expression <code>e<sub>2</sub></code> should have
213+
type <code>T<sub>2</sub></code>. The variable
214+
<code>x</code> has type <code>T<sub>1</sub></code> and is
215+
in scope for <code>e<sub>2</sub></code>.
216+
</td>
217+
</tr>
218+
189219
</table>
190220

191221
<!--

0 commit comments

Comments
 (0)