An accessible introduction to type theory and implementing a type-checker