Elevator Pitch
Variant is a small (3kB
gzipped) library that can dramatically reorganize your codebase for code clarity, safety, and expressivity.
- Use variant to quickly define discriminated unions (a.k.a. discriminated unions or algebraic data types).
- Use
match()
/matcher()
to process these variants in a type-safe expressions with improved developer experience.- Being exhaustive by default, these functions ensure all cases are handled, but have support for partial and multi-matching as well.
⏲️ coming soon.