parent
634b040373
commit
63e0d50f16
|
@ -259,6 +259,7 @@ rec {
|
|||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
# Value of given type but with no merging (i.e. `uniq list`s are not concatenated).
|
||||
uniq = elemType: mkOptionType rec {
|
||||
name = "uniq";
|
||||
inherit (elemType) description check;
|
||||
|
@ -269,6 +270,7 @@ rec {
|
|||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
# Null or value of ...
|
||||
nullOr = elemType: mkOptionType rec {
|
||||
name = "nullOr";
|
||||
description = "null or ${elemType.description}";
|
||||
|
@ -285,6 +287,7 @@ rec {
|
|||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
# A submodule (like typed attribute set). See NixOS manual.
|
||||
submodule = opts:
|
||||
let
|
||||
opts' = toList opts;
|
||||
|
@ -316,6 +319,7 @@ rec {
|
|||
};
|
||||
};
|
||||
|
||||
# A value from a set of allowed ones.
|
||||
enum = values:
|
||||
let
|
||||
show = v:
|
||||
|
@ -331,6 +335,7 @@ rec {
|
|||
functor = (defaultFunctor name) // { payload = values; binOp = a: b: unique (a ++ b); };
|
||||
};
|
||||
|
||||
# Either value of type `t1` or `t2`.
|
||||
either = t1: t2: mkOptionType rec {
|
||||
name = "either";
|
||||
description = "${t1.description} or ${t2.description}";
|
||||
|
@ -354,6 +359,8 @@ rec {
|
|||
functor = (defaultFunctor name) // { wrapped = [ t1 t2 ]; };
|
||||
};
|
||||
|
||||
# Either value of type `finalType` or `coercedType`, the latter is
|
||||
# converted to `finalType` using `coerceFunc`.
|
||||
coercedTo = coercedType: coerceFunc: finalType:
|
||||
assert coercedType.getSubModules == null;
|
||||
mkOptionType rec {
|
||||
|
|
Loading…
Reference in New Issue