Currently, when I call Try and Result in a chain, the resulting object can be a combination of their successes or failures.
While it’s OK for a happy path, for the unhappy one I must check the type to know if I should call “.exception” or “.failure” to get the error.
Is there a better way?
I guess you mean a chain of bind
operations. In this case what you get is not exactly a combination of their successes or failures. What you get is the last success (when all the operations were successful) or the first failure found.
While there is no way to enforce it in a dynamic language like ruby, you should design your bind operations so that they always return a success or a failure (so not an unwrapped value). What then follows is a case analysis on its final returned wrapped value. So, in fact you should always check the type. Even if it seems a bad practice in OO languages, it is the common way in functional languages.