lib.types: chore use consistent payload form (#363565)

This commit is contained in:
Silvan Mosberger 2024-12-09 16:23:19 +01:00 committed by GitHub
commit 062945b725
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 4 deletions

View file

@ -475,9 +475,10 @@ rec {
check = isString;
merge = loc: defs: concatStringsSep sep (getValues defs);
functor = (defaultFunctor name) // {
payload = sep;
binOp = sepLhs: sepRhs:
if sepLhs == sepRhs then sepLhs
payload = { inherit sep; };
type = payload: types.separatedString payload.sep;
binOp = lhs: rhs:
if lhs.sep == rhs.sep then { inherit (lhs) sep; }
else null;
};
};
@ -1024,7 +1025,11 @@ rec {
else "conjunction";
check = flip elem values;
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`.