mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-12-05 03:46:16 +02:00
d0f2da214b
* Clarify the documentation of foldl': That the arguments are forced before application (?) of `op` is necessarily true. What is important to stress is that we force every application of `op`, even when the value turns out to be unused. * Move the example before the comment about strictness to make it less confusing: It is a general example and doesn't really showcase anything about foldl' strictness. * Add test cases which nail down aspects of foldl' strictness: * The initial accumulator value is not forced unconditionally. * Applications of op are forced. * The list elements are not forced unconditionally.
5 lines
190 B
Nix
5 lines
190 B
Nix
# Tests that the result of applying op is forced even if the value is never used
|
|
builtins.foldl'
|
|
(_: f: f null)
|
|
null
|
|
[ (_: throw "Not the final value, but is still forced!") (_: 23) ]
|