label assigns a meaningful message to a parser failure. When the enclosed parser returns a failure, label replaces the existing ParseError message while preserving the most recent failure location. section 9.5.1 section 9.6.3
Use label when a low-level parser error needs a clearer description:
- Implement it by mapping over the failing Result and applying ParseError.label. section 9.6.3
- Prefer scope when nested context matters, because scope adds a message instead of discarding inner details. section 9.5.2 section 9.6
Naming a nonnegative integer failure
Wrap a numeric parser with nonNegativeInt.label("non-negative integer"). A failed conversion then reports the simpler domain-level message rather than exposing the parser's previous error details; scope would preserve those details instead. section 9.8
