On Tue, Feb 10, 2015 at 7:58 PM, Joel Neely <joel.neely@gmail.com> wrote:
sumDigits (n:ns)
  | n < 10       = n + sumDigits ns
  | n >= 10      = r + sumDigits (q : ns)
  where (q, r)   = n `quotRem` 10

To reiterate what Mike and Brandon just said, it's not that both the [] and (n:ns) cases have not been covered. They have.

It's that the (n:ns) case hasn't been covered completely because of the guards.

This will work:

sumDigits (n:ns)
  | n < 10       = n + sumDigits ns
  | otherwise    = r + sumDigits (q : ns)

As will this:

sumDigits (n:ns)
  | n < 10       = n + sumDigits ns
  | n >= 10      = r + sumDigits (q : ns)
  | otherwise    = error "will never fire, only to suppress spurious warning"

There's also -fno-warn-incomplete-patterns.

-- Kim-Ee