Suppose I define an instance of the Monad
typeclass for Future
:
val futureMonad = new Monad[Future] {
override def point[A](a: ⇒ A):
Monads such as Try
and Future
trade one monad law for another law which is more useful in the context they are supposed to be used:
An expression composed from (Try
or Future
), flatMap, map will never throw a non-fatal exception. Call this the "bullet-proof" principle.
So actually this approach really protects you against many failures and left-unit law is failed deliberately.