POV-Ray : Newsgroups : povray.off-topic : Monads in C# : Re: Monads in C# Server Time
29 Jul 2024 16:29:33 EDT (-0400)
  Re: Monads in C#  
From: Invisible
Date: 1 Jul 2011 04:48:36
Message: <4e0d89e4@news.povray.org>
On 30/06/2011 09:25 PM, Darren New wrote:
> It's really little to do with functional programming after all.

Lots of people seem to have this idea that monads are something that 
only exist in functional programming. (And, further, that it only exists 
as some sort of "hack" to get around the fact that functional programs 
aren't supposed to have side-effects, yet the entire point of running a 
computer program is to produce side-effects.)

That's a bit like saying that monoids are only important in FP. Or that 
only FP cares about rings or fields. This is of course nonsense.

(For those that don't know, a "monoid" is simply anything that's 
combinable. So numbers are monoids. Anything supporting arithmetic is a 
monoid. Anything supporting concatenate or append is a monoid. Anything 
that transforms data (to the same result type) is a monad. And so on and 
so forth. Similarly, a "field" is, loosely, anything that supports 
number-like arithmetic.)

> What is a monad, in terms an OOPL programmer would understand:

> Also, how monads are already part of C# and you didn't know it:

A monad is just a particular way of chaining commands together. I 
imagine it's quite common around the place.

What's perhaps telling is that Haskell calls something "Maybe" when C# 
apparently calls it "Nullable", and Haskell calls it "Functor" when C# 
calls it "IEnumerate"...

(Not to mention "Monoid" verses "Composable"...)


Post a reply to this message

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