On the first code example in "Programming in Haskell" the following is stated:
Recall the function sum used earlier in this chapter, which produces the sum of a list of numbers. In Haskell, sum can be defined using two equations:
sum [] = 0 sum (n:ns) = n + sum ns
Immediately, this code fails both in the ghci interpreter and upon compilation with the error: "Non-exhaustive patterns in function sum"
After further research it seems this is because the case of a single number isn't covered. What gets me is the next few examples in the book also fail to work.
Am I missing something here? The book was released rather recently in 2016 and I can't find anyone else complaining aout this.