POV-Ray : Newsgroups : povray.off-topic : I'm in the mood for monads : Re: I'm in the mood for monads Server Time
29 Jul 2024 04:20:57 EDT (-0400)
  Re: I'm in the mood for monads  
From: Orchid Win7 v1
Date: 21 Apr 2012 16:01:55
Message: <4f931233@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.