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.

kmeredith (23) [Avatar] Offline
The Listing 5.5 code sample includes:

import AccountRepository._
val account = checkingAccount("a-123", "John K.", today.some,
            None, Balance(0)).toOption.get #A
val dsl = for {
  b <- updateBalance(account, 10000) #B
  c <- store(b)
  d <- balance(
} yield d

Would it be worthwhile to include that `Option#get` is a method that should never be used (since it's Partial), but OK to use in a test?
Debasish Ghosh (116) [Avatar] Offline
I agree that Option#get should not be used. But here it's only in a sample test and I am sure that the data set up ensures that the get actually gets a result. But I would not use it in any serious code.