I think that would work with what I wanted. I ended up deciding that having 2 distinct types is what I wanted anyways so I don't really have a use case.
Em segunda-feira, 24 de outubro de 2016 15:49:50 UTC-4, Joey Eremondi escreveu: > > type Event = RE RecieverEvent | SE SenderEvent > > You just say that Event has two variants, named RE and SE, which can be a > ReceiverEvent or SenderEvent respectively. You just tag the values with > which of the "subtypes" it is. > > I'm not sure if you realize, in your "type Event", you've just defined > Event to have two tags, which are named ReceiverEvent and SenderEvent, > which have *nothing to do* with the types of the same name. Each variant of > a type always begins with the name of the variant, then followed by 0 or > more types, that are the arguments to the constructor. > > Could you speak more about your use-case for this? That might help us find > an Elm-ish solution. > > On Mon, Oct 24, 2016 at 12:45 PM, Timothy Williams <[email protected] > <javascript:>> wrote: > >> Say I want to represent something like this: >> >> type Event = ReceiverEvent | SenderEvent >> >> where ReceiverEvent is like >> >> type ReceiverEvent = Receive | Process >> >> and >> >> type SenderEvent = Sent | Confirmed >> >> and then if something is an event, it can either be a ReceiverEvent or >> SenderEvent, and if it is a ReceiverEvent it can be Receive or Process. >> >> I gather this is illegal in elm, but how should this be represented >> instead? >> >> -- >> 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.
