-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MatchError using as
inside Focus
#1200
Labels
Comments
Here's another one, this time from an
|
This is actually related to |
|
I tried to but could not reproduce the issue from the opening post. Here is also a somewhat minimized version: import java.time.Instant
import monocle.Focus
import monocle.Focus.focus
import monocle.function.Index
enum LDP:
case Container(content: Map[String, LDP], created: Instant = Instant.now)
case TextResource(content: String, created: Instant = Instant.now)
end LDP
import LDP._
given Index[LDP, String, LDP] =
Index(key => Focus[LDP](_.as[Container].content.index(key)))
given [S, I](using Index[S, I, S]): Index[S, List[I], S] =
Index {
case Nil => Focus[S]()
case key :: keys => Focus[S](_.index(key).index(keys))
}
val container = Container(Map("foo" -> Container(Map("bar" -> TextResource("banana")))))
container.focus(_.index(List("foo", "bar")).as[TextResource]).getOption |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Playing with this codebase: https://github.com/bblfish/lens-play/blob/master/src/main/scala/server/Server.scala
The text was updated successfully, but these errors were encountered: