# Idea: Extensible Union types and benefits they bring for real world Elm code

**URL:** <https://discourse.elm-lang.org/t/idea-extensible-union-types-and-benefits-they-bring-for-real-world-elm-code/6118>\
**Category:** Request Feedback\
**Created:** [August 3, 2020, 3:57am UTC](https://discourse.elm-lang.org/t/idea-extensible-union-types-and-benefits-they-bring-for-real-world-elm-code/6118 "2020-08-03T03:57:20Z")\
**Posts on this page:** 1\
**Showing post:** 40

<div class="post-metadata">

**Author:** ![cwhy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/cwhy/32/558_2.png) [@cwhy](https://discourse.elm-lang.org/u/cwhy)\
**Post date:** [August 28, 2020, 3:41am UTC](https://discourse.elm-lang.org/t/idea-extensible-union-types-and-benefits-they-bring-for-real-world-elm-code/6118/40 "2020-08-28T03:41:55Z")

</div>

> [@evancz](#):
>
> ```auto
> d o
> @P p -> @Coud p
> @Q q -> @Chuck q
> @R r -> @Wood r
> 
> ```

Open unions are still quite useful without the extensible part, the main feature in the examples provided by @yosteden and even the Ocaml guide are the composition part, where different constructors can be composed different ways, like this example [How to represent many subsets of an enum?](https://discourse.elm-lang.org/t/how-to-represent-many-subsets-of-an-enum/6088).

Could it possible to have exactly the dual of records for Elm, where features like adding fields/variants are just removed to achieve the same error message experience?

I agree with the trade off part, but can we just force type annotation on functions with open unions (otherwise compilation error with a nice suggestion) to make the experience a bit smoother?

---

_[View the full topic](https://discourse.elm-lang.org/t/idea-extensible-union-types-and-benefits-they-bring-for-real-world-elm-code/6118)._
