-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record failures to adapt application arguments
- Loading branch information
Showing
12 changed files
with
76 additions
and
19 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
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
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 |
---|---|---|
|
@@ -58,5 +58,5 @@ object Test2: | |
def foo5(x: Int) = | ||
foo2(foo2(,) // error // error | ||
|
||
println(bam) // error | ||
println(bam) | ||
// error |
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,40 @@ | ||
import scala.language.implicitConversions | ||
|
||
// We do have 2 `contramap` functions, one provided via `LoggerSyntax` other via `Contravariant.Ops` | ||
// `ContravariantMonoidal` given instances are not used, and they do not match our type. Code fails when we have at least 2 instances of them | ||
// Removal of `import catsSyntax._` allow to compile code | ||
// Removal of `import odinSyntax.LoggerSyntax` and remaining `catsSyntax` would fail to compile the `def fails` | ||
|
||
trait Foo[A] | ||
trait Bar[A] | ||
|
||
trait WriterT[F[_]: Contravariant, L, V]: | ||
def contramap[Z](fn: Z => V): WriterT[F, L, Z] = ??? | ||
trait Logger[F[_]] | ||
class WriterTLogger[F[_]] extends Logger[[G] =>> WriterT[F, List[String], G]] | ||
|
||
trait ContravariantMonoidal[F[_]] extends Invariant[F] with Contravariant[F] | ||
trait Invariant[F[_]] | ||
object Invariant: | ||
given ContravariantMonoidal[Foo] = ??? | ||
given ContravariantMonoidal[Bar] = ??? | ||
|
||
trait Contravariant[F[_]] extends Invariant[F] | ||
object Contravariant: | ||
trait Ops[F[_], A]: | ||
def contramap[B](f: B => A): F[B] = ??? | ||
|
||
object catsSyntax: | ||
implicit def toContravariantOps[F[_]: Contravariant, A](target: F[A]): Contravariant.Ops[F, A] = ??? | ||
|
||
object odinSyntax: | ||
implicit class LoggerSyntax[F[_]](logger: Logger[F]): | ||
def contramap(f: String => String): Logger[F] = ??? | ||
|
||
import catsSyntax._ | ||
import odinSyntax.LoggerSyntax | ||
|
||
class Test: | ||
def fails = new WriterTLogger[Option].contramap(identity) | ||
def works = LoggerSyntax(new WriterTLogger[Option]).contramap(identity) | ||
|
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,21 @@ | ||
import scala.language.implicitConversions | ||
|
||
trait Foo[A] | ||
trait Bar[B] | ||
trait Qux[C] | ||
class Log[K[_]] | ||
|
||
trait Inv[F[_]] | ||
object Inv: | ||
given monFoo: Inv[Foo] = ??? | ||
given monBar: Inv[Bar] = ??? | ||
|
||
trait InvOps[H[_], D] { def desc(s: String): H[D] = ??? } | ||
trait LogOps[L[_]] { def desc(s: String): Log[L] = ??? } | ||
|
||
class Test: | ||
implicit def LogOps[Q[_]](l: Log[Q]): LogOps[Q] = ??? | ||
implicit def InvOps[J[_], E](j11: J[E])(implicit z: Inv[J]): InvOps[J, E] = ??? | ||
|
||
def fails = new Log[Qux].desc("fails") | ||
def works = LogOps[Qux](new Log[Qux]).desc("works") |