I want a function f :: Int -> a -> [a] -> [a]
where the return value is the third argument with the item at the index given by the first argument replaced by the second argument.
So
f 1 42 [1, 2, 3] == [1, 42, 3]
I looked on Hoogle for functions with that signature but didn't find any that matched what I was looking for.
Is there a function that does what I'm looking for in the Haskell standard library?