u/msimavin r/scala • Recommends
On “Fold or pattern matching with an Option?”
You should watch Marconi Lanna's talk on this topic. Here is link
42K subscribers • 85 videos on Hallway • Conference channel
Intermediate. Assumes working knowledge.
2.7K views10 years ago2 recommendations
Programming languagesSoftware designScalaFunctional programmingDesign patterns
Marconi Lanna explains how to use the Option monad in Scala using higher-order functions instead of pattern matching.
The Scaladoc page for Option says: "The most idiomatic way to use a scala.Option instance is to treat it as a collection or monad and use map, flatMap, filter, or foreach [...] A less-idiomatic way to use scala.Option values is via pattern matching." In this talk we show how to use the Option monad in an idiomatic, functional style, leveraging its comprehensive set of higher-order functions to solve any coding situation in a concise and declarative manner. After this talk, you will never have to pattern match against Options again! Help us caption & translate this video! amara.org/v/HbvW/What people say. Recommended as a great guide on when to use map, getOrElse, or fold instead of pattern matching on Scala Options.
u/msimavin r/scala • Recommends
On “Fold or pattern matching with an Option?”
u/nmarshall23in r/scala • Recommends
On “Fold or pattern matching with an Option?”
u/relativerin r/scala • Mentions
On “Fold or pattern matching with an Option?”