git.iko.soy/typeable/nixpkgs
on master help sign in
types: add short docstrings

Fixes #26055

commit63e0d50f16157bd85fc1b3bef87a90792c66dc7c authorNikolay Amiantov <ab@fmap.me> dateThu 25 May 2017, 19:18 (10 years ago) parent634b040
1 file changed+7
lib/types.nix+7
lib/types.nix+7
@@ -259,6 +259,7 @@ rec {
259259 functor = (defaultFunctor name) // { wrapped = elemType; };
260260 };
261261
262+ # Value of given type but with no merging (i.e. `uniq list`s are not concatenated).
262263 uniq = elemType: mkOptionType rec {
263264 name = "uniq";
264265 inherit (elemType) description check;
@@ -269,6 +270,7 @@ rec {
269270 functor = (defaultFunctor name) // { wrapped = elemType; };
270271 };
271272
273+ # Null or value of ...
272274 nullOr = elemType: mkOptionType rec {
273275 name = "nullOr";
274276 description = "null or ${elemType.description}";
@@ -285,6 +287,7 @@ rec {
285287 functor = (defaultFunctor name) // { wrapped = elemType; };
286288 };
287289
290+ # A submodule (like typed attribute set). See NixOS manual.
288291 submodule = opts:
289292 let
290293 opts' = toList opts;
@@ -316,6 +319,7 @@ rec {
316319 };
317320 };
318321
322+ # A value from a set of allowed ones.
319323 enum = values:
320324 let
321325 show = v:
@@ -331,6 +335,7 @@ rec {
331335 functor = (defaultFunctor name) // { payload = values; binOp = a: b: unique (a ++ b); };
332336 };
333337
338+ # Either value of type `t1` or `t2`.
334339 either = t1: t2: mkOptionType rec {
335340 name = "either";
336341 description = "${t1.description} or ${t2.description}";
@@ -354,6 +359,8 @@ rec {
354359 functor = (defaultFunctor name) // { wrapped = [ t1 t2 ]; };
355360 };
356361
362+ # Either value of type `finalType` or `coercedType`, the latter is
363+ # converted to `finalType` using `coerceFunc`.
357364 coercedTo = coercedType: coerceFunc: finalType:
358365 assert coercedType.getSubModules == null;
359366 mkOptionType rec {