concept color in category haskell
appears as: colors, colors, Color

This is an excerpt from Manning's book Get Programming with Haskell.
Use Semigroup to mix colors
Listing 17.5. Reimplementing Semigroup for Color to support associativity
instance Semigroup Color where (<>) Red Blue = Purple (<>) Blue Red = Purple (<>) Yellow Blue = Green (<>) Blue Yellow = Green (<>) Yellow Red = Orange (<>) Red Yellow = Orange (<>) a b | a == b = a | all (`elem` [Red,Blue,Purple]) [a,b] = Purple | all (`elem` [Blue,Yellow,Green]) [a,b] = Green | all (`elem` [Red,Yellow,Orange]) [a,b] = Orange | otherwise = Brown