tvix/eval: foldl' maybe isn't strict, actually

#209
Opened by sterni at 2022-10-10T19·56+00

nix-repl> let x = builtins.foldl' (x: y: x ++ [ y ]) [ ] [ 1 2 (throw "lol") 3 ]; in builtins.head x
1

It seems to me that the “strict” in primop_foldlStrict is an exaggeration, as it doesn't actually force the arguments before calling the function if I read the code correctly.

  1. C++ Nix's foldl' isn't strict in any way atm, I opened a PR to make it behave as Haskell's strict fold does: https://github.com/NixOS/nix/pull/7158.

    sterni at 2022-10-11T12·28+00

  2. cl/6947

    sterni at 2022-10-11T12·48+00

  3. sterni closed this issue at 2022-10-11T15·54+00