/stagedtt

🪆 A Staged Type Theory

Primary LanguageOCamlApache License 2.0Apache-2.0

🪆 Stagedtt

Stagedtt is an experimental implementation of a staged dependent type theory.

âš  stagedtt is currently experimental, and we will break things!

Installation

As stagedtt uses algaeff for effects, we will need to use a version of the OCaml compiler that supports effects. Begin by running the following command:

opam switch create stagedtt 5.0.0+trunk && eval $(opam env)

This will create a new opam switch for stagedtt.

Next, we will need to add the OCaml 5 alpha repository for opam, as some packages we need haven’t yet released versions that are compatible with OCaml 5. We can do that with the following command:

opam repo add alpha git+https://github.com/kit-ty-kate/opam-alpha-repository.git

Next, run the following 2 commands to install stagedtt

opam install . --with-test

Usage

To run stagedtt on a file, we can use the stagedtt load command like so:

stagedtt load ./examples/demo.stt

As stagedtt is very much under construction, documentation is currently lacking. Your best bet is to look at the examples folder to see how the language works.

Development

We use dune as our build tool. After making some changes, simply run the following command to compile the code.

dune build

If you want to run stagedtt, the best way to do so is as follows:

dune exec stagedtt -- load ./examples/demo.stt

To run the test suite, we can use the following command:

dune build @runtest

stagedtt also has a small benchmarking suite. To run it, use the following command:

dune build @bench

Editor Tooling

As of <2022-05-12 Thu>, the OCaml 5 ecosystem is still somewhat immature, so we have to do a bit of footwork to get our tooling installed. The following instructions assume that we already have a working stagedtt switch set up. Furthermore, we will be installing merlin. Other tools may have different requirements, but the process should be similar.

First, we will need to add some pins for some merlin deps.

opam switch add dot-merlin-reader git+https://github.com/ocaml/merlin#500

Then, we can install merlin as per usual.

opam install merlin 

References

This work is inspired by some of the work by András Kovács, namely smalltt and staged.