Type checker implementation
This is part of the supplementary material. This folder contains the code for the type checker as well as a simple test.
The code structure follows the common
stack project structure. The
src folder contains the different extensions to the compiler. All the extensions contain two files:
Typechecker.hs contains the type checking code; the
AST.hs contains the abstract syntax tree of the language as well as helper functions.
If you wish to follow the extension order as defined in the paper, please read the code in the folders according to this order:
Final, contains all the extensions
To build the project, one needs to have the following requirements:
If you do not have
stack, please follow their installation instructions.
To run the simple tests, just type
stack test. The tests showcase how the compiler gives more information as we add more extensions. The use of the phantom types to type state cannot be shown, but the reader is welcome to visit the file
PhantomPhases/Typechecker.hs and test our example from Section 7 of the paper (running
stack build to check that GHC throws an error).