types.loaOf: Update check function

This symplifies typechecking and allows properties to be used inside the
function body. It also makes possible checking the type of the result.
nixos-19.03
Shea Levy 9 years ago committed by Nicolas B. Pierron
parent 8737d1783f
commit 4f5c6330c9
  1. 5
      lib/types.nix

@ -159,10 +159,7 @@ in rec {
attrOnly = attrsOf elemType;
in mkOptionType {
name = "list or attribute set of ${elemType.name}s";
check = x:
if isList x then listOnly.check x
else if isAttrs x then attrOnly.check x
else false;
check = x: isList x || isAttrs x;
merge = loc: defs: attrOnly.merge loc (imap convertIfList defs);
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name?>"]);
getSubModules = elemType.getSubModules;

Loading…
Cancel
Save