Add simple typing to untyped ML implementation