From fc7f063a7d7634dfefe8e778060241506ef77d1f Mon Sep 17 00:00:00 2001 From: Dave Rostron Date: Wed, 26 Aug 2015 11:46:15 -0700 Subject: [PATCH 1/3] add setMonoidInstance --- core/src/main/scala/cats/std/set.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/scala/cats/std/set.scala b/core/src/main/scala/cats/std/set.scala index c1ea40a376..5d3d31a7fd 100644 --- a/core/src/main/scala/cats/std/set.scala +++ b/core/src/main/scala/cats/std/set.scala @@ -23,4 +23,6 @@ trait SetInstances extends algebra.std.SetInstances { override def isEmpty[A](fa: Set[A]): Boolean = fa.isEmpty } + + implicit def setMonoidInstance[A]: Monoid[Set[A]] = MonoidK[Set].algebra[A] } From 028846c79c1162fa2290a2697f7107a31ca84a24 Mon Sep 17 00:00:00 2001 From: Dave Rostron Date: Wed, 9 Sep 2015 12:11:32 -0600 Subject: [PATCH 2/3] add law checking for setMonoidInstance --- tests/shared/src/test/scala/cats/tests/SetTests.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/shared/src/test/scala/cats/tests/SetTests.scala b/tests/shared/src/test/scala/cats/tests/SetTests.scala index ac36c9f653..fc5a29541b 100644 --- a/tests/shared/src/test/scala/cats/tests/SetTests.scala +++ b/tests/shared/src/test/scala/cats/tests/SetTests.scala @@ -4,6 +4,8 @@ package tests import cats.laws.discipline.{FoldableTests, MonoidKTests, SerializableTests} class SetTests extends CatsSuite { + checkAll("Set[Int]", algebra.laws.GroupLaws[Set[Int]].monoid) + checkAll("Set[Int]", MonoidKTests[Set].monoidK[Int]) checkAll("MonoidK[Set]", SerializableTests.serializable(MonoidK[Set])) From 345df6cc2f1cc0756e9db91cab320f68c487275d Mon Sep 17 00:00:00 2001 From: Dave Rostron Date: Wed, 9 Sep 2015 21:08:08 -0600 Subject: [PATCH 3/3] rename setMonoidInstance to setMonoid --- core/src/main/scala/cats/std/set.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/scala/cats/std/set.scala b/core/src/main/scala/cats/std/set.scala index 5d3d31a7fd..0f759ad795 100644 --- a/core/src/main/scala/cats/std/set.scala +++ b/core/src/main/scala/cats/std/set.scala @@ -24,5 +24,5 @@ trait SetInstances extends algebra.std.SetInstances { override def isEmpty[A](fa: Set[A]): Boolean = fa.isEmpty } - implicit def setMonoidInstance[A]: Monoid[Set[A]] = MonoidK[Set].algebra[A] + implicit def setMonoid[A]: Monoid[Set[A]] = MonoidK[Set].algebra[A] }