[Haskell-beginners] finding the cause of an error (here head: empty list)

Kim-Ee Yeoh ky3 at atamo.com
Sun Mar 31 21:05:05 CEST 2013

On Mon, Apr 1, 2013 at 12:17 AM, David McBride <toad3k at gmail.com> wrote:
> People tend to use pattern matching on lists or case statements on the list.

Yes, and activate -Wall to detect places where the pattern matching
isn't covering all cases.

Modulo the actual exception, head is equivalent to

head (x:xs) = x

Notice the absence of a "head []" definition.

-- Kim-Ee

More information about the Beginners mailing list