tweag / nickel

Better configuration for less
https://nickel-lang.org/
MIT License
2.43k stars 93 forks source link

Use let-blocks when apprioriate in stdlib & examples #2051

Closed yannham closed 3 weeks ago

yannham commented 2 months ago

This PR updates to Topiary 0.5.1, which includes the support for formatting let-blocks (and the let-in formatting fix). Additionally, I made a pass on the examples and the stdlib to use let-blocks whenever it seemed appropriate, so that both remains idiomatic Nickel.

This is the last item on the checklist before being able to release Nickel 1.9

github-actions[bot] commented 2 months ago

🐰 Bencher Report

Branch2051/merge
Testbedubuntu-latest

⚠️ WARNING: The following Measure does not have a Threshold. Without a Threshold, no Alerts will ever be generated!

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds CLI flag.

Click to view all benchmark results
BenchmarkLatencynanoseconds (ns)
fibonacci 10📈 view plot
⚠️ NO THRESHOLD
499,030.00
foldl arrays 50📈 view plot
⚠️ NO THRESHOLD
1,763,600.00
foldl arrays 500📈 view plot
⚠️ NO THRESHOLD
6,846,300.00
foldr strings 50📈 view plot
⚠️ NO THRESHOLD
7,102,700.00
foldr strings 500📈 view plot
⚠️ NO THRESHOLD
62,544,000.00
generate normal 250📈 view plot
⚠️ NO THRESHOLD
44,564,000.00
generate normal 50📈 view plot
⚠️ NO THRESHOLD
2,063,800.00
generate normal unchecked 1000📈 view plot
⚠️ NO THRESHOLD
3,395,000.00
generate normal unchecked 200📈 view plot
⚠️ NO THRESHOLD
749,760.00
pidigits 100📈 view plot
⚠️ NO THRESHOLD
3,209,000.00
pipe normal 20📈 view plot
⚠️ NO THRESHOLD
1,495,900.00
pipe normal 200📈 view plot
⚠️ NO THRESHOLD
10,055,000.00
product 30📈 view plot
⚠️ NO THRESHOLD
823,410.00
scalar 10📈 view plot
⚠️ NO THRESHOLD
1,504,700.00
sum 30📈 view plot
⚠️ NO THRESHOLD
819,460.00
🐰 View full continuous benchmarking report in Bencher
yannham commented 1 month ago

This is actually also blocked on https://github.com/tweag/topiary/pull/747 to be able to update to latest Topiary in the flake.

yannham commented 1 month ago

Now that we've got rid of Topiary as an input of the Nickel flake, we need Topiary to be compatible with tree-sitter 0.22 (used by the Nickel grammar) - which is the case, but this version hasn't been released yet. Waiting for a new version of Topiary to be released, so that we can finally format let-blocks.

yannham commented 1 month ago

(while this PR is by no mean really required for 1.9, its precondition is: update Topiary to latest version once it's on crates.io so that nickel format can handle the latest syntax changes)