Suppose I define an instance of the Monad
typeclass for Future
:
val futureMonad = new Monad[Future] {
override def point[A](a: ⇒ A):
It just means, in terms of for comprehensions, that the following refactoring is not semantics-preserving:
for (fut <- Future(a); x <- f(fut)) yield x ==> f(a)
But that's just another way of writing the left identity law, really.
To explain that invalid refactoring further:
for (fut <- Future(a); x <- f(fut)) yield x
==> for (x <- f(a)) yield x // by left identity law: WRONG, because left identity law does not hold
==> f(a) // by 1st functor law: WRONG, because previous line was wrong