Automatic support for named prisms
In the same way that the .name syntax automatically navigates case-class-like fields with Lenses, it should be able to navigate ADTs in sealed class hierarchies with Prisms. This should be possible with getKnownDirectSubclasses.
But using what syntax? We could use the name of the subclass, where it looks for a field by that name first, then looks for a subclass name:
val myOpt: Option[Int] = Some(4)
set"$myOpt.Some.x"' += 1
// Some(5)
Is that obvious enough to justify "you already know how to use it"? What else could it be?
@kenbot what's the get in your example? Shouldn't it be x as Some is defined like:
final case class Some[+A](x: A) extends Option[A]
Get/set modes generate minimal getter/setter structure respectively. It just generates Getter(_.zeroArgMethod). They can get away with this because the use case is known; lens mode (or GenLens for that matter) need full lenses because the usecase is unknown.
Fwiw, per #26, lens mode will also auto-gen Isos where it can, eg single arg case classes.
Oh wait, my example is performing a set! That's clearly wrong.
Fixed, thanks.