4 Nov
2014
4 Nov
'14
1:43 a.m.
On Mon, Nov 3, 2014 at 12:39 PM, Milan Straka <fox@ucw.cz> wrote:
Hi all,
FYI, foldl's in containers already have this property being strict in the initial value. Therefore, Data.Map.foldl' (\_ x -> x) undefined $ Data.Map.fromList [(4,2)] triggers *** Exception: Prelude.undefined
OUCH. This is a really nasty potential gotcha for Foldable users. Whichever way things go (and I think Michael Snoyman almost has me convinced that my proposal is bad), I think uniform treatment of the initial value across Foldable instances would be a very good thing. If that means making the containers ones lazier, then so be it.