pjan (4) [Avatar] Offline
#1
Hi Debasish,

First of all: great work. Only bought the MEAP version yesterday, and will likely have finished chapter 3 by later tonight. Can't wait for the other chapters.

On the property check code example in 3.1.2: Is there a particular reason why you mix "b <- balance(a)" and "d.balance"? I believe it would be clearer if you would opt for the one or the other and use it consistently.

either have:
val Success((before, after)) = for {
  b <- balance(a)
  c <- credit(a, m)
  d <- debit(c, m)
  e <- balance(d)
} yield (b, e)


or:
val Success((before, after)) = for {
  c <- credit(a, m)
  d <- debit(c, m)
} yield (a.balance, d.balance)


Or am I missing something?

Edit: Since no concrete implementation of Balance has yet been given, I believe the first option is actually the only correct one in this case...
Debasish Ghosh (113) [Avatar] Offline
#2
You are absolutely correct. It's an inconsistency which I should have looked at earlier. Yes, the first one looks more meaningful without a concrete definition of balance. I will get it corrected. Thanks for pointing out.