Skip to content

Commit f407f6f

Browse files
committed
lib.types: chore use consistent payload form
1 parent fd6bc1b commit f407f6f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/types.nix

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,10 @@ rec {
475475
check = isString;
476476
merge = loc: defs: concatStringsSep sep (getValues defs);
477477
functor = (defaultFunctor name) // {
478-
payload = sep;
479-
binOp = sepLhs: sepRhs:
480-
if sepLhs == sepRhs then sepLhs
478+
payload = { inherit sep; };
479+
type = payload: types.separatedString payload.sep;
480+
binOp = lhs: rhs:
481+
if lhs.sep == rhs.sep then { inherit (lhs) sep; }
481482
else null;
482483
};
483484
};
@@ -1014,7 +1015,11 @@ rec {
10141015
else "conjunction";
10151016
check = flip elem values;
10161017
merge = mergeEqualOption;
1017-
functor = (defaultFunctor name) // { payload = values; binOp = a: b: unique (a ++ b); };
1018+
functor = (defaultFunctor name) // {
1019+
payload = { inherit values; };
1020+
type = payload: types.enum payload.values;
1021+
binOp = a: b: { values = unique (a.values ++ b.values); };
1022+
};
10181023
};
10191024

10201025
# Either value of type `t1` or `t2`.

0 commit comments

Comments
 (0)