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

macro to deal with try-catch for either monad #154

Closed
shmish111 opened this issue Feb 24, 2016 · 2 comments
Closed

macro to deal with try-catch for either monad #154

shmish111 opened this issue Feb 24, 2016 · 2 comments

Comments

@shmish111
Copy link

Would it be possible to add the following to the either namespace, I use it all the time:

(defmacro try-either
  "try to evalute the body and return the result as a right, if an exception is throw return the exception as a left"
  [& body]
  `(try (right ~@body)
        (catch Exception e# (left e#))))
@ghost
Copy link

ghost commented Feb 24, 2016

Makes sense, feel free to open a pull request!

@shmish111
Copy link
Author

created #155

@ghost ghost closed this as completed Feb 24, 2016
This issue was closed.
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

No branches or pull requests

1 participant