I want to sum Doubles with the Data.Map.map function.
So i want to have a function like this:
sumTheDoubles :: Mapping.Map Char [(Char, Double)] -> Mapping.Map Char [(Char, Double)]
I want to have a sum all Doubles with the Data.Map.map function:
lets say
sumTheDoubles (fromList [('i', [('a', 1.0), ('n', 2.0)])])
should do: 1.0 + 2.0 -->
(fromList [('i', [('a', 3.0), ('n', 3.0)])])
Yet my main problem is, that I do not really understand how to access the Doubles with the Data.Map.map function.
-> Doubleresult, and then replacing that value into all the tuples can be a separate task.Data.Map.mapto replace the value once you've calculated it, but it's not really appropriate for doing the summing.Mapping.Map Char Double, if you sum for each element in theMapseparately (not clear from the question). But notMapping.Map Char [(Char, Double)].