Refactoring discriminated unions

A simple example that shows how to refactor discriminated unions to extract common members