In Haskell the patterns is written down one after another, it acts as a kind of case selection, when matching, those patterns are matched one by one, in the order that they are written down

 
foo 0 = "Hello"
foo 1 = "World"
*Main> foo 0
"Hello"
 

In this case the order doesn't matter, they are distinct patterns, we can write it in different order with no problem

 
foo 1 = "World"
foo 0 = "Hello"
 
*Main> foo 0
"Hello"
 

But sometimes the order is significant, because a pattern may contains another pattern

 
foo 1 = "World"
foo 0 = "Hello"
foo n = "Anything is not 1 or 0"
 

If the more general pattern is put at the top:

 
foo n = "Anything include 1 or 0"
foo 0 = "Hello"
foo 1 = "World"
 

In this case, the pattern 0 and 1 will never be matched, because pattern n contains all the constant patterns and Haskell compiler will gives a warning. This is called pattern overlap.

 
    Pattern match(es) are overlapped
    In an equation for ‘foo’:
        foo 0 = ...
        foo 1 = ...
 

The overlap pattern is common in function definition especially the recursive function in which the constant pattern indicate how the recursion should terminate and general pattern let the function recursive. For example the factorial function:

 
fact 0 = 1
fact n = n * fact (n - 1)
 

Or the Fibonacci function

 
fib 1 = 1
fib 2 = 1
fib n = fib (n -1 ) + fib (n -2)