def transform_fn(self, f):
    if isinstance(f, Type):
      expr = build_untyped_cast_fn(f)
    elif isinstance(f, prims.Prim):
      expr = build_untyped_prim_fn(f)
    else:
      expr = f 
    return self.transform_expr(expr)
If you're calling a Type, turn it into a wrapper function around the Cast expression. 
dataset/ETHPy150Open iskandr/parakeet/parakeet/type_inference/type_inference.py/TypeInference.transform_fn