type checker for whole programs looks like it works