Shadowing in Scala's for-comprehensions is a nice feature. It has the feel of mutability, but safer, and shadowing's almost always what you want. for { x <- Try(doSomething) x <- mightFail(x) x <- returnTry(x) } yield x Unfortunately it only works with flatMaps, not maps.
-
Show this thread
-
Replying to @leifbattermann
Often, yes. Though I sometimes want to have other flatMaps between the ones which are operating on the "same" object.
7:54 AM - 28 Mar 2018
from East Worldham, England
0 replies
0 retweets
1 like
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.