News for hackers. Stuff that matters.
Re:Monads Explained Quickly by finnyspade on Friday April 08, 2016 @11:26PM (#11459748)
Wouldn't it be (with a little runtime typechecking):

function IdentityMonad(v) {

   this._v = v;
}

IdentityMonad.prototype.bind = function(f) {

   var o = f(this._v);

   if(!(o instanceof IdentityMonad)){ 

     throw new Error("function must return IdentityMonad");

   }

   return o;

}

There are no comments on this comment yet.