Some haskell code to implement some simple semantic subtyping algorithms.
For more info on how to implement such systems, see the following (those works include references to the more theoretical foundations of this work):
-
Giuseppe Castagna. Covariance and Contravariance: a fresh look at an old issue (a primer in advanced type systems for learning functional programmers). 2013. Unpublished manuscript, periodically updated. (a link should be found here https://www.irif.fr/~gc/)
-
Andrew M. Kent. Down and Dirty with Semantic Set-theoretic Types (a tutorial). 2018. Unpublished, periodically updated. https://pnwamk.github.io/sst-tutorial/