Created
November 1, 2016 01:34
-
-
Save deech/64a8942eb7e2fc0364e8ee4c80f2780c to your computer and use it in GitHub Desktop.
Shen Union type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(datatype whisky | |
if (element? X [bourbon scotch]) | |
________________________________ | |
X : whisky;) | |
(datatype beer | |
if (element? X [lager stout]) | |
______________________________ | |
X : beer;) | |
(datatype union | |
X : A; | |
________________________ | |
X : (mode (union A B) -); | |
X : B; | |
_________________________ | |
X : (mode (union A B) -);) | |
(define union-test | |
{(union whisky beer) --> (union whisky beer) --> (list (union whisky beer))} | |
W B -> [W B]) | |
\* | |
> (union-test lager scotch) | |
[lager scotch] : (list (union whisky beer)) | |
*\ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment