function MONAD(modifier) {
  let prototype = Object.create(null)
  
  function unit(value) {
    let monad = Object.create(prototype)
    monad.bind = function (func, args) {
      return func(value, ...args)
    }
    if (typeof modifier === 'function') {
      modifier(monad, value)
    }
    return monad 
  }
  
  return unit
}

let maybe = MONAD(function (monad, value) {
  if (value === null || value === undefined) {
    monad.is_null = true
    monad.bind = function () {
      return monad
    }
  }
})

let monad = maybe(null) 
monad.bind(console.log)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: