infinisil changed the topic of #nix-lang to: Channel for discussing Nix as a language - - Logs:
rajivr has joined #nix-lang
tilpner has quit [Remote host closed the connection]
tilpner has joined #nix-lang
ekleog has quit [*.net *.split]
ekleog has joined #nix-lang
Dotz0cat_ has joined #nix-lang
Dotz0cat has quit [*.net *.split]
MichaelRaskin has quit [*.net *.split]
evanjs has quit [*.net *.split]
evanjs has joined #nix-lang
tilpner has quit [Remote host closed the connection]
tilpner has joined #nix-lang
tilpner has left #nix-lang [#nix-lang]
kalbasit has quit [Ping timeout: 240 seconds]
kalbasit has joined #nix-lang
__monty__ has joined #nix-lang
<Profpatsch> lenses for nix, has anybody …‽
<Profpatsch> traversals in particular
<simpson> Sure. But also what's the use case?
<Profpatsch> simpson: programming?
<Profpatsch> Well, anything a lens library is useful for
<Profpatsch> deep updating of structures, potentially while also mapping over lists
<Profpatsch> Without writing extra helper functions for any traversal you stumble over
<Profpatsch> right now I have an attrset that has a list which contains attrsets where I want to map over one element
<simpson> Okay, so what's the problem? Writing lenses is straightforward. Nix doesn't really have any tools that can make it easier; there's no overrideable syntax AIUI.
<Profpatsch> simpson: I don’t know enough about how to write a lens library, which is why I asked?
<Profpatsch> Like, what’s *your* problem lol
<Profpatsch> Of course I know that lens libraries are a thing and it is possible to write them, which is why I asked whether there is one for nix
<Profpatsch> because my google-fu is too bad
<Profpatsch> If there is none, I might fall down the rabbit hole, but really I’d like to save myself the effort
<simpson> That's fair. I think of lenses as a pattern which can be built in a few lines of code. has the recipe, and is the last time I did it in a language not really intended for it.
<Profpatsch> It’s not entirely obvious how to make an ergonomic lens library without type classes as well
<Profpatsch> Without having to manually pass fmap et al to every function
<simpson> It probably isn't. Instead, as in the Monte code I've linked, you'll have to reify typeclasses into parameters.
<simpson> Exactly.
<Profpatsch> But then that’s why I asked
<Profpatsch> Because nix only has a few types, so maybe there is a nice-to-use subset
<Profpatsch> Maybe there isn’t
<Profpatsch> With unityping you can make a lot of things a lot easier while losing generality
<Profpatsch> fine, I’ll take a look at the purescript-lenses package
<simpson> Type-driven dispatch may be a mistake; it's not especially fast, and somebody's gotta do instance resolution. Certainly, for lenses, the functor is usually known in advance.
<Profpatsch> hrm
<Profpatsch> I guess
<simpson> Profpatsch: I *did* start with "sure". To me, the options are either (a) you hack out a couple dozen lines of Nix to see whether it's ergonomic, or (b) I hack out a couple dozen lines of Nix to see whether it's ergonomic.
<Profpatsch> lol
<Profpatsch> provided it doesn’t take me like 1 week to figure out what these lines are
<Profpatsch> which, like I said, unsure I want to fall down this rabbit hole right now
<simpson> No worries. I couldn't find anything with search engines either; I'm not sure if anybody's gone further down this path than noticing that Nix doesn't have the same tools as Haskell.
<Profpatsch> Strong is to Profunctor what Bifunctor is for covariant functors right?
<Profpatsch> No, that doesn’t make sense
<Profpatsch> wait no, it does
<Profpatsch> yeeaah, one day, maybe
<simpson> Obviously there are so many improvements needed, but the core seems to work.
<Profpatsch> simpson: now do traversals :P
<l33[m]> <Profpatsch "Strong is to Profunctor what Bif"> - sorry , I couldn't resist.
<simpson> Profpatsch: Exercise for the reader, I think. AIUI you'd need to swap out the functor passed to the lenses.
<simpson> Profpatsch: Actually, I think that the functor needs to be swapped out for a proper dictionary (here, an attrset?) which holds an entire Applicative instance.
<infinisil> I feel like I've seen somebody do lenses in nix before..
<simpson> I've heard people ask before, for sure.
<infinisil> Found at least this in my browser history:
<Profpatsch> simpson: “The code is now 100% point-free” :DDD
<simpson> Again, exercise for the reader.
<Profpatsch> simpson: this is one of the best
<Profpatsch> The content of the jokes matches the scene perfectly
<simpson> Profpatsch: Oh, you meant l33[m]. I don't find this sort of thing funny; Haskell's just another programming language to me.
rajivr has quit [Quit: Connection closed for inactivity]
kalbasit has quit [Ping timeout: 260 seconds]
kalbasit has joined #nix-lang
__monty__ has quit [Quit: leaving]
globin_ has joined #nix-lang
globin has quit [Ping timeout: 258 seconds]