data Color = White | Blue | Red | Green | Yellow deriving (Show, Eq) next :: Color -> [Color] next color = case color of White -> [Blue] Blue -> [White, Red] Red -> [Blue, Green] Green -> [Red, Yellow] Yellow -> [Green] count :: [Color] -> Int -> Int count col 1 = length col count col n = count (col >>= next) (n-1) main = mapM_ print $ map (count [White, Blue, Red, Green, Yellow]) [1..8]