Last active
August 29, 2015 14:05
-
-
Save julien-truffaut/aef35820727888b3411e to your computer and use it in GitHub Desktop.
Multi compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import monocle._ Monocle._ | |
case class Order(name: String, articles: List[Article]) | |
case class Article(properties: Map[String, String]) | |
val order = Order("name", List(Article(Map("name" -> "door", "colour" -> "red")), Article(Map("name" -> "shoes")))) | |
val _articles = Lenser[Order](_.articles) | |
val _properties = SimpleIso[Article, Map[String, String]](_.properties, Article(_)) | |
val names = order |-> _articles |->> each |->> _properties |->> index("name") getAll |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment