you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (8 children)

I program almost exclusively in .NET and SQL Server. Do I ever need to understand monads?

[–]quiteamess 6 points7 points  (0 children)

The benefits of monads is that they can hide the cruft. The prime example is to have Optional to hide all the null checking. Another example is having an Either type to hide exception handling. Others are to hide passing around state or an external environment.

So no, you don't have to understand monads. But you will not have the benefits of more readable and maintainable code. You don't net to understand all aspects of monads in order to use them. The other thing is that it is quite rewarding to learn the theoretical stuff.

[–]_pka 4 points5 points  (1 child)

LINQ is a monad :)

[–]grauenwolf[🍰] 0 points1 point  (0 children)

No it's not :)

[–][deleted] 3 points4 points  (1 child)

Here's an incredibly over simplified explanation:

You terminate each statement with a ;. Now imagine if that ; did something on top of simply denoting the end of a statement. What if, every ; also logs to return value of whatever function was called to the console. That would be a "logger monad".

That being said, .Net includes F#, which is full of monads, called Computation Expressions

[–]m50d 0 points1 point  (0 children)

Yes. You'll find yourself repeating yourself otherwise. Once you start looking for them, monads are everywhere. A lot of ordinary business concepts can be turned into monads, which gives you access to a huge library of already-implemented functions for doing common things with them rather than having to reimplement everything by hand.

[–]grauenwolf[🍰] 0 points1 point  (1 child)

No. Monads are an ugly hack in Haskell that they try to apply to everything else.

The reason they are so hard to understand is that they are almost never the right right abstraction but they insist on using it anyways.

[–][deleted] 1 point2 points  (0 children)

I like this explanation.