You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm working with the result library and found that you can't use the ternary operator because the failure case differs in type from the result case. It would work by creating a result type by using the same return type of the function but sometimes our return types are very long. I could create a type alias to have a smaller return type, but maybe a helper factory function like fail but for the result would be better? See the small example below:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I'm working with the result library and found that you can't use the ternary operator because the failure case differs in type from the result case. It would work by creating a result type by using the same return type of the function but sometimes our return types are very long. I could create a type alias to have a smaller return type, but maybe a helper factory function like fail but for the result would be better? See the small example below:
https://godbolt.org/z/9hs1xnarn
Please let me know if I'm misusing the library or made any other mistakes.
Beta Was this translation helpful? Give feedback.
All reactions