use a sealed class for Datatype and Format

this provides better pattern matching support,
because the compiler knows all of a sealed trait's
subclasses.