Stop using, opt match { case Some(x) => f(x); case None => y } Stop using, http://opt.map (f).getOrElse(y) Use, opt.fold(y)(f) I feel like I'm very late to this party.
-
-
I can sympathize with that. opt.fold(ifEmpty = x)(f)?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
mine would be that "match" expressions let you break parametricity without warning (https://typelevel.org/blog/2014/11/10/why_is_adt_pattern_matching_allowed.html#a-selector-subtlety …) So I try to avoid pattern matching when there is a safer alternative, unless tailrec optimization is required.
-
not to mention bugs like https://github.com/scala/bug/issues/5365 …
End of conversation
New conversation -
-
-
This Tweet is unavailable.
-
The strict vs lazy zero?
- Show replies
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.