Type inference

Fixes #22 at a basic level