use type t in function