News for hackers. Stuff that matters.
Re:A Gentle Intro to Monads … Maybe? by rogerallen on Friday January 17, 2014 @11:43AM (#7076702)
Suggestion for the author. Reformat the code of your translated example. I truly found it impenetrable until I formatted it more like idiomatic d3.js code. With this reformatting, I'll buy that it is less annoying and tedious than the original.

    console.log(
      Maybe(person)
        .bind(function(p) { return p["address"]; })
        .bind(function(a) { return a["state"]; })
        .maybe("State unknown", function(s) { return s; })
    );
And then I realized that d3.js code is monads! (shout it like Charlton Heston in Soylent Green)
Re:A Gentle Intro to Monads … Maybe? by dllthomas on Saturday January 18, 2014 @06:16PM (#7082675)
I'm not sure this is actually using the fact that maybe is monadic - I think this much can be done with applicative functors. In order to really be monadic, you'd need to run the next bind inside the function passed to the previous bind.