-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from TinkoffCreditSystems/classy-optics
Classy Optics
- Loading branch information
Showing
10 changed files
with
133 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package tofu.optics | ||
|
||
trait PBase[-S, +T, +A, -B] { | ||
def label[label]: this.type with Label[label] = this.asInstanceOf[this.type with Label[label]] | ||
} |
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 |
---|---|---|
|
@@ -81,3 +81,5 @@ object Optic { | |
} | ||
|
||
|
||
|
||
|
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
13 changes: 13 additions & 0 deletions
13
optics/macro/src/test/scala-2.13/tofu/optics/macros/TestClassyContains.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,13 @@ | ||
package tofu.optics.macros | ||
import tofu.optics.{Contains, Label, PContains, Update} | ||
|
||
object TestClassyContains { | ||
// compile test for searching classy optics | ||
implicitly[Contains[FooBar2, Int] with Label["i"]] | ||
implicitly[Contains[FooBar2, String] with Label["j"]] | ||
implicitly[Contains[FooBar4[Double], Int] with Label["i"]] | ||
implicitly[Contains[FooBar4[Double], String] with Label["j"]] | ||
implicitly[Contains[FooBar4[Double], String]] | ||
implicitly[Update[FooBar4[Double], String]] | ||
implicitly[PContains[FooBar4[Double], FooBar4[Long], Double, Long] with Label["x"]] | ||
} |
2 changes: 2 additions & 0 deletions
2
optics/macro/src/test/scala/tofu/optics/macros/GenContainsSpec.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
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