Monad is Applicative and Bind. With that we deal with:
Note that in Applicative, map method is implemented using ap method and in Bind, ap is implemented using bind method. With that, two methods that are left to be implemented for a Monad are point and bind.
Having those we can derive other methods for monad.
- liftM. List a monad into a different monad.
- whileM. Executes action while predicate is true and collects the results into MonadPlus.
- whileM_. Executes action while predicate is true.
- unitlM. Until version of WhileM.
- unitlM_. Until version of WhileM_.
- iterateWhile. Similar to whileM_ except predicate is A => Boolean instead of F[Boolean].
- iterateUntil. Similar to unitlM_ except predicate is A => Boolean instead of F[Boolean].