Convert bottle.js to a monad