Monad Plus

monad.types.monadplus - The MonadPlus Class.

class monad.types.monadplus.MonadPlus(value)[source]

Bases: monad.types.monad.Monad

The MonadPlus Class.

Monads that also support choice and failure.

plus(monad)[source]

The Associative operation.

zero = NotImplemented

The identity of plus.

This property should be a singleton, the following must be True:

MP.zero is MP.zero

It should satisfy the following law, left zero (notice the bind operator is haskell’s >>= here):

zero >>= f = zero