let as_fun tenv name = match find_typcon tenv name with | None -> lookup_type_variable tenv name | Some (_, v, _) -> TVariable v