macro to deal with try-catch for either monad
shmish111 opened this issue · 2 comments
shmish111 commented
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#))))
Deleted user commented
Makes sense, feel free to open a pull request!