optics-dev / optics-dev/Monocle
Ambient `opaque type` breaks `MkFocus`
Open
Nobody has claimed this yet.
bug
- Dominant language
- Scala
- Stars
- 1.7k
- Forks
- 207
- Avg merge
- 7h 59m
- Merged PRs (30d)
- 5
Description
//> using scala "3.2.0"
//> using lib "dev.optics::monocle-macro::3.1.0"
trait Qux
object Foo {
opaque type Bar = Qux
case class Baz(id: String)
object Baz {
implicit val bazId: monocle.Lens[Foo.Baz, String] = new monocle.Focus.MkFocus[Foo.Baz].apply(_.id)
}
}
[error] ./bug.scala:12:57: Found: monocle.PIso[?1.CAP, ?2.CAP, String, String]
[error] Required: monocle.Lens[Foo.Baz, String]
[error]
[error] where: ?1 is an unknown value of type scala.runtime.TypeBox[Nothing, Foo.type{Bar = Qux}#Baz]
[error] ?2 is an unknown value of type scala.runtime.TypeBox[Nothing, Foo.type{Bar = Qux}#Baz]
[error] implicit val bazId: monocle.Lens[Foo.Baz, String] = new monocle.Focus.MkFocus[Foo.Baz].apply(_.id)
[error] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the standalone Scala snippet and its Scala 3.2.0 and monocle-macro 3.1.0 directives. Start by inspecting monocle.Focus.MkFocus and the generated optic type around apply(_.id); done means the example compiles with the declared Lens[Foo.Baz, String] type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100