let var_type v = match v with 
    | VarL (_, t) | VarT (_, _, t,_) -> t