Monads O_o Not a tutorial.

Inspired by people, who don't get monads..

I have been stuck with the question of why people don't understand monads. Actually, I saw different kinds of people having different relationships with monads. So I've done a small analysis on why software engineers want to learn monads and from where did they find out about monads.

A lot of people heard this fashionable word "monads" somewhere from somebody smart and their inner geek set up a goal to understand monads to be awesome and cool and to do SWAG things. They are searching for something, and initially they don't have an idea why is it helpful. So the source of their interest is not the necessity to perform the task more efficiently, but the desire to explore something to feel all the advantages and then determine where it might be useful. And when I ask "hey, you are learning monads? Why are you doing this?" I rarely get an answer. It abstractly means, before knowing what monads are they assume that monad is a magic wand producing better results (which is actually true).

I don't mean it's bad if you are one of them - you just get into a tricky situation of understanding some more or less complex for understanding topic. So usually, the process of grasping monads looks like this:

  1. Google -> Monads
  2. Reading Wikipedia page, read first three links from search results
  3. Feeling scary from dozens of mathematical formulas
  4. Realizing that the search query was wrong
  5. Google -> What are monads
  6. Looking through the results
  7. Finding the definition of monadology by Gottfried Leibniz, getting inspired
  8. Continue randomly reading posts and articles like "Monads for dummies", "Three steps to understand monads", "Monads in 30 seconds" and so on
  9. Evaluating whether monads will bring the profit bigger than the effort spent on understanding it
  10. Google -> Why do I need monads
  11. Looking through first 3 pages
  12. Getting convinced that the real benefits of monads will be clear only after understanding monads
  13. ... DESPAIR.JS

Here is how the process went for the majority of us. The first and mandatory step in understanding monads is literally FAILING TO UNDERSTAND THESE FKN MONADS.

And I won't be writing another monad tutorial to explain monads to you. There are tons of tutorials and at the same time no one single resource, which may suit for everyone.

If you are so strong in your desire to understand them, my only advice will be to look at problems they solve. Look for examples. Maybe monad, division by zero monad, exception handling monad, I/O monad, state monad, async monad... as much as you can. Then you'll understand that monads are there, where you have side effects, and where you want to be concentrated on your code logic and not on handling the way of processing the side effects all the time. So with monads you are focused on your main code and additional actions are performed behind the scenes. And actually, you can even use monads without an understanding how they are built inside, and ... maybe you are using them now not even realizing it :) But these words mean nothing to you until you read your portion if monadic porn.

  • Find the initial reason and give a private answer to the question just to yourself: "why I am exploring monads?". The answer like "to be cool and to know something not all programmers know" is pretty OK too :)
  • Read some posts on monads. Fail to understand them.
  • Find examples. A lof of examples. They'll form the feeling what problems are solved easier. Try to repeat.
  • Read those posts from the second point and understand them.
  • Determine how can you apply them for your tasks.

Really useful links:
(to be read several times in several iterations)

http://stackoverflow.com/questions/44965/what-is-a-monad http://stackoverflow.com/questions/28139259/why-do-we-need-monads http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html http://fsharpforfunandprofit.com/series/computation-expressions.html


31.03.2015
|
monads functional programming learning buzzwords
Yandex.Metrica