lib/types: add types.nonEmptyListOf

This commit is contained in:
Robert Schütz 2018-02-08 09:49:06 +01:00
parent e860b651d6
commit c65e36c9ca

View file

@ -256,6 +256,10 @@ rec {
functor = (defaultFunctor name) // { wrapped = elemType; };
};
nonEmptyListOf = elemType:
let list = addCheck (types.listOf elemType) (l: l != []);
in list // { description = "non-empty " + list.description; };
attrsOf = elemType: mkOptionType rec {
name = "attrsOf";
description = "attribute set of ${elemType.description}s";