The problem with that, for my use case at least, is that I want to be able to know that a list contains only Foos or only Bars because there are functions that only make sense for Bars and not Foos. And it would be kind of strange to have to put in a case for the sub-type I never expect to call that function with. And if I ever do then I've lost the type safety so the compiler won't catch my mistake.
> On Aug 1, 2016, at 2:25 AM, Wouter In t Velt <[email protected]> wrote: > > How about this? > > type Thing = > Foo > | Bar > | Baz > > > type ThingList = List Thing > > > > That way, you can simply do: > > List.length ThingList > > -- > You received this message because you are subscribed to a topic in the Google > Groups "Elm Discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/elm-discuss/8FNvfSguIq8/unsubscribe. > To unsubscribe from this group and all its topics, 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.
