Created
January 5, 2016 19:10
-
-
Save sullivan-/fc08ebb9ce05a46d7288 to your computer and use it in GitHub Desktop.
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
trait PState[R <: Root] { | |
def get: R | |
def map(f: R => R): PState[R] | |
} | |
val userState: PState[User] = getUserState() | |
val user: User = userState.get | |
val updatedState: PState[User] = userState.map(_.copy(title = Some(newTitle))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment