optics-dev / Monocly

Optics experimentation for Dotty
MIT License
32 stars 5 forks source link

Non-case class getters in Focus #39

Closed kenbot closed 2 years ago

kenbot commented 3 years ago

There's no reason not to allow plain old getter methods on non-case classes, generating a Getter. This is something that a user might reasonably guess is supported, and it seems unreasonably to make them bust out the Optics Family documentation to do it.

eg Focus[String](_.length) // Getter[String,Int]