Skip to content

Instantly share code, notes, and snippets.

@sullivan-
Created January 5, 2016 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sullivan-/fc08ebb9ce05a46d7288 to your computer and use it in GitHub Desktop.
Save sullivan-/fc08ebb9ce05a46d7288 to your computer and use it in GitHub Desktop.
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