Scala - conversion from for-comprehension to map, flatMap less than 1 minute read 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 def getProduct(id: String): Try[Product] def getPrice(product: Product): Try[Price] def calculateProductPrice(product: Product, price: Price): Try[Price] for { product <- getProduct("1234") price <- getPrice(product) calculatedPrice <- calculateProductPrice(product, price) if (calculatedPrice > 1000) } yield (product, calculatedPrice) getProduct("1234").flatMap{ product => getPrice(product).flatMap{ price => calculateProductPrice(product, price).filter { p => p > 1000 } .map{ p => (product, p) } } } Share on Twitter Facebook LinkedIn Previous Next
C++ - Structured Concurrency with Facebook’s Folly Library 8 minute read This post demonstrates how Facebook’s Folly library supports structured concurrency through its coroutine-based AsyncScope primitive. The example implements ...
C++ - Back to Basics: C++ Concepts 9 minute read Jeff Garland - Back to Basics: C++ Concepts - CppCon 2025
C++ - Working with Asynchrony Generally (Sender/Receiver) 6 minute read Eric Niebler - Working with Asynchrony Generally - CppEurope 2022
C++ - Type erasure 2 minute read Duck Typing, the C++ Way: How Type Erasure Bends the Rules - Sarthak Sehgal - CppCon 2025