Elm also doesn't have generalized union types even with tags. For example, one can't have a universal NoOp message type that can be included in other message type definitions and recognized and generated from generic code.
Mark On Friday, May 20, 2016 at 11:46:49 AM UTC-7, Joey Eremondi wrote: > > 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] > <javascript:>> 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] <javascript:>. >> 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.
