November 2017
Intermediate to advanced
670 pages
17h 35m
English
The following table consists of some of the more frequently used Monads (for composition, looping, and mapping):
|
Function |
Description |
|
forM |
forM acts like an iterator that maps an action over a list and returns the transformed list. forM serves the same purpose as mapM and exists for readability. The rule of thumb is that if there are multiple lines of code in the for loop, then use forM. For example: results <- forM items $ \item -> do -- A big do-block using `item`.forM :: (Monad m, Traversable t) => t a -> (a -> m b) -> m (t b) |
|
forever |
forever is a combinator used to repeat an action forever, as follows: forever :: Applicative f => f a -> f b |
|
mapM |
The map operation performs mutations when ... |