Implement serialize for a few basic REPRs.