0

I am trying to create a Monocle lens with nested case classes and sequences.

import monocle.macros.GenLens
import monocle.function.Each.each

case class A(bs: Seq[B])
case class B(c: Int)

val bs = GenLens[A](_.bs)
val c = GenLens[B](_.c)

val cs = (bs composeTraversal each composeLens c)

Compilation fails on the last line. I am using Monocle 1.5.0-cats.

PS: replacing Seq[B] by List[B] works, but my case classes are generated by scalaxb, which uses sequences.

pgrandjean
  • 676
  • 1
  • 9
  • 19

1 Answers1

1

I know this is not a "real answer" but I also have issues with Seq in Monokle. I get exactly the same answer from my very experienced colleague: "There is no support to Seq from Cats. This is the reason good enough to not use it. Use Vector as the Seq default implementation". :(

Lakitu Lakitutu
  • 270
  • 1
  • 7