-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Any reason intercalate
isn't exposed directly on the Semigroup
companion object?
#4615
Comments
I don't think it is an oversight, but rather a very particular case that just has never been in demand previously. Semigroup[String].reverse
// VERSUS
Semigroup.reverse[String] When it comes to |
It was an oversight. This style of typeclass encoding was used in the algebra project which predates cats and was absorbed into cats. The motivation is that if you have
Cats used an approach of just giving There is a lot of boilerplate with the approach of duplicating methods from the typeclass into the object in order to hopefully get some nice type-inference cases. Personally, I have moved away from the style in most cases. That said, I'm not opposed to adding it. |
Thanks, both. As it stands right now, it seems that only What I'd do is add both Does that sound good? If yes, I'll open a PR with both |
Is there a reason not to expose the
intercalate
method directly on theSemigroup
object?It provides some type inference convenience in that we can now write
Semigroup.intercalate(";")
, for example, instead ofSemigroup[String].intercalate(";")
.Am I missing something or is it just an oversight?
The text was updated successfully, but these errors were encountered: