Revise the typed throws design #10
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes the conventions for typed throws for the parser initializers that used the conditionally-defined
ThrownParsingError
type alias. Some of the parsers didn't actually need that alias, and instead could use a function-specific generic error.For others parsers, the library now provides two overloads: one with
ParsingError
-typed errors and one with untyped errors, which is omitted in embedded contexts. Since it is more specific, the typed- error overload is chosen when a passed-in closure either does not throw or throws onlyParsingError
s.This also reworks the methods in "ParserSource.swift" with the only thing still really using
ThrownParsingError
being theExpressibleByParsing
protocol, since it is significantly more wide open than the lower-level parsers.Checklist