diff options
author | Shea Levy <shea@shealevy.com> | 2014-05-01 20:17:03 -0400 |
---|---|---|
committer | Nicolas B. Pierron <nicolas.b.pierron@gmail.com> | 2015-03-12 23:42:57 +0100 |
commit | 4f5c6330c9f3df2533daf33ecaf0c52420979674 (patch) | |
tree | 2cea0f30fd57856c81f0f9112e8c4e80773cb410 /lib | |
parent | 8737d1783f8a8e0c219ec00dd995e8851fd65b3b (diff) | |
download | nixpkgs-4f5c6330c9f3df2533daf33ecaf0c52420979674.tar nixpkgs-4f5c6330c9f3df2533daf33ecaf0c52420979674.tar.gz nixpkgs-4f5c6330c9f3df2533daf33ecaf0c52420979674.tar.bz2 nixpkgs-4f5c6330c9f3df2533daf33ecaf0c52420979674.tar.lz nixpkgs-4f5c6330c9f3df2533daf33ecaf0c52420979674.tar.xz nixpkgs-4f5c6330c9f3df2533daf33ecaf0c52420979674.tar.zst nixpkgs-4f5c6330c9f3df2533daf33ecaf0c52420979674.zip |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/types.nix | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/types.nix b/lib/types.nix index a5b9d59e30f..4d336c1d946 100644 --- a/lib/types.nix +++ b/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; |