Experimenting with polymorphism in Scala