简体   繁体   中英

Lenses support in Play framework

Doesn't the Play framework have any lenses support included by default? Something like Monocole or those with Scalaz. Maybe there are recommended alternative approaches (along with their rationale) that I'm not aware of.

Scenario: I have an immutable, deeply nested object of a case class, and I want to copy it with a field changed somewhere in the object.

I'm looking specifically to do this very simply without needing much boilerplate, much like what lenses libraries like Monocole do.

I'm just surprised that Play framework doesn't have any support built in. Have I missed something? If not, is there any known plan for this support?

Play doesn't include type unions and heterogeneous lists ( shapeless ).

Play doesn't include automatic resource management ( scala-arm ).

Play doesn't include lenses ( Monocle or scalaz ).

It's a MVC web framework, and limits itself to that problem space. However, any of these libraries would be easy to add to a Play project. Play uses SBT, so just add to the libraryDependencies of your build.sbt / Build.scala appropriately.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM