Do::Halt is a
StandardError. Because of that rescue block can unexpectedly catch it in a wrapped method. This problem has been reported at https://github.com/dry-rb/dry-monads/issues/72
Do::Halt was a direct
Exception derivative it would be nearly invisible to end-user.
Both ActiveRecord and Sequel catch
Exception. While this indeed is a breaking change it shouldn’t affect majority of users.
Can I open a PR for that?
Frankly speaking, I don’t remember why it doesn’t subclass
Exception in the first place. We can change it in the next major version, i.e. 2.0, I don’t plan to break backwards compatibility until then. OTOH, do notation is not supposed to be used with
rescue so I don’t think this is a big problem anyway.
I understand that this a breaking change so pushing its release forward in time is fine.
I don’t agree with the statement that do notation is not supposed to be used with exceptions handling. I don’t see any reason for this restriction.
Is there a roadmap for dry-monads or a PR tag or a long living branch that will potentailly become 2.0 or 1.1 in the future?
There is no roadmap for dry-monads, it’s pretty much complete. I’d like to change Maybe to make it lawful someday, this will be a breaking change so it’s a way to 2.0, with no due date. What comes to do notation, it’s a statement, I developed it with no intention to support exception handling, this was a purposeful decision. In my opinion, it makes reasoning about program flow harder and I don’t endorse this style of programming. If dry-monads makes it complicated it’s fine by me. For exceptions there’s
Try and there’s
rescue outside of do-driven methods, this is what I suggest to use.
I think if you send a PR it’ll make it easier to not forget about this change, it’s fine if it’ll be there a while.