POV-Ray : Newsgroups : povray.off-topic : Monads in C# : Re: Monads in C# Server Time
29 Jul 2024 16:21:32 EDT (-0400)
  Re: Monads in C#  
From: Orchid XP v8
Date: 2 Jul 2011 06:40:01
Message: <4e0ef581@news.povray.org>
On 02/07/2011 08:19 AM, Warp wrote:

>    Even after reading those, I still don't understand what a "monad" is,
> and how it's different from plain inheritance. The articles talk about
> composition as if it was some kind of magic trick. I don't get it.

And if you sat and read a text on abstract algebra, you would probably 
come away thinking that a "field" is some very special, really complex 
entity that's almost incomprehensible. And yet actually, you use fields 
all the time.

The formal specification of what makes a field is very technical and 
abstract. Fields and the theory behind them are of fundamental 
importance in a wide range of mathematical disciplines. To say that 
"fields are important" is a major understatement.

And yet, lots of people *use* fields all the time. Actually using a 
particular field usually isn't complicated at all. (It's the theory 
concerning /all possible fields/ which is complicated.)

>    It's a bit like the magical term "currying". There seems to be something
> very special about it, but I just fail to understand what it is.

Currying is a simple short-cut, which also allows you to handle 
functions of varying numbers of arguments polymorphically. Anyone who 
claims it's something more magical than that is just over-excited.

>    In neither case do I fully understand what exactly is the problem they
> are solving, how they are used or why they are useful. In fact, they are
> both the strange feature that they seem to be both trivial and extremely
> hard to comprehend, at the same time.

Like one guy said, LINQ is a monad. LINQ solves a real-world problem. 
Point is, you don't have to actually *care* that it's a monad in order 
for it to be useful - any more than you need to care that Int forms a 
subset of a ring with unity, or that Double spectacularly fails to be a 
field.

In Haskell it's slightly different, since you can actually define the 
concept "this is a monad", and then write functions which work for /any 
possible monad/. As far as I can tell, C# can't do that, so knowing that 
something is a monad isn't quite so useful. (It doesn't enable you to 
apply a whole army of existing functions to something just because it's 
a monad.)

>    And then some people wonder why functional programming isn't more popular.
> How can it be, when it's full of trivial-sounding concepts which are, somehow,
> almost impossible to understand at the same time?

This is approximately like saying "The Turning machine makes no sense to 
me. I have no idea what its purpose is. It seems trivial-sounding and 
yet somehow impossible to understand. No wonder computers aren't more 
popular!"

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

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