News for hackers. Stuff that matters.
Re:The Day Python Embarassed Imperative Programming by tripzilch on Monday February 27, 2012 @08:21AM (#3638843)
I read the article and I still don't understand what monads are about. This happens every time. There must be something about the Haskell syntax (which has been ages since I used it in college--and I utterly failed to grasp monads then, too) it's very frustrating, I get the rest of functional programming. Apparently I forgot how to read Haskell.
Re:The Day Python Embarassed Imperative Programming by ludflu on Monday February 27, 2012 @09:33AM (#3639067)
Its not the syntax, its the concept that's hard. I read about 10 different monad tutorials, and it only made things worse. The only thing that made it click was writing code that used them. (Some monadic parser code.)

Seriously, reading monad explanations is like struggling in quicksand of abstraction. Only by making it concrete in working code did I make any progress.

If I had to pick the most tractable monad, I would try the Maybe monad, use it for map lookups in Haskell's Data.Map, since its something you would commonly do with a Python dictionary anyway.

Re:The Day Python Embarassed Imperative Programming by recursive on Monday February 27, 2012 @12:27PM (#3639708)
My issue with that approach is that it's hard to know whether you're actually using monads if you don't really understand what they are.
Re:The Day Python Embarassed Imperative Programming by orblivion on Monday February 27, 2012 @08:39AM (#3638905)
I'm just getting it now. Google for something called Typeclassopedia and read about Functors, and then Applicative functors. Those are much easier to understand right away, and they set the stage for monads. Applicative functors relate to functors in an obvious way (you could probably implement one in terms of the other). Monads relate to applicative functors in a less obvious way, to me anyway, but at least it's analogous enough that it helped a whole lot (particularly that return and pure were the same thing)

I read about the first two on the typeclassopedia page, and was somewhat unsatisfied with its explanation of monads. I then went to Learn You a Haskell's page on all three of these and skipped to monads, and I was happy with it. I bet you could just read about all three on the Learn You page, the guy does a great job.

Re:The Day Python Embarassed Imperative Programming by NathanRice on Monday February 27, 2012 @09:22AM (#3639037)
"Learn you a Haskell for great good" is probably the most approachable book on the subject you can read it online for free.

People who are confused should definitely check it out.

Re:The Day Python Embarassed Imperative Programming by jerf on Monday February 27, 2012 @09:45AM (#3639104)
Yes, it is by far the best way to learn what monadic really means. http://learnyouahaskell.com/chapters is the book, but if you already understand basic Haskell syntax, you can start at Chapter 11, Functors: http://learnyouahaskell.com/functors-applicative-functors-an...

Yes, it's a bit long, but it actually works, and, what's more, unlike the vast majority of monad tutorials written by someone who just sort of half figured out the concept half-an-hour ago (but they really didn't), it is also correct. This is one of the major root causes behind people's general inabilities to "understand monads after reading tons of tutorials", the tutorials are not only generally not very good but often wrong and mutually contradictory.

Re:The Day Python Embarassed Imperative Programming by orblivion on Monday February 27, 2012 @12:58PM (#3639847)
Oh sorry, yes I forgot that they were in two different sections. Definitely read the one about Functors before you get into Monads.
Re:The Day Python Embarassed Imperative Programming by nandemo on Monday February 27, 2012 @10:20AM (#3639234)
IMO the best intro to monads is You Could Have Invented Monads:

http://blog.sigfpe.com/2006/08/you-could-have-invented-monad...

It starts from concrete examples, lets you write a few exercises, then it shows you the common pattern behind those examples.

Re:The Day Python Embarassed Imperative Programming by StavrosK on Monday February 27, 2012 @09:08AM (#3638979)
Same here. I must have read every article explaining Monads that I saw, but I still have no idea what they are.