if you make AtomicCounter and PlainCounter case classes you get this for free, with case matching and whatnot to boot.