-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for different effects of HikariTransactor and its creation #1939
Allow for different effects of HikariTransactor and its creation #1939
Conversation
This is related to #1902 is that right? |
Oh yes, it is 👍 |
Sorry for the delay. I'm planning to playing around with the provided scenarios (from the issue) to get a better understanding of the need. |
May I add my two cents on this please. I wonder if it was better to create a separate set of functions with two effects instead of introducing breaking changes to the existing ones. Then the existing function could be kept compatible but their implementation could be changed to call the new more generic functions. The reasoning is that I guess likely 90-95% users (or so) do not need the effect separation. I believe it is a good practice in general – to provide simplified functions/methods for most common usages. |
Yes I agree that'd be great @satorg :) |
Good idea! I've renamed the other type variable to
It's not worth it. You can always just write HikariTransactor.fromHikariConfig[IO, IO](hikariConfig) instead of |
I totally agree that it is not that big deal. However, on the flip side changing existing functions Needless to say that adding a couple of new functions to the library is not a big deal either. No code duplication necessary there – more common used functions can simply call to more generic but relatively rare used ones. In other words: either do it just once in the library and that's it versus everyone does just once but in each project that uses the library. That said, I realize that it is absolutely matter of perception which of the two sides outweighs. |
Unfortunately it is a lot of code duplication. Majority of the code would be the long function signatures (which you can't reuse in contrast to function bodies). We're in an RC phase, we can afford changes like these. Of course, if we were stable already, I'd go with the worse, but compatible, way of duplicating the code. |
I'm in general agreement with @satorg here. It's best to uphold backwards compatibility and user-friendliness unless our hands are forced. But I can do the suggested change in a follow-up PR, no problem. |
I'm afraid that duplicating each method (once with 1 type parameter, once with 2 type parameters) would not be a nice API and very user friendly. But if that's what you want, I can do that myself. I think I'll have time to do it sometime this week. |
Partially revert the change in #1939 so that existing code don't fail to compile. Methods which construct HikariTransactor in a different effect now has the suffix "...SeparateEffect". The original single-effect methods are now implemented in terms of the separate-effect methods.
/cc @piton4k
closes #1902