Skip to content

Instantly share code, notes, and snippets.

@justinhj
Created January 16, 2020 05:35
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 justinhj/82635f24b738f773591d201a619062fe to your computer and use it in GitHub Desktop.
Save justinhj/82635f24b738f773591d201a619062fe to your computer and use it in GitHub Desktop.
// When the left and right hand side are set we take the right side
(LastOption("Nero".some) |+| LastOption("Titus".some)).show
// res1: String = "Titus"
// When the left is None and the right hand side is set we also take the right side
(LastOption(None: Option[String]) |+| LastOption("Titus".some)).show
// res2: String = "Titus"
// When the left side is set and the right side is None we keep the left side
(LastOption("Nero".some) |+| LastOption(None: Option[String])).show
// res3: String = "Nero"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment