Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Nomads explained

Name: Anonymous 2011-04-05 17:49

x >>= f >>= g >>= h
is
h(do_monad_magic(g(do_monad_magic(f(do_monad_magic(x))))))

Name: Anonymous 2011-04-05 18:57

>>3

function Monad(bind, unit) {
    this.bind = bind;
    this.unit = unit;
}

Identity =
    new Monad(function(x, f) { return f(x); },
          function(x) { return x; });

List =
    new Monad(function(x, f) {
    var y = x.map(f);
    return Array.prototype.concat.apply(y);
    }, function (x) { return [x]; });

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List