
30 May
2010
30 May
'10
8:51 p.m.
On Sun, May 30, 2010 at 11:34:47PM +0100, Ian Lynagh wrote:
Hi all,
Currently, Data.Map.insertWith' (and friends) only force the value inserted when the combining function creates it:
Prelude Data.Map> insertWith' (+) "foo" undefined empty `seq` () () Prelude Data.Map> insertWith' (+) "foo" undefined (singleton "foo" 1) `seq` () *** Exception: Prelude.undefined
I think it would be more consistent for it to always force it:
Prelude Data.Map> insertWith' (+) "foo" undefined empty `seq` () *** Exception: Prelude.undefined Prelude Data.Map> insertWith' (+) "foo" undefined (singleton "foo" 1) `seq` () *** Exception: Prelude.undefined
The current behaviour is unexpected. +1 for the patch. -- Felipe.