mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
lib/types: simplify eitherRecursive
by defining it only once
This commit is contained in:
parent
a5152c2f8e
commit
27a0dd435d
3 changed files with 10 additions and 5 deletions
|
@ -13,8 +13,6 @@ let
|
||||||
// {
|
// {
|
||||||
getSubOptions = prefix: (t1.getSubOptions prefix) // (t2.getSubOptions prefix);
|
getSubOptions = prefix: (t1.getSubOptions prefix) // (t2.getSubOptions prefix);
|
||||||
};
|
};
|
||||||
|
|
||||||
eitherRecursive = t1: t2: (final.types.either t1 t2) // { getSubOptions = _: { }; };
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -13,6 +13,6 @@ lib.extend (
|
||||||
maintainers = prev.maintainers // import ./maintainers.nix;
|
maintainers = prev.maintainers // import ./maintainers.nix;
|
||||||
|
|
||||||
# Merge in our custom types
|
# Merge in our custom types
|
||||||
types = call ./types.nix { } // prev.types;
|
types = prev.types // call ./types.nix { };
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -95,8 +95,15 @@ rec {
|
||||||
strLua = strLikeType "lua code string";
|
strLua = strLikeType "lua code string";
|
||||||
strLuaFn = strLikeType "lua function string";
|
strLuaFn = strLikeType "lua function string";
|
||||||
|
|
||||||
# Overridden when building the documentation
|
# When building the documentation `either` is extended to return the nestedType's sub-options
|
||||||
eitherRecursive = types.either;
|
# This type can be used to avoid infinite recursion when evaluating the docs
|
||||||
|
# TODO: consider deprecating this in favor of using `config.isDocs` in option declarations
|
||||||
|
eitherRecursive =
|
||||||
|
t1: t2:
|
||||||
|
types.either t1 t2
|
||||||
|
// {
|
||||||
|
getSubOptions = _: { };
|
||||||
|
};
|
||||||
|
|
||||||
listOfLen =
|
listOfLen =
|
||||||
elemType: len:
|
elemType: len:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue