fake.modules transposition for aspect-oriented Dendritic Nix. with cross-aspect dependencies. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ dendrix.oeiuwq.com/Dendritic.html
dendritic nix aspect oriented
at e9be62ccf16f4e8e514b4cbe0e9e500948cc9afe 28 lines 570 B view raw
1{ 2 lib, 3 emit ? lib.singleton, 4}: 5let 6 transposeItem = 7 child: parent: value: 8 emit { inherit child parent value; }; 9 accTransposed = 10 acc: item: 11 acc 12 // { 13 ${item.parent} = (acc.${item.parent} or { }) // { 14 ${item.child} = item.value; 15 }; 16 }; 17 transposeItems = parent: lib.mapAttrsToList (transposeItem parent); 18 deconstruct = lib.mapAttrsToList transposeItems; 19 reconstruct = lib.foldl accTransposed { }; 20 transpose = 21 attrs: 22 lib.pipe attrs [ 23 deconstruct 24 lib.flatten 25 reconstruct 26 ]; 27in 28transpose