This is unlike every other structure we have.
λ> import qualified Data.Foldable as F
λ> import qualified Data.Set as S -- or Map or IntSet or IntMap
λ> F.foldl' (\_ _ -> ()) undefined (S.singleton ())
*** Exception: Prelude.undefined
CallStack (from HasCallStack):
...
λ> F.foldr' (\_ _ -> ()) undefined (S.singleton ())
*** Exception: Prelude.undefined
...
λ> import qualified Data.Sequence as Seq
λ> F.foldl' (\_ _ -> ()) undefined (Seq.singleton ())
()
λ> F.foldr' (\_ _ -> ()) undefined (Seq.singleton ())
()
I think we should make these strict.
Perhaps it's worth mentioning that for lists, foldl' is strict in the starting value but foldr' is not (GHC #25508).