Skip to content

Add checked exceptions for run #3

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joneshf
Copy link

@joneshf joneshf commented May 9, 2018

As discussed on slack. This is mostly copy/paste. Let me know if something should change.

We can provide similar behavior to `Control.Monad.Except.Checked`
except in the world of `run`.
The general idea is the same though:
use polymorphic variants to encode exceptions and handle appropriately.

This is mostly a copy of `Control.Monad.Except.Checked`.
There's been some massaging of types and values to make things line up.
. RowToList handlers rl
⇒ VariantMatchCases rl excHandled (Run (except :: EXCEPTV excOut | r) a)
⇒ Union excHandled excOut excIn
⇒ Union r m (except :: EXCEPTV excOut | r)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about this bit of the type.

The expand below forced this constraint. Is it right? Maybe there's another way to do the same thing?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the expand necessary if you account for duplicate labels? That is, something like

  ...
  → Run (except :: EXCEPTV excIn, except :: EXCEPTV excOut | r) a
  → Run (except :: EXCEPTV excOut | r) a

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like dropping the expand and changing to the signature you suggest allows dropping the Union r m (except :: EXCEPTV excOut | r) constraint.

Which would you prefer: with expand and constraint, or without?

@joneshf
Copy link
Author

joneshf commented May 19, 2018

@natefaubion thoughts?

@natefaubion
Copy link
Owner

Sorry about this. Apparently I'm not automatically watching my repos, so I've gotten no notifications 😆

@joneshf
Copy link
Author

joneshf commented May 19, 2018

No worries, I do the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants