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:
Shea Levy 2014-05-01 20:17:03 -04:00 committed by Nicolas B. Pierron
parent 8737d1783f
commit 4f5c6330c9

View File

@ -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;