Susan Harkins (223) [Avatar] Offline
#1
Please post errors in the published version of Functional and Reactive Domain Modeling here. We'll publish a comprehensive list for everyone's convenience. Thank you!

Susan Harkins
Errata Editor
Norbert Scheller (2) [Avatar] Offline
#2
In chapter 3 and 4 you mention that scala.util.Try is a monad.
In fact Try is not a monad. It fails the left identity law.
But, the left identity law is not relevant in for-comprehensions.
So one can use Try safely in for-comprehensions.

Maybe one has to point out that Try is not a monad, but has a monadic API.
Debasish Ghosh (111) [Avatar] Offline
#3
I mention as a footnote in Page 78 (Chapter 3) that Try violates a law of being a monad. I also provide a link to the SIP which discusses the details.

Thanks.
Norbert Scheller (2) [Avatar] Offline
#4
Sorry, my fault!! I missed that!!
I love your book!!
Thanks
Martijn Blankestijn (1) [Avatar] Offline
#5
p. 123 the Applicative for List

I think the List should occur in first position as defined by the Applicative Trait.
override def ap[A, B](as: List[A])(fs: List[A => B]) =
for {
a <- as
f <- fs
} yield f(a)

Or did I miss anything?
Debasish Ghosh (111) [Avatar] Offline
#6
Good catch .. you are absolutely correct! The arguments need to be flipped ..

Thanks.
Susan Harkins (223) [Avatar] Offline
#7
339603 (2) [Avatar] Offline
#8
Section 1.5, pg 30, verification of correctness code snippet, top of page:

Remove "=>" at the beginning of 4 lines, then this code will execute. Otherwise it's misleading.

appears:

val a = Account("a1', "John")

credit(a, 100).flatMap ...
=> Success(a.copy(balance ...
=> debit(Account("a1", ...
=> Success(a.copy(balance ...
=> Success(Account("a1", ...
339603 (2) [Avatar] Offline
#9
pg 29, Listing 1.10 end, top of page

object AccountService extends AccountService

The above object declaration should be outside of the closing brace for trait AccountService.
In other words, the object declaration should be below the closing brace that appears on the next line, rather than above it.