twiddles
twiddles copied to clipboard
Simplify Scala 3 extension methods (not yet compiling)
Starting point for #10. The simplified extension methods here don't work for all hierarchy cases:
[error] -- [E007] Type Mismatch Error: /Users/mpilquist/Development/oss/twiddles/core/shared/src/test/scala/examples/Hierarchy.scala:62:33
[error] 62 | def c: Decoder[Foo] = (int *: (string: Decoder[String]) *: bool).to[Foo]
[error] | ^^^^^^^^^^^^^^^^^^^^^^^
[error] | Found: examples.Hierarchy.Decoder[String]
[error] | Required: examples.Hierarchy.Codec[A]
[error] |
[error] | where: A is a type variable with constraint
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/mpilquist/Development/oss/twiddles/core/shared/src/test/scala/examples/Hierarchy.scala:63:26
[error] 63 | def d: Decoder[Foo] = ((int: Decoder[Int]) *: string *: bool).to[Foo]
[error] | ^^^^^^^^^^^^^^^^^
[error] | Found: examples.Hierarchy.Decoder[Int]
[error] | Required: examples.Hierarchy.Codec[A]
[error] |
[error] | where: A is a type variable with constraint
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/mpilquist/Development/oss/twiddles/core/shared/src/test/scala/examples/Hierarchy.scala:65:33
[error] 65 | def f: Encoder[Foo] = (int *: (string: Encoder[String]) *: bool).to[Foo]
[error] | ^^^^^^^^^^^^^^^^^^^^^^^
[error] | Found: examples.Hierarchy.Encoder[String]
[error] | Required: examples.Hierarchy.Codec[A]
[error] |
[error] | where: A is a type variable with constraint
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] -- [E007] Type Mismatch Error: /Users/mpilquist/Development/oss/twiddles/core/shared/src/test/scala/examples/Hierarchy.scala:66:26
[error] 66 | def g: Encoder[Foo] = ((int: Encoder[Int]) *: string *: bool).to[Foo]
[error] | ^^^^^^^^^^^^^^^^^
[error] | Found: examples.Hierarchy.Encoder[Int]
[error] | Required: examples.Hierarchy.Codec[A]
[error] |
[error] | where: A is a type variable with constraint
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] four errors found