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
<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?
<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..