ekmett / ekmett/exceptions

eitherToThrow

Open
#48 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
57
Forks
38
PR merge metrics
No merged PRs in 30d

Description

I often look for

``` hs
eitherToThrow :: (MonadThrow m, Exception e) => Either e a -> m a
eitherToThrow (Right x) = pure x
eitherToThrow (Left e) = throwM e
```

is it there already, in more general version?

There is [`eitherToError`](http://hackage.haskell.org/package/either-4.4.1/docs/Data-Either-Combinators.html#v:eitherToError) in `either`, but it's a bit different.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.