introduce lib.rad-dev.mapAttrsToString, fix mc-router
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
@ -58,5 +58,20 @@
|
||||
# fileList :: Path -> String -> [Path]
|
||||
fileList = dir: map (file: dir + "/${file}") (ls dir);
|
||||
|
||||
# reduce an attribute set to a string
|
||||
#
|
||||
# example:
|
||||
# given attrset {host1 = "palatine-hill"; host2 = "jeeves";}
|
||||
# and func (host: hostname: host + " is " + hostname + ", " )
|
||||
# mapAttrsToString would return 'host1 is palatine-hill, host2 is jeeves, '
|
||||
#
|
||||
# args:
|
||||
# func: an function to apply to attrSet to turn each entry into one string
|
||||
# attrSet: an attribute set to reduce
|
||||
#
|
||||
# type:
|
||||
# mapAttrsToString :: AttrSet -> (String -> Any -> String) -> String
|
||||
mapAttrsToString =
|
||||
func: attrSet: (lib.foldl' (cur: next: cur + next) "" (lib.mapAttrsToList func attrSet));
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user