Standard Library Changes: Add string singleton comparison operators to scala.compiletime.ops.string

Pull Request: Add string singleton comparison operators to scala.compiletime.ops.string. by wtetzner · Pull Request #24748 · scala/scala3 · GitHub

The numeric singleton types already have comparison operators, but for some reason this was still missing for singleton String types.

This enables a lot of potential valuable type-level computations, but one in particular is the ability to sort a named tuple, which means that if you’re commonly adding/removing entries from a named tuple, this provides a way to normalize them, so two named tuples that were constructed in a different order can still be treated as equivalent types.

8 Likes

bravo, I think this is a great addition, particularly to unlock the ability to sort named tuple keys in some canonical way