Source Generation
FxKit ships with a few (optional) source generators, each enabled by their respective attribute:
[EnumMatch]
: generates aMatch
extension method for the enum type. Useful to guarantee exhaustive matching. Each enum member will be represented as a function parameter toMatch
.[Lambda]
: when used at the type level, generates aλ
as aFunc
, allowing you to pass a type's constructor as a function. When used on a method, generates aFunc
for that method suffixed withλ
in the name.[Union]
: turns the record into a union type. Each member gets aλ
andOf
methods for constructing the member. The return type of these is the base type which makes it useful for mapping.[GenerateTransformer]
: when used on extension methods that operate on functor types.
To use, install the FxKit.CompilerServices
and FxKit.CompilerServices.Annotations
packages.