some more steps towards something like Hindley–Milner type inference