So I'm trying to build a function that takes a list of tuples and finds the tuple with the biggest second element. But I'm getting a pattern match error.
This is my code.
resultTuple :: [((Int,Int),Int)] -> (Int,Int)
resultTuple [] = error "something wrong"
resultTuple [x] = fst(x)
resultTuple (x:y:xs)
| snd(x) >= snd(y) = resultTuple(x:xs)
| snd(x) < snd(y) = resultTuple(y:xs)
This is my error.
Pattern match(es) are non-exhaustive
In an equation for ‘resultTuple’: Patterns not matched: (_:_:_)