Generic programming experiment in Scala