cquiroz on master
Update sbt-scalafmt to 2.4.5 Merge pull request #1236 from s… (compare)
xuwei-k on master
Update index.js (#1234) * Upda… (compare)
cquiroz on master
Update scalafmt-core to 3.2.1 Merge pull request #1235 from s… (compare)
@julien-truffaut I have the same problem as here: https://stackoverflow.com/a/42668525/9199853 I tried to replicate your answer with the updated API:
import monocle.macros.GenIso case class Alpha(text: String = "content") case class Beta(alpha: Alpha = Alpha()) case class Gamma(beta: Option[Beta]) val navigateToText = GenIso[Gamma, Option[Beta]] .andThen(GenIso[Beta, Alpha].asPrism.below[Option]) .andThen(GenIso[Alpha, String].asPrism.below[Option])
it compiles. but if I add another field to
maybeI: Option[Int] it complains of:
Found several case class accessor for Gamma, Gamma needs to be a case class with a single accessor.
which makes sense now that I think about it. is there a way of solving the more generalised problem?
index. Sorry for the noise again. I have to be careful that doesn't become a running gag.
GenLens[MyType](_.abc.def)to build a lens for later usage, which works very very nice (Monocle 2.1.0 Scala 2.13).
composeLenswith a lens and "identity lenses" I would expect no effect on the result after executing the "lens chain".
GenLens[MyType](identity)does not compile,
GenLens[MyType](x=>x)does not compile too.
Upgrading to 3.0.0 and trying to switch to
andThen but it’s causing ambiguous overloaded method in a lot of places.
val x: Optional[State,Option[EiaChannelNumber]] = Lenses.muxEiaChannel(idx) val y: Optional[State,EiaChannelNumber] = x.andThen(some) // Overloaded method andThen // Lenses.muxEiaChannel(idx).andThen(some)
It works if I explicitly type the intermediate variables but it does not like to be chained. Any tips?
indexworks as expected
Ok, in a source file that just imports from the monocle namespace, I have:
val projectListLens = Iso.id[List[Project]].asLens def indexedProjectLens(projectId: Int) = projectListLens.index(projectId)
and all seems good. Then, in a separate source file that imports from monocle as well as from cats, I have:
val projectLens = indexedProjectLens(projectId) // this is ok val plens = projectListLens.index(projectId) // this is not ok
with a type mismatch on
projectId: found projectId.type (underlying type Int), expected cats.Representable.Aux[monocle.PLens[...]]
How do I make the latter (
val plens = ...) work when cats names are imported?