Some fun with generics and functions