infinisil changed the topic of #nix-lang to: Channel for discussing Nix as a language - https://nixos.org/nix/manual/#chap-writing-nix-expressions - Logs: https://logs.nix.samueldr.com/nix-lang/
dminuoso has joined #nix-lang
<dminuoso> I mean perhaps my desire is more driven by "why cant nix a bit more like Haskell"
<dminuoso> But at some point you get to the point where you want to structure code into modules, so you end up making attrsets where attributes mimic module exports. And suddenly the business of bindings becomes annoying.
<infinisil> It sure is rather far away from haskell
<infinisil> dminuoso: How do bindings become annoying in that case?
<dminuoso> infinisil: Well let's take the case of, you have a couple of bindings, and each binding requires local supplementary bindings.
<dminuoso> { foo = let ...; in someBinding; bar = let ...; in anotherBinding; }
* infinisil nods
<dminuoso> If you require some 10 supplementary binding, it becomes incredibly hard to follow the code. "Where is the actual definition of foo?"
<dminuoso> Which is sort of how haskell-style where wins
<dminuoso> Since you can just write `foo = someBinding where ....` you get to decide how deep you want to follow the rabbit hole of bindings
<infinisil> Hm yeah kind of agree
<infinisil> Hehe, there is this fancy syntax you might not know about which gets us closer to what you want:
<infinisil> > :p { foo = let { body = bar; bar = 10; }; }
<{^_^}> { foo = 10; }
<dminuoso> What the magic?
<dminuoso> > :p { foo = let { f = bar; bar = 10; }; }
<{^_^}> attribute 'body' missing, at undefined position
<dminuoso> I see.
<dminuoso> Apart from this being so exotic that its not even mentioned on https://nixos.wiki/wiki/Nix_Expression_Language or https://nixos.org/nix/manual/ - it seems like a workable middleground.
pie__ has joined #nix-lang
pie_ has quit [Ping timeout: 240 seconds]
pie__ has quit [Ping timeout: 240 seconds]
pie_ has joined #nix-lang
pie_ has quit [Ping timeout: 265 seconds]
pie_ has joined #nix-lang
pie_ has quit [Ping timeout: 276 seconds]
__monty__ has joined #nix-lang
pie_ has joined #nix-lang
pie_ has quit [Ping timeout: 245 seconds]
hmpffff has joined #nix-lang
qyliss has quit [Quit: bye]
qyliss has joined #nix-lang
hmpffff has quit [Quit: nchrrrr…]
ddellacosta has joined #nix-lang
pie_ has joined #nix-lang
ddellacosta has quit [Quit: WeeChat 2.2]
ddellacosta has joined #nix-lang
srhb has quit [Quit: ZNC 1.7.4 - https://znc.in]
hmpffff has joined #nix-lang
<pie_> dminuoso: apparently tihs is what let expressions desugar tio
<pie_> or something
<infinisil> pie_: Almost, but it can only be called sugar if it's doesn't have different behavior
<infinisil> > let { body = foo; foo = { inherit body; }; }
<{^_^}> { body = { body = <CYCLE>; }; }
<infinisil> > let foo = { inherit body; }; in foo
<{^_^}> { body = <CODE>; }
<infinisil> > :p let foo = { inherit body; }; in foo
<{^_^}> undefined variable 'body' at (string):266:12
<pie_> hm ok
__monty__ has quit [Quit: leaving]
hmpffff has quit [Quit: nchrrrr…]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
ddellacosta has quit [Ping timeout: 240 seconds]