Types and type classes for messages and fields