Add discriminated union extension methods.