This does act exactly as a discriminated union. The code works exactly as written.