I would like to do the following in Haskell:
myFunc 1 = 0
myFunc 2 = 1
changeMyFunc:: (Integer -> Integer) -> Integer -> Integer -> (Integer -> 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
This is how far i got it:
changeMyFunc2:: (Integer -> Integer) -> Integer -> Integer -> (Integer -> Integer)
changeMyFunc2 x y z | y == z = myFunc
| y /= z = myFunc where myFunc y = 12
| otherwise myFunc
the last line causes: parse error on input '|' How can i check multiple cases using where?
|s need to line up.|s aren't given any indentation block. (Except with theMultiWayIfsyntax extension, where they had to add one for sanity when nesting them.)