Full closures for D

Nathan Reed nathaniel.reed at gmail.com
Mon Nov 5 18:27:31 PST 2007


Bruce Adams wrote:
> Since they're on the language comparison feature chat it implies (to me at least) that there is some perceived benefit to the concept.
> Any poor strictly functional guys care to explain what it is?
> 

Here's a good introduction to monads in the context of Haskell:

http://research.microsoft.com/%7Esimonpj/Papers/marktoberdorf/mark.pdf

Basically, a monad is a type whose values represent actions.  An action 
is something that, when done, has an effect on some global state and 
then possibly returns a value.  There are operators that allow actions 
to be composed in various ways.  So, in a pure functional programming 
language, you never actually *do* anything imperatively - you just 
construct a huge action, which contains everything your program should 
do, by gluing together lots of itty-bitty actions (and pure functions). 
  The construction of this action is done purely-fuctionally.  Then the 
runtime executes the action, but this occurs outside of the language 
proper, so it doesn't hurt your beautiful clean pure-functionality.

Thanks,
Nathan Reed



More information about the Digitalmars-d mailing list