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

Added liftEither for lifting Either into MonadError #37

Merged
merged 1 commit into from
Aug 29, 2017

Conversation

ElvishJerricco
Copy link
Contributor

@ElvishJerricco ElvishJerricco commented Jul 8, 2016

Lifts an Either e into any MonadError e.

do { val <- liftEither =<< action1; action2 }

where action1 returns an Either to represent errors.

Lifts an @'Either' e@ into any @'MonadError' e@.

> do { val <- liftEither =<< action1; action2 }

where @action1@ returns an 'Either' to represent errors.
@ekmett ekmett merged commit b6cbdee into haskell:master Aug 29, 2017
@ElvishJerricco
Copy link
Contributor Author

@ekmett, in hindsight, perhaps this should have been called throwEither, and accompanied by throwMaybe :: MonadError e m => e -> Maybe a -> m a. What do you think?

@ocharles
Copy link

I think lift is fine, but would also like liftMaybe.

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

Successfully merging this pull request may close these issues.

4 participants