const monad = require('./monad');
const eff = require('./eff');
function log(x) {
return () => console.log(x);
}
const main = monad.bind(eff, log("Hello"), (_) => log("World"));
// DANGER: UNSAFE!
main();
function bind(m, x, k) {
return m.join(m.map(x, k));
}
module.exports = {bind};
function map(x, f) {
return () => f(x());
}
function pure(x) {
return () => x;
}
function join(x) {
return () => x()();
}
module.exports = {map, pure, join};