Skip to content
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

datasets : add exceptions #28

Open
ocramz opened this issue Jan 1, 2019 · 1 comment
Open

datasets : add exceptions #28

ocramz opened this issue Jan 1, 2019 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ocramz
Copy link
Member

ocramz commented Jan 1, 2019

currently, the parsers error and fail here and there. Since these are synchronous exceptions, it would be better to use MonadThrow, which can be conveniently used at a "pure" type such as Maybe or Either.

  1. add exceptions as dependency
  2. import Control.Monad.Catch (MonadThrow(..))
  3. declare some parsing exceptions type (which require Typable and Exception instances, see https://www.fpcomplete.com/blog/2016/11/exceptions-best-practices-haskell)
  4. convert the calls to error and fail into calls to throwM
@ocramz ocramz added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jan 1, 2019
@stites
Copy link
Member

stites commented Jan 2, 2019

I've been working on this a bit already with safe-exceptions via #22 (and PR #31 ).

There is a question of how to treat safe vs unsafe code. For instance, from #31, is the right thing to have a readDataset :: x paired with a safeReadDataset :: MonadThrow m => m x or an unsafeReadDataset :: x paired with a readDataset :: MonadThrow m => m x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants