forked from mirrors/nixpkgs
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.
This commit is contained in:
parent
8737d1783f
commit
4f5c6330c9
|
@ -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…
Reference in a new issue