Skip to content

Instantly share code, notes, and snippets.

@reevik
Created February 14, 2022 20:02
Show Gist options
  • Save reevik/11a3f17004e4579b7a4b85b615297dc7 to your computer and use it in GitHub Desktop.
Save reevik/11a3f17004e4579b7a4b85b615297dc7 to your computer and use it in GitHub Desktop.
abstract class Option[+T] {
def flatMap[U](f: T => Option[U]) : Option[U] = this match {
case Some(x) => f(x)
case None => None
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment