scala notes on traits and sealed classes