Whenever you accessed the list, you would get an element of type A | B. To use 
if further, you would need to type case it, pass it to something that wanted A| 
B or A | B | C etc, or put it through some sort of type cast operator that 
could give you a Maybe A or a Maybe B. Elm, of course, doesn't do any of those 
things, so this note is just to say that one could design a language that did. 
The "win" in this case would be to make it easier to create composite types — 
e.g., a value, an error, or nothing which isn't really quite the same in usage 
as either a Maybe (Result e t) or a Result e (Maybe t).

Mark

> On May 22, 2016, at 1:59 PM, Leroy Campbell <[email protected]> wrote:
> 
> I assume if it were possible to have lists with mixed types, you'd lose some 
> algebraic guarantees. How would you use such a list? There's probably another 
> way to accomplish the same thing while retaining type safety.
> 
>> On Friday, May 20, 2016 at 1:41:38 PM UTC-4, 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.

Reply via email to