Skip to content

Comment on Monads for Normal Programmersparent

Comments

The article says:

  > A Monad is an object whose methods return monads.
Further down, it explicitly states that this is not an analogy, that it is 'equivalent':
  > That is, that the following definition is equivalent 
  > to the type theoretical definition of monads:
My Monad object has one (actually... let's not go there yet) method, and it returns a Monad. I happened to name it 'unit' but it could have been 'foo' and it would still fall under the definition given in the article. I've edited my above post to change the name.

Okay, now let's go there: another reason that this is even more silly is that my object has way more than one method:

  irb(main):005:0> Monad.new.methods.count
  => 57
Many of these do not return a monad. Even if I inherited from BasicObject, there would be methods that do not return a Monad, and therefore, according to the above definition, it is impossible to have a monad in Ruby. However, you can have a monad in Ruby, so this further demonstrates that the above definition is incorrect.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.