Learning Haskell, bit confused about the code hint here:
getMax :: [Int] -> Int
getMax [a] = a
getMax (a:b:as) = getMax ((if a >= b then a else b):as)
Pattern match(es) are non-exhaustive
In an equation for ‘getMax’: Patterns not matched: []
It works and finds the max of eg [5, 2, 6]. Does it need a pattern for the empty list? What's a reasonable return value then? Zero? Can I return something like undefined?