Bidirectional type checking

Implement local type inference. Closes #3.