Last active
December 22, 2015 07:08
-
-
Save japgolly/6435963 to your computer and use it in GitHub Desktop.
KeyedLens example
This file contains 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
case class Person(name: String) | |
case class Guitar(strings: Int, tuning: String, gauges: List[Double]) | |
case class Band(name: String, | |
members: Map[Person, Guitar], | |
otherPeopleWhoSupportTheGuitarists: Set[Person]) // Just ask Yngwie | |
// Sample data | |
val acle = Person("Acle") | |
val james = Person("James") | |
val gauge6 = List(0.010, 0.013, 0.017, 0.026, 0.036, 0.046) | |
val gauge7 = List(0.011, 0.014, 0.018, 0.028, 0.038, 0.049, 0.059) | |
val band = Band("Tesseract" | |
, Map( acle -> Guitar(7, "BEADGBE", gauge7), | |
james -> Guitar(6, "EADGBE", gauge6)) | |
, Set(Person("Jay"), Person("Amos"), Person("Ashe"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment