| 25 Oct 2025 |
Katalin 🔪 | I would really like that | 13:51:12 |
emily | in Haskell this often came up as
thingy = foopy $ do
…
as opposed to
thingy = foopy (do {
…
})
though they fixed it by just making foopy do work
| 13:51:27 |
KFears (burnt out) | They are somewhat ugly, but they are universal, unlike the backpipe which only works on the last argument | 13:51:33 |
emily | not sure if you could make f x: … work in Nix to mean f (x: …) | 13:51:36 |
emily | heh, in Haskell again a niche but existing opinion was that a $ b c $ d e should parse as a (b c) (d e) rather than a (b c (d e)), because you can achieve the latter as a . b c $ d e using the function composition operator | 13:53:06 |
emily | though of course Nix has no function composition operator so you'd have to turn it around into d e |> b c |> a | 13:53:28 |
whispers | would need parens anyway for the body in any case that's not like… constant or the identity function, so i don't think it'd be particularly useful? | 13:53:27 |
emily | that is unfortunate and makes me think I'd never use <| | 13:53:46 |
emily | hm, why? you do have to decide how foo = f x: x + 2; parenthesizes, but f (x: x + 2) seems like almost invariably what you'd want in practice | 13:54:22 |
Katalin 🔪 | nix-repl> f <| x: x + 1
error: syntax error, expecting end of file
at «string»:1:7:
1| f <| x: x + 1
| ^
it seems like a bug to me
| 13:54:30 |
Katalin 🔪 | but who knows | 13:54:38 |
emily | in particular this would allow
stdenv.mkDerivation finalAttrs: {
…
}
| 13:54:40 |
emily | basically you would get trailing "block" syntax. not saying this is something that should be done, just you could do it, and it would make some things look a fair bit nicer | 13:55:14 |
emily | (though ofc the Nix grammar is cursed enough that it might expose other gremlins) | 13:56:01 |
whispers | that's the case i was thinking of, (f x: x) + 2 is a perfectly interpretation. i suppose you could say it consumes as much as possible, but that is sort of contrary to the behavior of say, [ f x ] where you don't consume more (though whether this is analogous is debatatable). you can absolutely define it to be that, but i feel like it would break precedent? dunno | 13:56:32 |
Katalin 🔪 | In reply to @kfears:matrix.org They are somewhat ugly, but they are universal, unlike the backpipe which only works on the last argument sure, but often you do specifically end up with lots of long expression as specifically the last parameter | 13:56:43 |
Katalin 🔪 | In reply to @kfears:matrix.org They are somewhat ugly, but they are universal, unlike the backpipe which only works on the last argument * | 13:56:51 |
whispers | ah right, i forgot that this would be unambiguous. blocks are compelling (though i personally don't think it justifies the whole thing) | 13:57:08 |
whispers | * ah right, i forgot that this would be there. blocks are compelling (though i personally don't think it justifies the whole thing) | 13:57:15 |
emily | mostly it's the main thing I can imagine wanting <| for | 13:57:31 |
emily | though not sure how I feel about stdenv.mkDerivation <| finalAttrs: …, that seems comparably noisy to the parens again :) | 13:58:05 |
emily | the parens only really annoy me a bunch when they make nixfmt do something I hate, like
foo (
a: b:
…
)
| 13:58:33 |
emily | avoiding rightward drift of entire file bodies can require some unpleasant contortions | 13:59:02 |
emily | I ruled out several draft ideas for improvements to Nixpkgs package structure just because they would add another layer of indentation to every single package 😅 | 14:00:33 |
llakala | i still don't use a formatter for my config because i can't stand any of them | 15:25:10 |
llakala | nixfmt is addicted to indentation | 15:25:16 |
llakala | i generally think nixfmt is good at what it was designed for (being a nixpkgs formatter) | 15:26:18 |
llakala | but little things, like this:
{ lib, pkgs, config, ... }:
becoming this:
{
lib,
pkgs,
config,
...
}:
| 15:29:00 |
llakala | and this:
let
# let content
in {
becoming this:
let
# let content
in
{
| 15:30:21 |
llakala | are the kind of things i can't stand | 15:30:35 |