Chain effects with Haskell Functor, Applicative and Monad
8 steps · about 3 h 8 min · Intermediate
- Map over values in a context with fmap and <*> (tutorial, Learn You a Haskell, 40 min)
Builds intuition for Functor and Applicative with Maybe, lists and IO.
- Chain failing steps with >>= on Maybe (tutorial, Learn You a Haskell, 35 min)
The tightrope-walker example shows why bind removes nested checks.
- Combine independent effects with Applicative style (tutorial, Wikibooks, 25 min)
Shows when <*> is enough and you do not need a monad.
- Understand the Monad class and its laws (tutorial, Wikibooks, 25 min)
Defines return and >>= and why the laws matter.
- Rewrite bind chains with do notation (tutorial, Wikibooks, 15 min)
Translates do blocks to >>= so you know what you are writing.
- See how the classes relate in the Typeclassopedia (article, HaskellWiki, 30 min)
Maps Functor, Applicative, Monad and their laws in one place.
- Look up <$>, <$ and void (reference, Hackage (base), 8 min)
The Functor helpers you will use every day.
- Use mapM, when, forM and foldM (reference, Hackage (base), 10 min)
Ready-made combinators for looping and branching inside a monad.