Hello Daniel,
Thus quoth Daniel Peebles at 13:58 on Tue, May 30 2017:
>
> My favorite interface for this type of operation is from Haskell's
> Data.Map, in pseudo-Haskell notation:
>
> unionWithKey : (String -> a -> a -> a) -> Attrs a -> Atrs a -> Attrs a
Right, that's exactly the kind of funct
My favorite interface for this type of operation is from Haskell's
Data.Map, in pseudo-Haskell notation:
unionWithKey : (String -> a -> a -> a) -> Attrs a -> Atrs a -> Attrs a
unionWith : (a -> a -> a) -> Attrs a -> Attrs a -> Attrs a
unionWith = f: unionWithKey (_: f)
This should be sufficient
Hello Tomasz, Domen, and Volth,
Thus quoth Tomasz Czyż at 13:26 on Mon, May 29 2017:
>
> https://github.com/NixOS/nixpkgs/blob/master/lib/attrsets.nix#L413 is also
> handy
>
> 2017-05-29 13:36 GMT+01:00 Domen Kožar :
>
>> mkMerge can be used only with NixOS modules.
>>
>> I do remember some recu
Hello Domen,
Thus quoth Domen Kožar at 12:16 on Mon, May 29 2017:
>
> Note that this will fail if you'll nest the attributes, one will override
> the other.
>
> nix-repl> :p concatAttrs [ {x={a =3;};} {x={ b= 4;};} ]
> { x = { b = 4; }; }
Sure, that seems to follow naturally from the semantics
https://github.com/NixOS/nixpkgs/blob/master/lib/attrsets.nix#L413 is also
handy
2017-05-29 13:36 GMT+01:00 Domen Kožar :
> mkMerge can be used only with NixOS modules.
>
> I do remember some recursive merge function, but can't find it now.
>
> On Mon, May 29, 2017 at 2:29 PM, Volth wrote:
>
>>
mkMerge can be used only with NixOS modules.
I do remember some recursive merge function, but can't find it now.
On Mon, May 29, 2017 at 2:29 PM, Volth wrote:
> there is also lib.mkMerge to handle nested attrs
>
> On 5/29/17, Domen Kožar wrote:
> > Note that this will fail if you'll nest the a
there is also lib.mkMerge to handle nested attrs
On 5/29/17, Domen Kožar wrote:
> Note that this will fail if you'll nest the attributes, one will override
> the other.
>
> nix-repl> :p concatAttrs [ {x={a =3;};} {x={ b= 4;};} ]
> { x = { b = 4; }; }
>
>
> On Sun, May 28, 2017 at 5:23 PM, Sergiu
Note that this will fail if you'll nest the attributes, one will override
the other.
nix-repl> :p concatAttrs [ {x={a =3;};} {x={ b= 4;};} ]
{ x = { b = 4; }; }
On Sun, May 28, 2017 at 5:23 PM, Sergiu Ivanov wrote:
> Hey Leo,
>
> Thus quoth Leo Gaspard at 13:05 on Sun, May 28 2017:
> > On 05
Hey Leo,
Thus quoth Leo Gaspard at 13:05 on Sun, May 28 2017:
> On 05/28/2017 02:58 PM, Sergiu Ivanov wrote:
>> My use case is quite specific. I do this, approximately:
>>
>> let func name = { "${name}" = something name; };
>> in concatAttrs (map func [ "name1" "name2" ])
>
> If this is your
On 05/28/2017 02:58 PM, Sergiu Ivanov wrote:
> My use case is quite specific. I do this, approximately:
>
> let func name = { "${name}" = something name; };
> in concatAttrs (map func [ "name1" "name2" ])
If this is your use case, you could also be interested in `genAttrs`
defined in `lib/att
Hello Linus,
Thank you for you prompt reply!
Thus quoth Linus Heckemann at 12:24 on Sun, May 28 2017:
> On 28/05/17 13:18, Sergiu Ivanov wrote:
>>
>> concatAttrs = attrList: pkgs.lib.fold (x: y: x // y) {} attrList;
>>
>> Do you see any isssues with such an implementation?
>>
>
> Looks like a s
On 28/05/17 13:18, Sergiu Ivanov wrote:
> Hello,
>
> I found myself in the need of a function which would take a list of
> Nix attribute sets and concatenate them to produce one big attribute
> set:
>
> nix-repl> concatAttrs [ {x=1;} {y=2;} ]
> {x=1; y=2;}
>
> I did quite some research online an
Hello,
I found myself in the need of a function which would take a list of Nix
attribute sets and concatenate them to produce one big attribute set:
nix-repl> concatAttrs [ {x=1;} {y=2;} ]
{x=1; y=2;}
I did quite some research online and in nixpkgs source tree and found a
lot of cool functio
13 matches
Mail list logo