Skip to content

Conversation

mpilquist
Copy link
Member

@mpilquist mpilquist commented Oct 28, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant