mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 11:45:45 +03:00
lib.types: chore use consistent payload form
This commit is contained in:
parent
fd6bc1b590
commit
f407f6f57e
1 changed files with 9 additions and 4 deletions
|
@ -475,9 +475,10 @@ rec {
|
||||||
check = isString;
|
check = isString;
|
||||||
merge = loc: defs: concatStringsSep sep (getValues defs);
|
merge = loc: defs: concatStringsSep sep (getValues defs);
|
||||||
functor = (defaultFunctor name) // {
|
functor = (defaultFunctor name) // {
|
||||||
payload = sep;
|
payload = { inherit sep; };
|
||||||
binOp = sepLhs: sepRhs:
|
type = payload: types.separatedString payload.sep;
|
||||||
if sepLhs == sepRhs then sepLhs
|
binOp = lhs: rhs:
|
||||||
|
if lhs.sep == rhs.sep then { inherit (lhs) sep; }
|
||||||
else null;
|
else null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1014,7 +1015,11 @@ rec {
|
||||||
else "conjunction";
|
else "conjunction";
|
||||||
check = flip elem values;
|
check = flip elem values;
|
||||||
merge = mergeEqualOption;
|
merge = mergeEqualOption;
|
||||||
functor = (defaultFunctor name) // { payload = values; binOp = a: b: unique (a ++ b); };
|
functor = (defaultFunctor name) // {
|
||||||
|
payload = { inherit values; };
|
||||||
|
type = payload: types.enum payload.values;
|
||||||
|
binOp = a: b: { values = unique (a.values ++ b.values); };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Either value of type `t1` or `t2`.
|
# Either value of type `t1` or `t2`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue