title: How to change values of a function in Haskell and return this function?
body: <p>I would like to do the following in Haskell:</p>
  
  <pre><code>myFunc 1 = 0
  myFunc 2 = 1
  
  changeMyFunc:: (Integer -&gt; Integer) -&gt; Integer -&gt; Integer -&gt; (Integer -&gt; Integer)
  changeMyFunc x y z = undefined
  
  -- change value of function x at position y to value z and return this function
  -- this would make: (changeMyFunc myFunc 1 5) 1 == 5
  </code></pre>
  
  <p>This is how far i got it:</p>
  
  <pre><code>changeMyFunc2:: (Integer -&gt; Integer) -&gt; Integer -&gt; Integer -&gt; (Integer -&gt; Integer)
  changeMyFunc2 x y z | y == z = myFunc
                  | y /= z = myFunc where myFunc y = 12
                  | otherwise myFunc
  </code></pre>
  
  <p>the last line causes: parse error on input '|'
  How can i check multiple cases using where?</p>