work on functional type inference. broken with a todo