query
On this page

unionOfDisjoint

lib.attrsets.unionOfDisjoint

Docs pulled from | This Revision | 10 minutes ago


unionOfDisjoint x y is equal to x // y // z where the attrnames in z are the intersection of the attrnames in x and y, and all values assert with an error message. This operator is commutative, unlike (//).

Inputs

x

1. Function argument

y

2. Function argument

Type

unionOfDisjoint :: AttrSet -> AttrSet -> AttrSet

Noogle detected

Implementation

The following is the current implementation of this function.

unionOfDisjoint =
    x: y:
    let
      intersection = builtins.intersectAttrs x y;
      collisions = lib.concatStringsSep " " (builtins.attrNames intersection);
      mask = builtins.mapAttrs (
        name: value: builtins.throw "unionOfDisjoint: collision on ${name}; complete list: ${collisions}"
      ) intersection;
    in
    (x // y) // mask;