diff options
author | Nikolay Amiantov <ab@fmap.me> | 2017-05-25 19:18:34 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2017-05-25 19:24:05 +0300 |
commit | 63e0d50f16157bd85fc1b3bef87a90792c66dc7c (patch) | |
tree | 418bd1840a23f68f68e133ba7304bddea53da887 | |
parent | 634b0403739377fd5d0a162444ce92acf51e9d97 (diff) | |
download | nixlib-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar nixlib-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar.gz nixlib-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar.bz2 nixlib-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar.lz nixlib-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar.xz nixlib-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar.zst nixlib-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.zip |
types: add short docstrings
Fixes #26055
-rw-r--r-- | lib/types.nix | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix index b06cc9eedaa9..50aa6d770852 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -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 { |