About the code in the post: why not just use a String for the animal? Union types are for when you have a finite number of different states, which is clearly not the case if you're expecting user input.
If you want to differentiate between predefined and user-defined animals, you could have a union type with two cases: type Animal = Default AnimalName | Custom String Or if you just want to make clear what functions take an Animal in the signature, alias String to Animal: type alias Animal = String My advice is to just think about the data you expect when you structure your types. Does it have a set number of arguments with always the same types? Use a record. Does it have irregular types but a finite number of states? Use a sum type. Also, givenOriginalAnimal is just a Maybe.map. http://package.elm-lang.org/packages/elm-lang/core/5.1.1/Maybe#map -- 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.
