Data.Map.mapKeys documentation differs from the actual behavior

Andriy Palamarchuk apa3a at
Fri Jun 29 17:51:17 EDT 2007

I'm currently improving documentation for Data.Map. mapKeys documentation says:

"The size of the result may be smaller if f maps two or more distinct keys to the same new key. In this case the value at the smallest of these keys is retained."

However the implementation retains the value of the *largest* key:

Prelude Data.Map> let map = fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]
Prelude Data.Map> mapKeys (\ _ -> 1) map
Prelude Data.Map> mapKeys (\ _ -> 3) map


Should I fix the documentation to confirm to the actual function behavior?


____________________________________________________________________________________Ready for the edge of your seat? 
Check out tonight's top picks on Yahoo! TV.

More information about the Libraries mailing list