Re:Monads are a Class of Hard Drugs (2008)
by brazzy on Saturday December 29, 2012 @04:52AM
(#4981638)
So basically monads are like a Java object that has a private field and a getter method that has some extra logic. Hey, that's really simple, you're right!
duck & runl
Re:Monads are a Class of Hard Drugs (2008)
by chongli on Saturday December 29, 2012 @07:19AM
(#4981891)
No, objects in Java are more complicated than monads. They include the concepts of identity, mutable state and inheritance; all of which monads lack.
Almost, it's more like an "applyer" method with some extra logic. You're never allowed to get "raw" values out, you can only pass functions inward to modify the value.
If you want to get the raw values out (and you almost always do) then you have to add some extra logic to the object above its "monadic" nature.
And yeah, it is really, really simple!
Re:Monads are a Class of Hard Drugs (2008)
by csense on Saturday December 29, 2012 @03:55PM
(#4983426)
I'm trying to parse this explanation. What's the difference between a monad and overriding __getattr__ in Python?
Re:Monads are a Class of Hard Drugs (2008)
by chongli on Sunday December 30, 2012 @04:31AM
(#4985241)
Apples and oranges. A monad is just an idea; that of storing computations as values. This is useful because these computations can be composed together in a manner not unlike that of a pipeline in shell scripting. Different monads define different ways of composing these computations leading to vastly different semantics.
Here's a nice video that explains monads fairly simply:
It's so frustrating to hear you say that. Monads are such a simple concept but they're difficult to explain because they're far more general and abstract than most programming topics. The best explanation I have is that monads are a way of storing some kind of computation with a value. When the user wants access to that value, he uses a monadic operator which forces the monad's computation to be run before returning the value.