I understood the monad concept for a few months in university. After the exam was over, I soon stopped understanding it. The same thing happened with the concept of VC dimension. It's kind of interesting, because we usually don't think of "understanding" as something that comes with a time limit.
It happens all the time. For a brief period I understood musical notation and rhythm and then it was gone. Similarly I had a time in my life where I knew by feeling whether a French noun was le or la.
Monad Tutorials Timeline
31–40 of 63 posts
Re: Monad Tutorials Timeline
#32Re: Monad Tutorials Timeline
#33To explain like two fundamental rules (we can make wrapper types, and do flatmap) I will: - Write 5 paragraphs setting up an imaginary scenario involving fantasy elements of aliens, dragons, and a magical kindom where they speak using message boxes - Introduce basic category theory by starting with what a functor is - Explain all the effects of a monad in such general terms that it basically amounts to anything and e…
I've read more than my fair share of these tutorials, and I'd like to be proven wrong here but I don't think I've ever seen one that explains what the point of these functional constructs (similarly with Applicative etc.) is. "You can do IO now." So what? I could do IO before that as well. Very rarely are practical explanations discussed. Even if they are discussed, the treatment is shallow and useless.
Haskell is based on Miranda, and Miranda is based on Hope. Purely functional languages were really purely functional, academic experiments with no way to express side effects, so no way to express practical programs.
Philip Wadler took the monad (the name that already existed in category theory), and showed how computations could be expressed in Haskell with the “do notation” as an example. That made Haskell practical without breaking the “beauty” of the language, by having to introduce new special syntax or something outside the type checker capacity.
So, I don’t think there’s a motivation besides being an exercise in expressivity within the limitations of pure functional programming. Similar ideas in describing computation as lazy executed instructions already existed elsewhere, like the interpreter pattern.
Re: Monad Tutorials Timeline
#340: https://blog.sigfpe.com/2006/08/you-could-have-invented-mona...
Re: Monad Tutorials Timeline
#35I have always thought that monads are just side effects and that's it.
Re: Monad Tutorials Timeline
#36To explain like two fundamental rules (we can make wrapper types, and do flatmap) I will: - Write 5 paragraphs setting up an imaginary scenario involving fantasy elements of aliens, dragons, and a magical kindom where they speak using message boxes - Introduce basic category theory by starting with what a functor is - Explain all the effects of a monad in such general terms that it basically amounts to anything and e…
I've read more than my fair share of these tutorials, and I'd like to be proven wrong here but I don't think I've ever seen one that explains what the point of these functional constructs (similarly with Applicative etc.) is. "You can do IO now." So what? I could do IO before that as well. Very rarely are practical explanations discussed. Even if they are discussed, the treatment is shallow and useless.
* Explicitly define the order of evaluation (important in Haskell, where lazy evaluation makes the default order of evaluation difficult to trace)
* Useful mental model that helps with 1) design and 2) understanding new concepts
* Abstraction. Ignore irrelevant details. Write the standard library once, use it in many different situations.
Re: Monad Tutorials Timeline
#37Earlier quoted context omitted.
I've read more than my fair share of these tutorials, and I'd like to be proven wrong here but I don't think I've ever seen one that explains what the point of these functional constructs (similarly with Applicative etc.) is. "You can do IO now." So what? I could do IO before that as well. Very rarely are practical explanations discussed. Even if they are discussed, the treatment is shallow and useless.
You may appreciate my own contribution, https://www.jerf.org/iri/post/2958/ , which includes an entire section titled "If They're So Wonderful Why Aren't They In My Favorite Language?", a section explaining why IO is not a good lens to understand monads and why "monads" don't really have anything to do with "making IO possible" ( very common misconception), as well as what I believe to be one of the more practical ap…
Re: Monad Tutorials Timeline
#38Earlier quoted context omitted.
I've read more than my fair share of these tutorials, and I'd like to be proven wrong here but I don't think I've ever seen one that explains what the point of these functional constructs (similarly with Applicative etc.) is. "You can do IO now." So what? I could do IO before that as well. Very rarely are practical explanations discussed. Even if they are discussed, the treatment is shallow and useless.
Nobody will explain you like this, but the main point was being able to satisfy the compiler without introducing an escape hatch into the language. Haskell is based on Miranda, and Miranda is based on Hope. Purely functional languages were really purely functional, academic experiments with no way to express side effects, so no way to express practical programs. Philip Wadler took the monad (the name that already exi…
Re: Monad Tutorials Timeline
#39A monad is anything you can flatmap with
The monad of list is you flatmap a list on a list and instead of getting a list of lists, as you would if you just mapped, you get a single flattened list
The monad of Result is you flatmap many function calls (like http requests or whatever) on each other and instead of getting many results, you get a single flattened result
Most of you already know this, without necessarily even knowing what a Monad is
Monad literally just means "one thing" - you take many things, and flatmap them into one
Thanks for attending my ted talk