|
![](/i/fill.gif) |
On 21/04/2012 03:18 PM, clipka wrote:
> All I understand is bollocks, but something tells me the concept
> is probably so trivial that a handful of well-chosen words could explain
> it all
When I write Haskell code "in a monad", the compiler is automatically
inserting a bunch of invisible function calls to the "bind function" of
the monad in question.
The bind function gets given two arguments: The result from the previous
statement, and a function representing /all/ of the following
statements. So it gets to decide if and how the rest of the code block
executes.
In short, between every pair of statements, a bunch of user-defined code
is invisibly being executed, allowing it to do totally hoopy things to
how your code runs.
And that's basically /it/.
(Now wasn't that such an anti-climax? Everybody makes such a Big Deal
out of monads, that sometimes when a person finally understands what
they are, it doesn't seem all that impressive, so they go away thinking
they missed something...)
Post a reply to this message
|
![](/i/fill.gif) |