The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

343289 (1) [Avatar] Offline
#1
Hi!

Looks like the three function bodies in listing 2.14 (Managing latency as effects in Scala) still have to be wrapped into a Future.

E.g.:
def calculateInterest[A <: SavingsAccount](account: A,
  balance: BigDecimal):Future[BigDecimal] = {
  if (acc.rate == 0) throw new Exception("Interest Rate not found")
  else BigDecimal(10000)
}


should be

def calculateInterest[A <: SavingsAccount](account: A,
  balance: BigDecimal):Future[BigDecimal] = Future {
  if (acc.rate == 0) throw new Exception("Interest Rate not found")
  else BigDecimal(10000)
}


Like your book a lot! Can't wait for the next chapters!
Debasish Ghosh (116) [Avatar] Offline
#2
You are absolutely correct! Noted and recorded as an issue that I will fix in the upcoming MEAP. Thanks for the kind words.