title: Haskell: Non-exhaustive pattern - Checking if list is ascending
body: <p>I have no idea why my function doesn't work. I have gone through all the posts about non-exhaustive functions but my functions fulfills all possible options as far as I can see.</p>
  
  <pre><code>ascending :: [Int] -&gt; Bool
  ascending []                = error "Empty list given"
  ascending [x]               = True
  ascending [x,y]     | y&gt;=x  = True
                      | x&lt;y   = False
  ascending (x:y:xs)  | y&gt;=x  = (ascending (y:xs))
                      | x&lt;y   = False
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>*Main&gt; ascending []
  *** Exception: Empty list given
  *Main&gt; ascending [1]
  True
  *Main&gt; ascending [1, 2]
  True
  *Main&gt; ascending [2, 1]
  *** Exception: test01.hs:(51,1)-(56,55): Non-exhaustive patterns in function ascending
  </code></pre>
  
  <p>It works for one pair, but not if the pair is not ascending. When I follow my code it should be just returning False.</p>