-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Invariant and Semigroupal typeclasses for ViewF
- Loading branch information
1 parent
e07e0b1
commit 8239eb9
Showing
4 changed files
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2016-2023 Association of Universities for Research in Astronomy, Inc. (AURA) | ||
// For license information see LICENSE or https://opensource.org/licenses/BSD-3-Clause | ||
|
||
package crystal | ||
|
||
import cats.Eq | ||
import cats.Id | ||
import cats.Invariant | ||
import cats.laws.discipline.InvariantTests | ||
import cats.laws.discipline.SemigroupalTests | ||
import munit.DisciplineSuite | ||
|
||
import arbitraries.given | ||
|
||
class ViewFLawsSpec extends DisciplineSuite { | ||
|
||
private given viewEq[A: Eq]: Eq[ViewF[Id, A]] = Eq.by(_.get) | ||
|
||
checkAll( | ||
"ViewF[Int].InvariantLaws", | ||
InvariantTests[ViewF[Id, *]].invariant[Int, Int, String] | ||
) | ||
|
||
checkAll( | ||
"ViewF[Int].SemigroupalLaws", | ||
SemigroupalTests[ViewF[Id, *]].semigroupal[Int, Int, String] | ||
) | ||
} |
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