In this second lecture we have looked at type-safe evaluation of our intrinsically-typed terms for expressions, statements, and programs. Dependent types are cool and ensures that our well-typed programs do not go wrong.

We have seen how to:

Realising Ola

We have purposefully not discussed evaluating our core language Ola Rather, we have now looked at all the moving pieces that you will need to do so.

The steps required, will be to integrate the knowledge of evaluating heaps into the language with statements we described earlier.

Using your knowledge of working with intrinsically-typed heaps construct an evaluation function for the language defined in lecture 1.

Realising Olaf

By following the exercises you will have the core terms for realising Ola the subset of Olaf we can explain in the lecture. You can use this knowledge to start realising Olaf/Ola in the project stub provided with this course. Namely you will be working in the module and module heirachy Olaf.Exec. Many of the extra data structures, AtIndex and Var and All, are already in Idris standard libraries or provided within Olaf in the module hierarchy Extra. We have also provided a module Olaf.Env to make it easier to work with the execution environment.

Where Next with Evaluating Intrinsically-Typed Terms

We have only touched on evaluating term languages that come straight from the elaborator.

We have not looked at optimising our term language to make it evaluate more efficiently. For example, hoisting, partial evaluation and constant sub-expression elimination. Nor have we looked at type-safe rewriting or normalisation of terms.

All these can be realised safely using intrinsically-typed terms.