-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use standard naming convention and types for things that can fail #116
Comments
unisonweb/unison#3336 is related (opened on unisonweb/unison as opposed to unisonweb/base). |
@runarorama and I discussed this. We considered the question - what should the type of
Do we offer all these variations? Which one gets the good name? What's the naming convention for the rest? Whatever we pick, it's valuable to be consistent. One less thing to think about. We tentatively landed on:
Which can be implemented consistently across base. The Rationale:
An observation is that abilities are ergonomic for propagating errors, but as errors propagate over larger scopes, the handler of the error lacks sufficient information to do anything other than reraise it or deal with it in a generic way. (Vs, say, a But it's actually difficult to include enough information in failures to allow larger scope handers of those failures to make fine-grained choices. For instance, in larger error scopes, the same class of error can easily occur at multiple locations, so tagging errors with a type doesn't pinpoint which site produced the error and allow a non-generic response. Also, in larger error scopes, the information that could allow a more fine-grained handling of the error won't be of a common type. (Like there may be 3 text decoding failures and two I feel like there's maybe some nicer abstraction waiting to be discovered to allow the user to take multiple actions that can fail, then handle or reraise or combine these failures later, on a fine-grained level if desired. |
We have some functions that return
Either Text a
, others that returnEither Failure a
, and others that require{Exception}
. I thinkEither Text a
is right out, just replace that withEither Failure a
in all cases, since theFailure
can contain aText
message as well as an error type.Maybe the ones that return
Either
start withtry
, and the ones that throw exception don't.Often both versions are useful.
The text was updated successfully, but these errors were encountered: