Skip to content

Instantly share code, notes, and snippets.

@sym3tri sym3tri/monad.js
Last active Feb 24, 2020

What would you like to do?
Simple Monad example in JavaScript
// as discussed by Crockford here:
// more detailed example here:
function MONAD() {
return function unit(value) {
var monad = Object.create(null);
monad.bind = function (func) {
return func(value);
return monad;
var identity = MONAD();
var monad = identity('hello world');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.