-
-
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
Add doctests for Semigroup, Group, and Monoid #2523
Add doctests for Semigroup, Group, and Monoid #2523
Conversation
|
probably need to add this setting to the kernel settings
|
* {{{ | ||
* scala> import cats.implicits._ | ||
* | ||
* scala> Monoid[String].combineAllOption(List("One ", "Two ", "Three")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you mean combineAll
here?
@kailuowang it doesn't seem to fix the problem. Locally I'm using the updated |
I might missed something but I don't see build.sbt updated |
You didn't miss it. I now pushed the updated The generated code: Travis failure: https://travis-ci.org/typelevel/cats/jobs/432625136 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to change the imports to be more specific and use the objects where the instances are defined, like so:
$ git diff
diff --git a/kernel/src/main/scala/cats/kernel/Group.scala b/kernel/src/main/scala/cats/kernel/Group.scala
index c792245e..31d01914 100644
--- a/kernel/src/main/scala/cats/kernel/Group.scala
+++ b/kernel/src/main/scala/cats/kernel/Group.scala
@@ -14,7 +14,7 @@ trait Group[@sp(Int, Long, Float, Double) A] extends Any with Monoid[A] {
*
* Example:
* {{{
- * scala> import cats.implicits._
+ * scala> import cats.kernel.instances.int._
*
* scala> Group[Int].inverse(5)
* res0: Int = -5
@@ -29,7 +29,7 @@ trait Group[@sp(Int, Long, Float, Double) A] extends Any with Monoid[A] {
*
* Example:
* {{{
- * scala> import cats.implicits._
+ * scala> import cats.kernel.instances.int._
*
* scala> Group[Int].remove(5, 2)
* res0: Int = 3
This is a bit annoying, but I don't see any way around it, short of defining a cats.kernel.implicits._
import object.
* | ||
* Example: | ||
* {{{ | ||
* scala> import cats.implicits._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that cats.implicits
is only defined in cats-core
, not in cats-kernel
, so importing it here won't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending successful build, approval from me.
Codecov Report
@@ Coverage Diff @@
## master #2523 +/- ##
==========================================
- Coverage 95.35% 95.34% -0.02%
==========================================
Files 358 358
Lines 6530 6535 +5
Branches 282 279 -3
==========================================
+ Hits 6227 6231 +4
- Misses 303 304 +1
Continue to review full report at Codecov.
|
PR for part of #2479.
Adds doctests for the
Semigroup
,Group
, andMonoid
typeclasses.