我有一个颜色类型的联合体,我想将其呈现给用户。是否可以迭代所有类型联合值?
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) ]
thing
是在哪里定义的? - JustGage