Mathematics and Computation

A blog about mathematics for computers

Sub and Poly, two new additions to the PL Zoo

I have added two new languages to the Programming Languages Zoo which demonstrate polymorphic type inference and type checking with subtypes.

The first one is poly, which is an extension of MiniHaskell with parametric polymorphism and type inference. In fact, evaluation is exactly the same as in MiniHaskell, the only difference is omission of type information in the source code and type inference rather than type checking. Have a look at the implementation of type inferrence if you would like to see a very simple algorithm for inferring polymorphic types.

The second language is sub, which is an extension of MiniML with records and subypes. Have a look at the implementation of type checking if you would like to see a very simple algorithm for type checking in the presence of subtyping.

Comments

[...] have another hosting service at the moment). It’s a modification of the toy language Poly from Andrej Bauer’s Programming Language Zoo. You’ll need OCaml to compile it. Please [...]

How to comment on this blog: At present comments are disabled because the relevant script died. If you comment on this post on Mastodon and mention andrejbauer@mathstodon.xyz, I will gladly respond. You are also welcome to contact me directly.