Open wibisono opened 6 years ago
In page 797, BehavesLikeHuman.speak(rover) won't compile since we only have instances definition, but have not yet defined interface object, the following is missing:
BehavesLikeHuman.speak(rover)
object BehavesLikeHuman { def speak[A](creature : A)(implicit humanLike : BehavesLikeHuman[A]) = humanLike.speak(creature) }
Personally, I prefer to just call this interface Speaking instead of behaves like human. Example gist I find easier to read https://gist.github.com/wibisono/28d8808159e0c7103042d7c5c668edf7
Speaking
In page 797,
BehavesLikeHuman.speak(rover)
won't compile since we only have instances definition, but have not yet defined interface object, the following is missing:Personally, I prefer to just call this interface
Speaking
instead of behaves like human. Example gist I find easier to read https://gist.github.com/wibisono/28d8808159e0c7103042d7c5c668edf7