Re:Monads Are Not Metaphors (2010)
by AnimalMuppet on Thursday September 10, 2015 @01:23PM
(#10199341)
Meaning that any language that doesn't have monads, you're defining to not be useful? Or meaning that monad-the-pattern is everywhere, in every even barely useful language, even if there's no explicit monads in the language?
[ Parent
| on HN ]
Re:Monads Are Not Metaphors (2010)
by TheCoelacanth on Thursday September 10, 2015 @01:54PM
(#10199495)
The monad pattern is everywhere, most languages just don't explicitly recognize it. Any non-trivial program will include many different monads; they just won't be recognized as such in most languages.
For instance in C#, there is a monad with bind=?? and return=no-op (similar in use to the Maybe monad in Haskell). There's another monad with bind=; and return=no-op (similar in use to the IO monad in Haskell). C# just doesn't explicitly recognize those as monads.
I like this comment because it helps illustrate the subtlety of monads as they apply to programming.
I think mode C# programmers would likely think of ';' and '??' as syntax, and who is thinking of 'no-op' as anything!?
But if you were in haskell this would not be syntax, but just functions on an instance of the Monad type class.
Haskell could easily add some sugar to make these constructs syntax as well, but it would just be sugar -- and that is where the power, and confusion I think arises when most programmers think about monads.