pre-analyse functions to aid type inferences