News for hackers. Stuff that matters.
Re:Using enums to represent state in Rust by sfvisser on Friday September 22, 2023 @04:09PM (#37617098)
If you like this kind of pattern you might want to read up on Haskell’s GADTs. Generalized algebraic data-types.

This is where you can index the different constructors (enum variants) with an additional type variables and even specialize them when needed. A pretty powerful tool to encode at the type level that similar things are slightly different.

There are no comments on this comment yet.