Live data from Hacker News

Monads explained by Eric Lippert

ericlippert.com

1–10 of 58 posts

Re: Monads explained by Eric Lippert

#2
Note that this is a series of posts. The first post that is being linked to doesn't have much IMO.

http://ericlippert.com/2013/02/21/monads-part-one/

http://ericlippert.com/2013/02/25/monads-part-two/

http://ericlippert.com/2013/02/28/monads-part-three/

I wasn't clear for me but in the last post he mentioned that there would be more posts to come.

Re: Monads explained by Eric Lippert

#3
Do you know what I miss about these explanations?

Technical people can't go straight to the point. They go around, around, around, going into corners, etc

(not only on explanations, mind you)

For example, math has some very high-level/generic explanations, and curiously, I find them more understandable.

So, I've given up on understanding Monads (or at least Haskell ones), I'll probably understand them when I come up with a similar problem and think about how to solve them.

Re: Monads explained by Eric Lippert

#4

Do you know what I miss about these explanations? Technical people can't go straight to the point. They go around, around, around, going into corners, etc (not only on explanations, mind you) For example, math has some very high-level/generic explanations, and curiously, I find them more understandable. So, I've given up on understanding Monads (or at least Haskell ones), I'll probably understand them when I come up…

"For example, math has some very high-level/generic explanations, and curiously, I find them more understandable."

That's because math always "goes straight to the point". There's nothing but the raw substance in it.

Re: Monads explained by Eric Lippert

#5
post #4

Do you know what I miss about these explanations? Technical people can't go straight to the point. They go around, around, around, going into corners, etc (not only on explanations, mind you) For example, math has some very high-level/generic explanations, and curiously, I find them more understandable. So, I've given up on understanding Monads (or at least Haskell ones), I'll probably understand them when I come up…

"For example, math has some very high-level/generic explanations, and curiously, I find them more understandable." That's because math always "goes straight to the point". There's nothing but the raw substance in it.

When I read math, I really like some motivating examples before digging into the definitions and theorems. For me, concrete examples makes it way easier to grasp abstract concepts.

Re: Monads explained by Eric Lippert

#7
Monads are complicated because the word "monad" bears too much weight in any discussion about them.

1) There is a category theoretical concept of a monad. This is largely irrelevant in a practical explanation of monads since Monads are usually talked about in terms of another category theoretical concept called the Kleisli Category or Kleisli Triple. However, if someone starts talking about "monad laws", they're probably referring to the theoretical sense of this.

2) There is, in Haskell at any rate, a typeclass called the Monad (note the capital "M"). This is mostly important because when a type is an instance of this category, the Haskell do-notation is useful. Aside from that, you can only use the handful of operations that the Monad typeclass implements that you don't have to implement yourself for it to be an instance of Monad.

3) There are Monad type constructors, such as Maybe, IO, and State. This is where things actually start getting interesting for the practitioner, because each provides a specific abstraction of a concept, such as input/output or partial functions (IO and Maybe, respectively).

4) There are Monad types, both abstract and concrete, like Maybe a, IO a, Maybe Int, State MyType and so on. These are the types you actually will program with.

5) There are Monad values, which are instances of the Monad types, which are, themselves, instances of the Monad type constructors, which are instances of the Monad typeclass.

6) Then just to add a slightly extra confusing layer on top of it all, you have the values inside the Monad you'll actually be doing computations with.

7) And finally, it doesn't help when in code examples, type variables and function variables are conflated by name, such as in:

    get :: State s s
    get s = (s,s)
Unfortunately, that's much more clear for an expert than a beginner in regards to what's going on there, so if you're reading code samples, likely written by people with expertise, they're going to be confusing.

So, yeah. Simple concept of explicit effects. Seriously semantically overloaded stack of terms to actual reason with them about.

Re: Monads explained by Eric Lippert

#9

Do you know what I miss about these explanations? Technical people can't go straight to the point. They go around, around, around, going into corners, etc (not only on explanations, mind you) For example, math has some very high-level/generic explanations, and curiously, I find them more understandable. So, I've given up on understanding Monads (or at least Haskell ones), I'll probably understand them when I come up…

In this case, going around and around really helped me grasp the concept. Every other monad tutorial out there always go straight to the point and that is what made it difficult for me to understand them. I really like this series so far and I think this is the perfect way to explain something that complex. "You need to know where you came from to understand where you're going".
Post reply on HN