Data.IntMap.Strict.findWithDefault is too strict
bgamari.foss at gmail.com
Thu Dec 13 16:49:59 CET 2012
Christian Maeder <Christian.Maeder at dfki.de> writes:
> 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.!
I have also found this to be problematic in the past. Is there a
compelling reason to keep the current behavior? I would find this
function far more useful if the default value were lazily evaluated.
More information about the Libraries