|
![](/i/fill.gif) |
On 01/04/2013 04:12 PM, Warp wrote:
> Orchid Win7 v1<voi### [at] dev null> wrote:
>> Really, a monad is
>> simply a specific way of chaining operations together; nothing more
>> complicated than that.
>
> And this is somehow different from just a regular function somehow?
Well, yeah, that's the crux of the matter.
In a pure language like Haskell, a *function* takes several inputs and
produces an output, and that's all it's allowed to do. If you want to do
something more complicated, you represent it as a monad.
Now, if you're working in an OO language, then you automatically have
access to facilities like I/O, global variables, exception handling and
so on. So you don't need a monad to represent these things.
But now suppose that you want some facility that the OO framework
doesn't natively support. Whether it's non-deterministic computation or
backtracking or partial failure or atomic transactions or whatever... A
monad is one possible way of dealing with these things.
Post a reply to this message
|
![](/i/fill.gif) |