I am writing a piece of code that is a function returning a list of pixels which is a special data type I have defined which is of the following:
data Pixel = Pixel {
color :: Float,
elevation :: Float,
distance: Float,
visited :: Bool
} deriving (Show)
I have this function that is going to go through two files and put them together into a list of pixels. The files contain the color and elevation respectively so I proceed to get this code output:
insertPixels :: [String] -> [String] -> [Pixel]
insertPixels _ _ = []
insertPixels (x:xs) (y:ys) = [Pixel (read x) (read y) 99999999 False] ++ insertPixels xs ys
When I attempt to compile this or load it into the interpreter, I receive this error:
lab1.hs:33:1: warning: [-Woverlapping-patterns]
Pattern match is redundant
In an equation for ‘insertPixels’:
insertPixels (x : xs) (y : ys) = ...
|
| insertPixels (x:xs) (y:ys) = [Pixel (read x) (read y) 99999999 False] ++ insertPixels xs ys
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I don't really understand what this means or what I am doing wrong.