title: How to convert this if-then-else to pattern matching?
body: <p>The following works:</p>
  
  <pre><code>fib n = let
         f k a b =
             if k==n then b
             else f (k+1) b (a+b)
      in f 1 0 1
  </code></pre>
  
  <p>but my attempt to rewrite the if-then-else to pattern matching, I get a warning about overlapping patterns and it produces wrong result (always 1)</p>
  
  <pre><code>fib n = let
      f n a b = b
      f k a b = f (k+1) b (a+b)
    in f 1 0 1
  </code></pre>
  
  <p>Why?</p>
  
  <p>Or more generally, can you pattern-match as/in a closure?</p>