You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
[A type system is a] tractable syntactic method for proving the absence of certain program behaviors<br />
by classifying phrases according to the kinds of values they compute.<br />
— Benjamin Pierce<br />
Type Systems<br />
Type systems are a formal language in which we can describe and restrict the semantics of a programming<br />
language. e study of the subject is a rich and open area of research with many degrees of freedom in<br />
the design space.<br />
As stated in the introduction, this is a very large topic and we are only going to cover enough of it to get through<br />
writing the type checker for our language, not the subject in its full generality. e classic text that everyone<br />
reads is Types and Programming Languages or ( TAPL ) and discusses the topic more in depth. In fact we<br />
will follow TAPL very closely with a bit of a <strong>Haskell</strong> flavor.<br />
Rules<br />
In the study of programming language semantics, logical statements are written in a specific logical<br />
notation. A property, for our purposes, will be a fact about the type of a term. It is written with the<br />
following notation:<br />
1 : Nat<br />
ese facts exist within a preset universe of discourse called a type system with definitions, properties,<br />
conventions, and rules of logical deduction about types and terms. Within a given system, we will have<br />
several properties about these terms. For example:<br />
• (A1) 0 is a natural number.<br />
• (A2) For a natural number n, succ(n) is a natural number.<br />
Given several properties about natural numbers, we’ll use a notation that will allow us to chain them<br />
together to form proofs about arbitrary terms in our system.<br />
0 : Nat<br />
n : Nat<br />
succ(n) : Nat<br />
(A1)<br />
(A2)<br />
54