diff options
| author | Silvan Mosberger <contact@infinisil.com> | 2024-12-09 16:23:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-09 16:23:19 +0100 |
| commit | 062945b725875167a24b11c4c1f2ba8e7623d3d6 (patch) | |
| tree | c82240fd1d4e35a93bfaaff1ea997e426fcbae76 /lib/types.nix | |
| parent | vimPlugins.nvim-lspconfig: 2024-12-02 -> 2024-12-08 (#363412) (diff) | |
| parent | lib.types: add release notes (diff) | |
| download | nixpkgs-062945b725875167a24b11c4c1f2ba8e7623d3d6.tar.gz | |
lib.types: chore use consistent payload form (#363565)
Diffstat (limited to 'lib/types.nix')
| -rw-r--r-- | lib/types.nix | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/types.nix b/lib/types.nix index 097ab1b42dcb..8eaded915297 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -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`. |
