The key to remember here is that Elm doesn't have what are traditionally
called union types, we have "Tagged union types". There's never a time when
you can have As and Bs in a list, and not know if you have an A or a B.
Every value in the list will be tagged with some constructor from what ever
"type" declaration you use for your union.

On Fri, May 20, 2016 at 11:27 AM, Zinggi <[email protected]> wrote:

> No problem.
> You probably also want to read the documentation on types
> <http://guide.elm-lang.org/types/index.html>, specifically the section
> about union types <http://guide.elm-lang.org/types/union_types.html>.
>
> On Friday, 20 May 2016 20:11:47 UTC+2, John Orford wrote:
>>
>> Yup.  Thanks!
>>
>> Zinggi <[email protected]> schrieb am Fr., 20. Mai 2016 19:52:
>>
>>> It is, you just have to create a type for your union type.
>>> e.g.
>>> type Union a b = A a | B b
>>> then you can use e.g.
>>> list : List (Union Int String)
>>> list = [A 1, B "bla"]
>>>
>>> Is that what you wanted?
>>>
>>> On Friday, 20 May 2016 19:41:38 UTC+2, John Orford wrote:
>>>>
>>>> Why isn't something like
>>>>
>>>> List (A | B)
>>>>
>>>> possible?
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Elm Discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to