I'm working on a program that receives as input a board game as follows:
#####
#_ ##
# ##
# #
# .#
#####
1 4 (player initial position, marked with '_')
After receiving the input, the program transforms it to a [String].
This case, it would be: ["#####", "#_ ##", "# ##", "# #", "# .#", "#####", "1 4"]
How can I access position [1,4] and transform '_' to 'o'? Function must return initial list with that transformation.
Very important note: '_' is never displayed on input, I only used it to make clear where position [1,4] is (therefore, on input we only see a blank space, ' ')
splitAt? It is a function that splits lists by index, you can then transform an element and merge the result with++.updateAtPos :: Int -> (a -> a) -> [a] -> [a], then your desired function is\i j -> updateAsPos i (updateAtPos j (const 'o'))