|
![](/i/fill.gif) |
On 01/07/2011 06:55 PM, Darren New wrote:
> On 7/1/2011 1:48, Invisible wrote:
>> A monad is just a particular way of chaining commands together. I imagine
>> it's quite common around the place.
>
> Yes. But this blog post tells you *what* particular way, as well as why
> you'd care, in a way one can understand without functional programming.
Sure. I get that.
>> What's perhaps telling is that Haskell calls something "Maybe" when C#
>> apparently calls it "Nullable",
>
> In C#, you have some types that are value types (like integers) and some
> types that are reference types (like strings, user classes, etc.).
> "Nullable" is a generic that lets you take a value type and also let it
> be null.
>
> The real use of nullable in C# isn't for "Maybe" cases, but for SQL. If
Fair enough. But the net effect appears to be similar.
>> and Haskell calls it "Functor" when C# calls it "IEnumerate"...
>
> IEnumerable says "I can give you back an object that you can use to
> iterate over this collection of values one at a time." It's not the
> collection, it's not the enumeration itself. It's the thing that holds
> the state telling you how far you have gotten, basically.
And a Functor isn't necessarily a container. It's just anything you can
enumerate over, loosely speaking.
>> (Not to mention "Monoid" verses "Composable"...)
>
> I don't know what "Composable" is. I don't think C# is meta enough to
> have that as a specific language-level concept.
It's something you sometimes find implemented in specific application
programs. Write a class with an abstract "combine()" method. Write
subclasses which implement this. Works for strings and containers
[although you'd probably have a more specific name], coordinate
transformations, product orders, command objects...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |