chumsky
chumsky copied to clipboard
Better Debug for `Rich`, `RichReason`, `RichPattern`.
These don't follow the typical expectation of Debug. For example, RichPattern doesn't show you which enum branch it's on, instead just directly formatting the inner label or token. This makes it difficult to figure out how to map errors.
There is a compromise here between two unfortunate constraints. Specifically, a lot of users use the Debug impl to debug their compiler in the early stages of development. But, as you say, it can be useful to display the exact contents of the type. Perhaps the two should be split, such as by providing a .display()-like method? I'd like to hear your thoughts.