I have a type union of colors that I want to render to the user. Is it possible to iterate over all type union values?
type Color = Red | Blue | Green | Black
colorToStirng color =
case color of
Red -> "red"
Blue -> "blue"
Green -> "green"
Black -> "black"
colorList =
ul
[]
List.map colorListItem Color -- <- this is the missing puzzle
colorListItem color =
li [class "color-" ++ (colorToString color) ] [ text (colorToString color) ]