purescript/purescript-exceptions

Add try operator

kritzcreek opened this issue · 3 comments

Could we add a try operator like Control.Exception has in Haskell? I'm currently using this:

try   a e. Eff (err  EXCEPTION | e) a  Eff e (Either Error a)
try action = catchException (pure ∘ Left) (Right <$> action)

The only problem would be that this introduces a dependency on purescript-either.

garyb commented

I don't think having that dependency would be a problem. What say you @paf31?

paf31 commented

Sounds good to me.

Fixed with #16