"Anyone trying to understand monads will inevitably run into Haskell’s IO monad, and the results are almost always the same: bewilderment, confusion, anger, and ultimately Perl."
I'm unfamiliar with Scala, Ruby and Haskell; my reading of this is that a monad is basically a type conversion work-around for programming in a whips'n'bondage language that officially forbids type conversion. Am I on the right track here?
I'm still trying to figure out monads myself. The closest I've come to grokking them is that "monad" an abstract control flow description in the way that "class" is an abstract data type description. You concretize monads into specific control flow patterns, and then instantiate them into actual control flow operations, in the same way that you concretize the abstract notion of a class into an actual class, and then instantiate it into an object.
I suspect this in one of those ideas that I'll have to play with until it becomes boring, at which point the "Aha, I seem to have gotten it sometime in the past and am only now associating the term with it" will hit me. I never have "Eureka!" moments, just "There's a word for that?" ones.
It's not that monads themselves are complex, but that the implementation relies on many other advanced Haskell features like parameterized types, type classes, and so on. The problem is that Haskell IO is based on monads, and IO is probably one of the first things you want to understand when learning a new language - after all, its not much fun to create programs which doesn't produce any output. I have no immediate solution for this chicken-and-egg problem, except treating IO like "magic happens here" until you have enough experience with other parts of language. Sorry.
- Jim Ferrens on why Haskell is so damned hard to learn (http://stackoverflow.com/questions/44965/what-is-a-monad/194207#194207).
(I am having a flashback to how long it took me to truly grok pointers and indirection. Ouch. I think I shall leave Haskell alone. After all, I don't program for a living any more and I've got a to-do list the length of my arm ...)
no subject
Date: 2010-12-27 05:55 pm (UTC)I'm unfamiliar with Scala, Ruby and Haskell; my reading of this is that a monad is basically a type conversion work-around for programming in a whips'n'bondage language that officially forbids type conversion. Am I on the right track here?
no subject
Date: 2010-12-27 06:20 pm (UTC)I suspect this in one of those ideas that I'll have to play with until it becomes boring, at which point the "Aha, I seem to have gotten it sometime in the past and am only now associating the term with it" will hit me. I never have "Eureka!" moments, just "There's a word for that?" ones.
no subject
Date: 2010-12-27 06:39 pm (UTC)no subject
Date: 2010-12-27 06:42 pm (UTC)no subject
Date: 2010-12-27 07:16 pm (UTC)no subject
Date: 2010-12-27 10:12 pm (UTC)no subject
Date: 2010-12-28 10:44 am (UTC)(I am having a flashback to how long it took me to truly grok pointers and indirection. Ouch. I think I shall leave Haskell alone. After all, I don't program for a living any more and I've got a to-do list the length of my arm ...)