
13 Dec
2012
13 Dec
'12
8:35 a.m.
Hi, when trying out Data.IntMap.Strict instead of Data.IntMap, I've noticed (after some confusion) that Data.IntMap.Strict.findWithDefault evaluates the default value, even if it is not used! I usually pass an error-call to IntMap.findWithDefault to get a more informative crash-message than by using IntMap.! Evaluating (error "...") surely crashes, but the evaluation should only happen when the key is not in the map! I can easily work around this (by using fromMaybe and IntMap.lookup), but it is still worth at least being documented if crucial for performance. (the same applies to Data.Map) Cheers Christian