!djTaTBQyWEPRQxrPTb:nixos.org

Nixpkgs Architecture Team

229 Members
https://github.com/nixpkgs-architecture, weekly public meetings on Wednesday 15:00-16:00 UTC at https://meet.jit.si/nixpkgs-architecture53 Servers

Load older messages


SenderMessageTime
11 Jul 2023
@profpatsch:augsburg.oneprofpatschs/attributes/attrsets/17:16:35
@profpatsch:augsburg.oneprofpatschI bet you can fit defaults and mkForce etc in there, too17:17:03
@piegames:matrix.org@piegames:matrix.org Actually merging itself, and having that in the type system isn't that big of a deal IMO. Problems arise if you expect to merge values with inter-dependencies. Like, Nixpkgs config requires merging as there are multiple places where the configuration can be but, but they are all independent from each other so it's a lot simpler 17:18:26
@profpatsch:augsburg.oneprofpatschpriority is pretty simple to fit in, Priority { prio :: Int, value :: a } is a monoid by taking the value with the higher priority17:18:36
@piegames:matrix.org@piegames:matrix.orgOh, what you're saying is "default values are just merging with priority"?17:19:54
@piegames:matrix.org@piegames:matrix.orgBut how about default values without otherwise merging functionality17:20:11
@piegames:matrix.org@piegames:matrix.org * But how about default values without otherwise merging functionality?17:20:13
@profpatsch:augsburg.oneprofpatschso mkForce just becomes the function mkForce val = Priority { prio = highestPriority, value = val }17:20:20
@profpatsch:augsburg.oneprofpatschactually not sure you want to use monoids here, since having an identity element might not be the default you want in most cases?17:22:40
@profpatsch:augsburg.oneprofpatschso monoid sans empty element might be a better choice17:22:53
@profpatsch:augsburg.oneprofpatschpiegames: I guess default values could just be values with very low priority?17:23:59
@profpatsch:augsburg.oneprofpatschidk17:24:01
@profpatsch:augsburg.oneprofpatschI mean if you think about it nixos configs are very similar to CSS in that regard17:24:34
@profpatsch:augsburg.oneprofpatschmkForce is !important17:24:38
@piegames:matrix.org@piegames:matrix.orgThe thing I don't like priority for, is that now you have to track which values are actual values, and which values are priority annotation wrapping a value.17:25:18
@profpatsch:augsburg.oneprofpatschthus is the tyranny of structured typesystems17:26:30
@profpatsch:augsburg.oneprofpatsch*structural17:26:38
@pyrox:pyrox.devdish [Fox/It/She] changed their display name from Pyrox [ She/They/Xem ] to Pyrox [ It/She/They/Xem ].20:43:38
12 Jul 2023
@yannham:matrix.org@yannham:matrix.org

Ah, funny to see that a lot of the subjects touched upon here are questions we also had to think about for Nickel as well. Would be interesting to share some of the ideas and insights on both side. A couple points:

  • We have Profpatsch 's approach to defaults and forces: those are just priorities. But in Nickel priorities are builtin, and somehow orthogonal to the value (stored inside metadata), so the interpreter just transparently ignores them. That is, {foo | default = 5}.foo is just 5, without having to care about the priority. To override it, you need to merge it with something else which defines a new value for foo.
  • I think that some form of static dependency tracking is important as well. Because scoping is lexical, we mostly use free variables, which seems to be a reasonable over approximation (that is, you can determine statically what fields in the final fixpoint another field depend on). I guess you could even be smarter about record accesses (if you only see options.bar and options.baz, then you can avoid depending on options.whatever and other fields).This also paves the way for incremental evaluation.

merging is different from typechecking
conflating the two is a big source of annoyance

07:22:24
@yannham:matrix.org@yannham:matrix.org Profpatsch: would you care elaborating on that? CUE seems to take the entirely opposed approach 07:22:44
@yannham:matrix.org@yannham:matrix.org * Profpatsch: would you mind elaborating on that please? CUE seems to take the entirely opposed approach 07:24:43
@yannham:matrix.org@yannham:matrix.org *

Ah, funny to see that a lot of the subjects touched upon here are questions we also had to think about for Nickel as well. Would be interesting to share some of the ideas and insights on both sides. A couple points:

  • We have Profpatsch 's approach to defaults and forces: those are just priorities. But in Nickel priorities are builtin, and somehow orthogonal to the value (stored inside metadata), so the interpreter just transparently ignores them. That is, {foo | default = 5}.foo is just 5, without having to care about the priority. To override it, you need to merge it with something else which defines a new value for foo.
  • I think that some form of static dependency tracking is important as well. Because scoping is lexical, we mostly use free variables, which seems to be a reasonable over approximation (that is, you can determine statically what fields in the final fixpoint another field depends on). I guess you could even be smarter about record accesses (if you only see options.bar and options.baz, then you can avoid depending on options.whatever and other fields).This also paves the way for incremental evaluation.

merging is different from typechecking
conflating the two is a big source of annoyance

07:33:02
@yannham:matrix.org@yannham:matrix.org changed their display name from Yann Hamdaoui to yannham.07:46:09
@profpatsch:augsburg.oneprofpatschyannham: Cue suffers from the same slowness problems as the nixos module system afaik08:41:28
@profpatsch:augsburg.oneprofpatschThe problem is unscoped merging, aka if you want to figure out whether something exists, you have to potentially search through every module definition08:42:25
@profpatsch:augsburg.oneprofpatschPriority is a pretty horrible monoid, because you cannot use laziness to short-circuit08:42:43
@profpatsch:augsburg.oneprofpatschcompared to e.g. Last08:42:54
@profpatsch:augsburg.oneprofpatsch(there could always be something with higher priority that the evaluator hasn’t seen yet, so you have to look at absolutely everything)08:43:33
@profpatsch:augsburg.oneprofpatschI don’t know how nickel solves this?08:43:57
@nbp:mozilla.orgnbp Almost the same story for SOS, the intent was to not remove mkDerivation but delay it to be executed at the very end of the fix-point, thus making packages just ordinary attribute sets available through prev/super, which can be overwritten by using Nix's update operator within Nixpkgs' overlays. 10:00:03

Show newer messages


Back to Room ListRoom Version: 9