-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Luka Jacobowitz
committed
Dec 12, 2017
1 parent
d8b496d
commit bd825fe
Showing
11 changed files
with
103 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
laws/src/main/scala/cats/laws/InvariantSemigroupalLaws.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package cats | ||
package laws | ||
|
||
|
||
/** | ||
* Laws that are expected for any `cats.InvariantSemigroupal`. | ||
*/ | ||
trait InvariantSemigroupalLaws[F[_]] extends InvariantLaws[F] with SemigroupalLaws[F] { | ||
implicit override def F: InvariantSemigroupal[F] | ||
|
||
} | ||
object InvariantSemigroupalLaws { | ||
def apply[F[_]](implicit ev: InvariantSemigroupal[F]): InvariantSemigroupalLaws[F] = | ||
new InvariantSemigroupalLaws[F] { def F: InvariantSemigroupal[F] = ev } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
laws/src/main/scala/cats/laws/discipline/InvariantSemigroupalTests.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package cats | ||
package laws | ||
package discipline | ||
|
||
import cats.InvariantSemigroupal | ||
import cats.laws.discipline.SemigroupalTests.Isomorphisms | ||
import org.scalacheck.{Arbitrary, Cogen} | ||
|
||
trait InvariantSemigroupalTests[F[_]] extends InvariantTests[F] with SemigroupalTests[F] { | ||
def laws: InvariantSemigroupalLaws[F] | ||
|
||
def invariantSemigroupal[A: Arbitrary, B: Arbitrary, C: Arbitrary](implicit | ||
arbFA: Arbitrary[F[A]], | ||
arbFB: Arbitrary[F[B]], | ||
arbFC: Arbitrary[F[C]], | ||
CogenA: Cogen[A], | ||
CogenB: Cogen[B], | ||
CogenC: Cogen[C], | ||
EqFA: Eq[F[A]], | ||
EqFB: Eq[F[B]], | ||
EqFC: Eq[F[C]], | ||
EqFABC: Eq[F[(A, B, C)]], | ||
iso: Isomorphisms[F]): RuleSet = new RuleSet { | ||
val name = "invariantSemigroupal" | ||
val parents = Seq(invariant[A, B, C], semigroupal[A, B, C]) | ||
val bases = Nil | ||
val props = Nil | ||
} | ||
} | ||
|
||
object InvariantSemigroupalTests { | ||
def apply[F[_]: InvariantSemigroupal]: InvariantSemigroupalTests[F] = | ||
new InvariantSemigroupalTests[F] { def laws: InvariantSemigroupalLaws[F] = InvariantSemigroupalLaws[F] } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters