threading type info through recursion is almost working, though it's not type inference yet