Lund University →
Faculty of Engineering →
Department of Computer Science
Type System
A type is any piece of information we want to store about some variable, or expression.
One way to think about it is that it's metadata.
Typing Rules are a set of rules that say how to tag variables and expressions with types
in a way that is useful for the programmer to avoid bugs in their programs.
To create a type system, you need to create two things:
1. A type syntax, which specifies how a valid type looks like.
2. Typing rules, which specify how to type expressions and variables in a program.
Things you can model with types
- Sets of possible results for an expression (prevents you from mixing apples with oranges).
- Uncaught exceptions
- Dependencies
- If a function is pure or not