-- all functions below have type signatures:
-- f :: RGB8 -> RGB8 

grayscale rgb = 
  (avg, avg, avg) 
  where (r, g, b) = fromIntegral' rgb
        avg = round ((r + g + b) / 3)
grayscale rgb = 
  (avg, avg, avg) 
  where (r, g, b) = fromIntegral' rgb
        avg = round ((r + g + b) / 3)
grayscale rgb = 
  (avg, avg, avg) 
  where (r, g, b) = fromIntegral' rgb
        avg = round ((r + g + b) / 3)